93 lines
3.5 KiB
Bash
93 lines
3.5 KiB
Bash
# Maintainer: Anthony Wang <a at exozy dot me>
|
|
# Contributor: ny-a <nyaarch64 at gmail dot com>
|
|
# Contributor: Daniel Moch <daniel@danielmoch.com>
|
|
# Contributor: Jean Lucas <jean@4ray.co>
|
|
# Contributor: Fredrick Brennan <copypaste@kittens.ph>
|
|
|
|
pkgname=mastodon
|
|
pkgver=4.2.8
|
|
pkgrel=1
|
|
pkgdesc='Your self-hosted, globally interconnected microblogging community'
|
|
arch=(any)
|
|
url=https://github.com/mastodon/mastodon
|
|
license=(AGPL3)
|
|
depends=(ffmpeg
|
|
git
|
|
imagemagick
|
|
libidn
|
|
libpqxx
|
|
libxml2
|
|
libxslt
|
|
libyaml
|
|
nodejs
|
|
postgresql
|
|
protobuf
|
|
redis
|
|
ruby-bundler
|
|
sudo
|
|
yarn
|
|
zlib)
|
|
backup=(etc/mastodon.conf)
|
|
install=mastodon.install
|
|
options=(!strip)
|
|
source=(https://github.com/mastodon/mastodon/archive/v$pkgver.tar.gz
|
|
mastodon.target
|
|
mastodon.sysusers.d
|
|
mastodon.tmpfiles.d)
|
|
sha512sums=('c48a04df9c59518f7325b8119bf943436e29ccbfaecff3f7b96162e77fa2012df3f5d4e92e209e233ca7c4646205f5e34bf5f7d22b973115b8e16b3b5ada1fb0'
|
|
'c9820c2a83d08bd5d842a78e924682db97ebd5c7291b682603ad30dafcdcc5816c13e717ad39554f042b9d9ed71ab902ce3f604952264a900a72612ee8060acb'
|
|
'4ee4210bde391e6dc782cb7c14f2cb968c95ad541aa0efcf843a811f8cc5f0d1067ee3c8346bb412aa9fd1dd5a8bd05a4524df7dc4a106957009853dd237074a'
|
|
'27c4eb01d462c525b59e5808a3b2501b63a34425752128388fbde82f7eb5944b20d2f8d8b1be8ed8adb165cab4cfb8e13f90215f20989ca671a0422ffa37001f')
|
|
|
|
prepare() {
|
|
cd mastodon-$pkgver
|
|
# HUGE HACK: manual Gemfile.lock editing time!
|
|
# Only the latest version supports overriding C++ std: https://github.com/brianmario/charlock_holmes/commit/48e4e2db61f1f4133c0f36e476cc4af09566ebce
|
|
sed -i "s/gem 'charlock_holmes', '~> 0.7.7'/gem 'charlock_holmes', github: 'brianmario\/charlock_holmes'/g" Gemfile
|
|
sed -i '/charlock_holmes (0.7.7)/d' Gemfile.lock
|
|
sed -i 's/charlock_holmes (~> 0.7.7)/charlock_holmes!/g' Gemfile.lock
|
|
echo "GIT
|
|
remote: https://github.com/brianmario/charlock_holmes.git
|
|
revision: 3f4f57cfbee6dcd11941f54f9d4da0ebc1402421
|
|
specs:
|
|
charlock_holmes (0.7.7)
|
|
$(cat Gemfile.lock)" > Gemfile.lock
|
|
}
|
|
|
|
build() {
|
|
cd mastodon-$pkgver
|
|
sed -i '/husky install/d' package.json # Stop husky from hijacking git hooks
|
|
bundle config deployment 'true'
|
|
bundle config without 'development test'
|
|
bundle config with 'pam_authentication'
|
|
bundle config build.cbor --with-cflags="-Wno-incompatible-pointer-types"
|
|
bundle config build.posix-spawn --with-cflags="-Wno-incompatible-pointer-types"
|
|
bundle config build.charlock_holmes --with-cxxflags="-std=c++17"
|
|
bundle install -j$(getconf _NPROCESSORS_ONLN)
|
|
yarn install --pure-lockfile
|
|
}
|
|
|
|
package() {
|
|
install -d "$pkgdir"/{var/lib,etc}
|
|
cp -a mastodon-$pkgver "$pkgdir"/var/lib/mastodon
|
|
|
|
# Put the config file in /etc and link to it
|
|
touch "$pkgdir"/etc/mastodon.conf
|
|
ln -s /etc/mastodon.conf "$pkgdir"/var/lib/mastodon/.env.production
|
|
ln -s /usr/bin/node "$pkgdir"/var/lib/mastodon/node
|
|
|
|
install -Dm 644 mastodon.target -t "$pkgdir"/usr/lib/systemd/system
|
|
install -Dm 644 mastodon.sysusers.d "$pkgdir"/usr/lib/sysusers.d/mastodon.conf
|
|
install -Dm 644 mastodon.tmpfiles.d "$pkgdir"/usr/lib/tmpfiles.d/mastodon.conf
|
|
|
|
cd mastodon-$pkgver/dist
|
|
|
|
# Fix path discrepancies
|
|
sed -e 's/home\/mastodon\/live/var\/lib\/mastodon/g' \
|
|
-e 's/home\/mastodon\/.rbenv\/shims/usr\/bin/' \
|
|
-i mastodon-*.service
|
|
sed -e 's/home\/mastodon\/live/var\/lib\/mastodon/g' \
|
|
-i nginx.conf
|
|
|
|
install -Dm 644 mastodon-*.service -t "$pkgdir"/usr/lib/systemd/system
|
|
}
|