ayaports/user/mastodon/APKBUILD

139 lines
3.7 KiB
Text

# Maintainer: Antoine Martin (ayakael) <dev@ayakael.net>
# Contributor: Antoine Martin (ayakael) <dev@ayakael.net>
pkgname=mastodon
pkgver=4.0.0_rc2
_gittag=4.0.0rc2
pkgrel=0
pkgdesc="Self-hosted social media and network server based on ActivityPub and OStatus"
# Needs ruby 3.1
#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-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
libxml2-dev
libxslt-dev
openssl-dev
postgresql-dev
protobuf-dev
ruby-dev
ruby-rdoc
yaml-dev
zlib-dev
"
install="
$pkgname.pre-install
$pkgname.post-upgrade
"
source="
mastodon-$_gittag.tar.gz::https://github.com/tootsuite/mastodon/archive/v$_gittag.tar.gz
mastodon-web.initd
mastodon-sidekiq.initd
mastodon-streaming.initd
0001-ruby-3.1-support.patch
"
subpackages="$pkgname-openrc"
options="!check" # No test suite
builddir="$srcdir"/$pkgname-$_gittag
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
mkdir -p "$srcdir"/gem-cache
}
build() {
pwd
bundle config build.nokogiri --use-system-libraries --with-iconv-lib=/usr/lib --with-iconv-include=/usr/include
bundle config set deployment 'false'
bundle config set without 'development test'
bundle config set no-cache 'true'
bundle install -j"$(getconf _NPROCESSORS_ONLN)"
export NODE_OPTIONS="--openssl-legacy-provider"
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="
dcde85a48b08216cffe99a13f5bdc5908b24c539e4bd4259c6d63a710e2377414e708d9be9a0cd4754c1c6168a7140beabd40b093935ffba0417888dda44499c mastodon-4.0.0rc2.tar.gz
9e77061fbdebe90492398f8089a7d2612ff4b6e70b5462dd67330b66d9788cb0133eab38c372b1f27a7214aacdd9f7f70381d4ecc6e92c8c38d794404ae0f840 mastodon-web.initd
06ebff4b4f51e0c7122db9ed175958fbcadf7e25d1d33c4cfd43992865b1ba183dbe6b4c8c244575f30a45a72d7d4ea3d887c597060e9cf2203bb00ae1a7ac79 mastodon-sidekiq.initd
eb8af0188c49b3507f9eedf54baf9d848f11288ce475963bde70686a1e5ff8960d32560771479651597703728bf0c8663a7bd068ccd8d32b620eba442a9a8ff1 mastodon-streaming.initd
d2322dbb2e38bf13aa70da3720d1ba3172333aa187a3968baf55ff525f3303755e778a7bfc8e5b702af7a27552b25120329c172addc29286de3e009fa942ee8a 0001-ruby-3.1-support.patch
"