ayaports/user/mastodon/APKBUILD

135 lines
3.6 KiB
Text

# Maintainer: Antoine Martin (ayakael) <dev@ayakael.net>
# Contributor: Antoine Martin (ayakael) <dev@ayakael.net>
pkgname=mastodon
pkgver=3.5.3
pkgrel=0
pkgdesc="Self-hosted social media and network server based on ActivityPub and OStatus"
arch="all"
url="https://github.com/tootsuite/mastodon"
license="AGPL-3.0-only"
_ruby_duplicate="
ruby-addressable
ruby-builder
ruby-charlock_holmes
ruby-concurrent-ruby
ruby-erubi
ruby-ffi
ruby-i18n
ruby-mini_portile2
ruby-minitest
ruby-multi_json
ruby-net-imap
ruby-net-ldap
ruby-net-pop
ruby-net-smtp
ruby-nokogiri
ruby-ox
ruby-pg
ruby-posix-spawn
ruby-public_suffix
ruby-rake
ruby-rexml
ruby-thor
ruby-unf_ext
"
[ "$CARCH" = "armhf" ] && _ruby_duplicate="${_ruby_duplicate/ruby-ox/}"
[ "$CARCH" = "armv7" ] && _ruby_duplicate="${_ruby_duplicate/ruby-ox/}"
depends="
ffmpeg
gcompat
imagemagick
nodejs
npm
protobuf
redis
ruby
ruby-bigdecimal
ruby-bundler
ruby-etc
ruby-io-console
ruby-irb
ruby-json
yarn
$_ruby_duplicate
"
makedepends="
gnu-libiconv-dev
icu-dev
libffi-dev
libidn-dev
libressl-dev
libxml2-dev
libxslt-dev
openssl-dev
postgresql-dev
protobuf-dev
ruby-dev
ruby-rdoc
yaml-dev
zlib-dev
"
install="
$pkgname.pre-install
$pkgname.post-install
$pkgname.post-upgrade
"
source="
mastodon-$pkgver.tar.gz::https://github.com/tootsuite/mastodon/archive/v$pkgver.tar.gz
mastodon-web.initd
mastodon-sidekiq.initd
mastodon-streaming.initd
0001-ruby-3.1-support.patch
"
subpackages="$pkgname-openrc"
options="!check !strip"
prepare() {
default_prepare
# Allow use of any bundler
sed -i -e '/BUNDLED/,+1d' Gemfile.lock
# Allow use of higher Node versions
sed -i 's/"node": .*"/"node": ">=14.15"/' package.json
}
build() {
bundle config build.nokogiri --use-system-libraries --with-iconv-lib=/usr/lib --with-iconv-include=/usr/include
bundle config set deployment 'true'
bundle config set without 'development test'
bundle config set no-cache 'true'
bundle install -j"$(getconf _NPROCESSORS_ONLN)"
yarn install --pure-lockfile --ignore-engines
RAILS_ENV='production' OTP_SECRET=precompile_placeholder SECRET_KEY_BASE=precompile_placeholder bundle exec rails assets:precompile
}
package() {
# directory creation
install -dm 755 \
"$pkgdir"/usr/share/webapps \
"$pkgdir"/etc/init.d
cp -a "$builddir" "$pkgdir"/usr/share/webapps/mastodon
# Put the config file in /etc and link to it
touch "$pkgdir"/etc/mastodon.conf
ln -s /etc/mastodon.conf "$pkgdir"/usr/share/webapps/mastodon/.env.production
ln -s /usr/bin/node "$pkgdir"/usr/share/webapps/mastodon/node
install -Dm 755 "$srcdir"/*.initd "$pkgdir"/etc/init.d/
for i in $_ruby_duplicate; do
rm -R "$pkgdir"/usr/share/webapps/mastodon/vendor/bundle/ruby/*/gems/${i/ruby-/}*
done
# Removing all prebuilt artifacts
rm -R "$pkgdir"/usr/share/webapps/mastodon/node_modules/*/prebuilds 2>&1 || true
}
sha512sums="
9035184ead64b46f28630d8a5d57ae414b34a81604f7acb146ef56f7c76483fbb8892197e16a4a61bea0572ae2861f2f7a76912885bb8005f5bc64d3f62d8db1 mastodon-3.5.3.tar.gz
9e77061fbdebe90492398f8089a7d2612ff4b6e70b5462dd67330b66d9788cb0133eab38c372b1f27a7214aacdd9f7f70381d4ecc6e92c8c38d794404ae0f840 mastodon-web.initd
06ebff4b4f51e0c7122db9ed175958fbcadf7e25d1d33c4cfd43992865b1ba183dbe6b4c8c244575f30a45a72d7d4ea3d887c597060e9cf2203bb00ae1a7ac79 mastodon-sidekiq.initd
eb8af0188c49b3507f9eedf54baf9d848f11288ce475963bde70686a1e5ff8960d32560771479651597703728bf0c8663a7bd068ccd8d32b620eba442a9a8ff1 mastodon-streaming.initd
0172f8867cc730c4094fcf40c640d3235cad834280e1a731d5175825e33907806ed0d6f7cc44d188dde9ecbf0cf7b68d8d75078d2d083702d10a71ff4efed17b 0001-ruby-3.1-support.patch
"