2022-11-05 03:54:06 +00:00
|
|
|
# Maintainer: Antoine Martin (ayakael) <dev@ayakael.net>
|
|
|
|
# Contributor: Antoine Martin (ayakael) <dev@ayakael.net>
|
2021-11-30 21:44:44 +00:00
|
|
|
|
|
|
|
pkgname=mastodon
|
2023-06-22 03:36:51 +00:00
|
|
|
_pkgname=$pkgname
|
2024-02-01 16:21:11 +00:00
|
|
|
pkgver=4.2.5
|
2023-06-22 03:36:51 +00:00
|
|
|
_gittag=v$pkgver
|
2024-01-24 14:49:56 +00:00
|
|
|
pkgrel=0
|
2022-11-05 03:54:06 +00:00
|
|
|
pkgdesc="Self-hosted social media and network server based on ActivityPub and OStatus"
|
2023-11-27 20:06:09 +00:00
|
|
|
arch="x86_64"
|
2023-06-22 03:36:51 +00:00
|
|
|
url="https://github.com/mastodon/mastodon"
|
2022-11-05 03:54:06 +00:00
|
|
|
license="AGPL-3.0-only"
|
|
|
|
depends="
|
2023-06-22 03:36:51 +00:00
|
|
|
$pkgname-assets=$pkgver-r$pkgrel
|
2022-11-05 03:54:06 +00:00
|
|
|
ffmpeg
|
2023-07-12 21:21:14 +00:00
|
|
|
file
|
2022-11-05 03:54:06 +00:00
|
|
|
gcompat
|
|
|
|
imagemagick
|
|
|
|
nodejs
|
|
|
|
npm
|
|
|
|
protobuf
|
2024-01-24 14:42:08 +00:00
|
|
|
py3-elasticsearch
|
2022-11-05 03:54:06 +00:00
|
|
|
redis
|
2024-01-24 14:41:55 +00:00
|
|
|
ruby
|
|
|
|
ruby-bundler
|
2022-11-05 03:54:06 +00:00
|
|
|
yarn
|
|
|
|
"
|
|
|
|
makedepends="
|
|
|
|
gnu-libiconv-dev
|
|
|
|
icu-dev
|
|
|
|
libffi-dev
|
|
|
|
libidn-dev
|
|
|
|
libxml2-dev
|
|
|
|
libxslt-dev
|
|
|
|
openssl-dev
|
|
|
|
postgresql-dev
|
|
|
|
protobuf-dev
|
2024-01-24 14:41:55 +00:00
|
|
|
ruby-dev
|
2022-11-05 03:54:06 +00:00
|
|
|
yaml-dev
|
|
|
|
zlib-dev
|
|
|
|
"
|
|
|
|
install="
|
|
|
|
$pkgname.pre-install
|
|
|
|
$pkgname.post-upgrade
|
2023-06-22 03:36:51 +00:00
|
|
|
$pkgname.post-install
|
2022-11-05 03:54:06 +00:00
|
|
|
"
|
|
|
|
source="
|
2023-06-22 03:36:51 +00:00
|
|
|
mastodon-$_gittag.tar.gz::https://github.com/mastodon/mastodon/archive/$_gittag.tar.gz
|
|
|
|
mastodon.initd
|
|
|
|
mastodon.web.initd
|
|
|
|
mastodon.sidekiq.initd
|
|
|
|
mastodon.streaming.initd
|
|
|
|
mastodon.logrotate
|
|
|
|
bin-wrapper.in
|
2022-11-05 03:54:06 +00:00
|
|
|
"
|
2023-06-22 03:36:51 +00:00
|
|
|
subpackages="$pkgname-openrc $pkgname-assets::noarch"
|
2022-11-06 15:15:01 +00:00
|
|
|
options="!check" # No test suite
|
2023-06-22 03:36:51 +00:00
|
|
|
|
|
|
|
_prefix="usr/lib/bundles/$_pkgname"
|
|
|
|
|
|
|
|
export BUNDLE_DEPLOYMENT=true
|
|
|
|
export BUNDLE_FORCE_RUBY_PLATFORM=true
|
|
|
|
export BUNDLE_FROZEN=true
|
|
|
|
export BUNDLE_JOBS=${JOBS:-2}
|
2021-11-30 21:44:44 +00:00
|
|
|
|
|
|
|
prepare() {
|
2022-11-05 03:54:06 +00:00
|
|
|
default_prepare
|
2021-11-30 21:44:44 +00:00
|
|
|
|
2022-11-05 03:54:06 +00:00
|
|
|
# Allow use of any bundler
|
|
|
|
sed -i -e '/BUNDLED/,+1d' Gemfile.lock
|
2021-11-30 21:44:44 +00:00
|
|
|
|
2022-11-05 03:54:06 +00:00
|
|
|
# Allow use of higher Node versions
|
|
|
|
sed -i 's/"node": .*"/"node": ">=14.15"/' package.json
|
2022-11-06 15:15:01 +00:00
|
|
|
|
|
|
|
mkdir -p "$srcdir"/gem-cache
|
2021-11-30 21:44:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
build() {
|
2023-06-22 03:36:51 +00:00
|
|
|
local bundle_without='exclude development'
|
|
|
|
|
|
|
|
msg "Installing Ruby gems..."
|
|
|
|
bundle config --local build.nokogiri --use-system-libraries \
|
|
|
|
--with-xml2-include=/usr/include/libxml2 \
|
|
|
|
--with-xslt-include=/usr/include/libxslt
|
|
|
|
bundle config --local build.ffi --enable-system-libffi
|
|
|
|
bundle config --local build.idn --enable-system-libidn
|
|
|
|
bundle config --local path "vendor/bundle"
|
|
|
|
bundle config --local set deployment 'false'
|
|
|
|
bundle config --local set without "$bundle_without"
|
|
|
|
|
|
|
|
bundle install --no-cache -j"$(getconf _NPROCESSORS_ONLN)"
|
|
|
|
|
|
|
|
msg "Installing npm modules..."
|
|
|
|
yarn install --production --frozen-lockfile
|
|
|
|
|
|
|
|
(
|
|
|
|
msg "Compiling assets..."
|
|
|
|
export NODE_ENV=production
|
|
|
|
export RAILS_ENV=production
|
|
|
|
export NODE_OPTIONS="--openssl-legacy-provider"
|
|
|
|
|
|
|
|
OTP_SECRET=precompile_placeholder SECRET_KEY_BASE=precompile_placeholder bundle exec rails assets:precompile
|
|
|
|
)
|
|
|
|
|
|
|
|
msg "Cleaning assets gems..."
|
|
|
|
bundle config --local without "$bundle_without"
|
|
|
|
bundle clean
|
|
|
|
|
|
|
|
# Create executables in bin/*.
|
|
|
|
# See also https://github.com/bundler/bundler/issues/6149.
|
|
|
|
bundle binstubs --force bundler puma sidekiq
|
2021-11-30 21:44:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
package() {
|
2023-06-22 03:36:51 +00:00
|
|
|
local destdir="$pkgdir"/$_prefix
|
|
|
|
local datadir="$pkgdir/var/lib/gitlab"
|
2022-11-05 03:54:06 +00:00
|
|
|
# directory creation
|
|
|
|
install -dm 755 \
|
2023-06-22 03:36:51 +00:00
|
|
|
"$destdir" \
|
|
|
|
"$datadir" \
|
2022-11-05 03:54:06 +00:00
|
|
|
"$pkgdir"/etc/init.d
|
2021-11-30 21:44:44 +00:00
|
|
|
|
2023-06-22 03:36:51 +00:00
|
|
|
|
|
|
|
# Install application files.
|
|
|
|
rmdir "$destdir"
|
|
|
|
cp -a "$builddir" "$destdir"
|
|
|
|
|
|
|
|
install -m755 -t "$destdir"/bin/ \
|
|
|
|
bin/bundle \
|
|
|
|
bin/rails \
|
|
|
|
bin/rake \
|
|
|
|
bin/sidekiq \
|
|
|
|
bin/sidekiqmon \
|
|
|
|
bin/tootctl \
|
|
|
|
bin/puma
|
|
|
|
|
|
|
|
cd "$destdir"/vendor/bundle/ruby/*/
|
|
|
|
|
|
|
|
# Remove tests, documentations and other useless files.
|
|
|
|
find gems/ \( -name 'doc' \
|
|
|
|
-o -name 'spec' \
|
|
|
|
-o -name 'test' \) \
|
|
|
|
-type d -maxdepth 2 -exec rm -fr "{}" +
|
|
|
|
find gems/ \( -name 'README*' \
|
|
|
|
-o -name 'CHANGELOG*' \
|
|
|
|
-o -name 'CONTRIBUT*' \
|
|
|
|
-o -name '*LICENSE*' \
|
|
|
|
-o -name 'Rakefile' \
|
|
|
|
-o -name '.*' \) \
|
|
|
|
-type f -delete
|
|
|
|
|
|
|
|
# Remove assets, they are already compiled.
|
|
|
|
rm -r gems/doorkeeper-*/app/assets
|
|
|
|
rm -r gems/pghero-*/app/assets
|
|
|
|
|
|
|
|
# Remove build logs and cache.
|
|
|
|
rm -rf build_info/ cache/
|
|
|
|
find extensions/ \( -name gem_make.out -o -name mkmf.log \) -delete
|
|
|
|
|
|
|
|
cat > "$datadir"/.profile <<-EOF
|
|
|
|
export RAILS_ENV=production
|
|
|
|
export NODE_ENV=production
|
|
|
|
export EXECJS_RUNTIME=Disabled
|
|
|
|
EOF
|
|
|
|
|
|
|
|
# Install wrapper scripts to /usr/bin.
|
2023-07-12 12:34:34 +00:00
|
|
|
local name; for name in rake rails tootctl; do
|
2023-06-22 03:36:51 +00:00
|
|
|
sed "s/__COMMAND__/$name/g" "$srcdir"/bin-wrapper.in \
|
|
|
|
> "$builddir"/mastodon-$name
|
|
|
|
install -m755 -D "$builddir"/mastodon-$name "$pkgdir"/usr/bin/mastodon-$name
|
|
|
|
done
|
2021-11-30 21:44:44 +00:00
|
|
|
|
2022-11-05 03:54:06 +00:00
|
|
|
# Put the config file in /etc and link to it
|
|
|
|
touch "$pkgdir"/etc/mastodon.conf
|
2023-06-22 03:36:51 +00:00
|
|
|
ln -s /etc/mastodon.conf "$destdir"/.env.production
|
|
|
|
ln -s /usr/bin/node "$destdir"/node
|
2021-11-30 21:44:44 +00:00
|
|
|
|
2023-06-22 03:36:51 +00:00
|
|
|
for file in $_pkgname $_pkgname.sidekiq $_pkgname.web $_pkgname.streaming; do
|
|
|
|
install -m755 -D "$srcdir"/$file.initd "$pkgdir"/etc/init.d/$file
|
2022-11-05 03:54:06 +00:00
|
|
|
done
|
2021-11-30 21:44:44 +00:00
|
|
|
|
2022-11-05 03:54:06 +00:00
|
|
|
# Removing all prebuilt artifacts
|
2023-06-22 03:36:51 +00:00
|
|
|
rm -R "$destdir"/node_modules/*/prebuilds 2>&1 || true
|
|
|
|
|
|
|
|
install -m644 -D "$srcdir"/$_pkgname.logrotate \
|
|
|
|
"$pkgdir"/etc/logrotate.d/$_pkgname
|
|
|
|
}
|
|
|
|
|
|
|
|
assets() {
|
|
|
|
depends=""
|
|
|
|
|
|
|
|
amove $_prefix/public/assets
|
2021-11-30 21:44:44 +00:00
|
|
|
}
|
2023-06-22 03:36:51 +00:00
|
|
|
|
2021-11-30 21:44:44 +00:00
|
|
|
sha512sums="
|
2024-02-01 16:21:11 +00:00
|
|
|
c594178010c296b581531d6e35887214441d6f1f44083578dbb38a3beeb64d968a171cba0a9335e8f8b27b45e957508ab3168ec0056b423bf8fb44abd0f5f6d5 mastodon-v4.2.5.tar.gz
|
2023-06-22 03:36:51 +00:00
|
|
|
36604cd630f0f5b4d88b630b1512cd26e922f859e5d19cbb85106ff29fc9048d2349f926d5c4b6947c655f67e60ec33e2f524a8154405a4369f283e00be7cdce mastodon.initd
|
|
|
|
9e77061fbdebe90492398f8089a7d2612ff4b6e70b5462dd67330b66d9788cb0133eab38c372b1f27a7214aacdd9f7f70381d4ecc6e92c8c38d794404ae0f840 mastodon.web.initd
|
2023-06-27 14:26:04 +00:00
|
|
|
6dacafca86dd39f6a6efa773cfe35b4632098175605a7c64488027237b01028d9785e50a3a0532b88ebf8f857c9a594c7b68f9e577b46e95104e7cffde51ccf8 mastodon.sidekiq.initd
|
2023-07-13 01:43:12 +00:00
|
|
|
63b67ec16107e4d1747ae956cdd41edd03be71da1ed96d21a18710cbba69ce37c856f4abc080a61f172a10859d0b9a33ba9290fc69213e1bc15a1ce8f8d40108 mastodon.streaming.initd
|
2023-06-22 03:36:51 +00:00
|
|
|
83b3bae5b6fdb4d0dbc1cbe546c62c0aa77397b97d1a5d5377af032466677de188065b556710c0d96576bbae89cc76800f1ffb8cd718155eb2784da818f27619 mastodon.logrotate
|
2023-07-12 12:34:34 +00:00
|
|
|
dfd0e43ac6c28387bd4aa57fd98ae41aeb5a098b6deb3e44b89f07818e2470773b025364afee7ef6fd0f664cb86bbbbe8796c9f222f5436c256a787282fbe3e1 bin-wrapper.in
|
2021-11-30 21:44:44 +00:00
|
|
|
"
|