2022-11-05 03:54:06 +00:00
|
|
|
# Contributor: Antoine Martin (ayakael) <dev@ayakael.net>
|
2024-04-14 21:38:02 +00:00
|
|
|
# Maintainer: 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-07-05 02:52:47 +00:00
|
|
|
pkgver=4.2.10
|
2023-06-22 03:36:51 +00:00
|
|
|
_gittag=v$pkgver
|
2024-07-11 01:42:04 +00:00
|
|
|
pkgrel=1
|
2022-11-05 03:54:06 +00:00
|
|
|
pkgdesc="Self-hosted social media and network server based on ActivityPub and OStatus"
|
2024-06-03 14:32:29 +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:45:01 +00:00
|
|
|
py3-elasticsearch
|
2022-11-05 03:54:06 +00:00
|
|
|
redis
|
2024-01-24 14:44:32 +00:00
|
|
|
ruby3.2
|
|
|
|
ruby3.2-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:44:32 +00:00
|
|
|
ruby3.2-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-07-05 02:52:47 +00:00
|
|
|
1fe5417136bc020a83b83eaccef7f1f46c13fc8318681f12ba556b1b6b03e25ef7b6335c28f4e6722101e97b63020cbd0d3fbacdaf9b3b5a4b73c3cf3e230813 mastodon-v4.2.10.tar.gz
|
2024-07-11 01:42:04 +00:00
|
|
|
d49fea9451c97ccefe5e35b68e4274aeb427f9d1e910b89c1f6c810489c3bec1ccff72952fdaef95abf944b8aff0da84a52347540d36ff1fba5ccc19e1d935c6 mastodon.initd
|
|
|
|
eefe12a31268245f802222c0001dac884e03adb0d301e53a1512a3cd204836ca03ad083908cd14d146cf0dce99e3a4366570efd0e40a9a490ccd381d4c63c32f mastodon.web.initd
|
|
|
|
8fc9249c01693bb02b8d1a6177288d5d3549addde8c03eb35cc7a32dde669171872ebc2b5deb8019dc7a12970098f1af707171fa41129be31b04e1dc1651a777 mastodon.sidekiq.initd
|
|
|
|
03433a2f58600ca0d58e7c3713df2146ccdfc92033ccfe801dbd38bac39b66d6297f2b5ca02300caa36455b484eab2caa68c912c2f72150203bfa0e106c375fc 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
|
|
|
"
|