aports/community/gotosocial/APKBUILD
2025-05-11 17:42:12 +02:00

77 lines
2.4 KiB
Text

# Contributor: Alex McGrath <amk@amk.ie>
# Maintainer: Alex McGrath <amk@amk.ie>
pkgname=gotosocial
pkgver=0.19.1
pkgrel=1
pkgdesc="An ActivityPub social network server"
url="https://codeberg.org/superseriousbusiness/gotosocial"
arch="all"
license="AGPL-3.0-only"
install="$pkgname.pre-install"
pkgusers="gotosocial"
pkggroups="gotosocial"
depends="ffmpeg"
makedepends="go yarn nodejs"
subpackages="$pkgname-openrc"
_pkgver="${pkgver/_rc/-rc}"
source="https://codeberg.org/superseriousbusiness/gotosocial/releases/download/v$_pkgver/gotosocial-$_pkgver-source-code.tar.gz
gotosocial.initd
10-config.patch
"
builddir="$srcdir"
options="!check" # lots of flakey tests
case "$CARCH" in
# flaky test
s390x) options="!check";;
esac
export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"
prepare() {
default_prepare
# Because patches modified go.mod, The vendor needs
# to be updated.
go mod vendor
}
build() {
yarn --cwd ./web/source install --frozen-lockfile
yarn --cwd ./web/source ts-patch install
yarn --cwd ./web/source build
go build -o gotosocial -ldflags="-X 'main.Version=$_pkgver'" -tags nowasm \
./cmd/gotosocial
}
check() {
# skip tests in internal/media as they're failing
local pkgs="$(go list ./... | grep -v 'internal/media')"
GTS_DB_TYPE="sqlite" GTS_DB_ADDRESS=":memory:" \
go test $pkgs
}
package() {
install -Dm755 "$srcdir"/gotosocial.initd \
"$pkgdir"/etc/init.d/gotosocial
install -Dm755 "$builddir"/gotosocial \
-t "$pkgdir"/usr/bin/
install -d -o gotosocial -g gotosocial "$pkgdir"/etc/gotosocial
install -Dm640 "$builddir"/example/config.yaml "$pkgdir"/etc/gotosocial/gotosocial.yml
mkdir -p "$pkgdir"/usr/share/webapps/gotosocial
cp -r "$builddir"/web/assets "$pkgdir"/usr/share/webapps/gotosocial
cp -r "$builddir"/web/template "$pkgdir"/usr/share/webapps/gotosocial
install -d -o gotosocial -g gotosocial "$pkgdir"/var/lib/gotosocial
}
sha512sums="
942390762ef923ab4be6920f884bb6871718d9e707adb591c4f11645c78274b342d4f29214c1dbe6ca2c358fc00c5d3b45da6a6a036242b390392d4ca6645447 gotosocial-0.19.1-source-code.tar.gz
b84bbd5e00d886d018311898a3e212c9d800c1688a5bd27f159e08a224a3c774513236f67288a7d77f22c4b55b75322972909b545d243f033812ab757ec2fd4b gotosocial.initd
e1030586395c7bcca2bf348f764bb51de75e503a29c163e95f155b2192e213db61376f0b15e957813be917ba7f5d28abc8c4e944971ea6db64088424add97874 10-config.patch
"