Files
gotosocial_aur/PKGBUILD
2026-03-09 22:26:45 -04:00

151 lines
5.7 KiB
Bash

# Maintainer: George Rawlinson <grawlinson@archlinux.org>
# Contributor: malacology <guoyizhang at malacology dot net>
# Contributor: Stefan Husmann <stefan-husmann@t-online.de>
pkgname=gotosocial-balki
_pkgname=gotosocial
pkgver=0.21.1
pkgrel=1
pkgdesc='ActivityPub social network server written in Golang'
arch=(x86_64)
url='https://gotosocial.org'
license=(AGPL-3.0-only)
provides=(gotosocial)
conflicts=(gotosocial)
depends=(glibc)
makedepends=(git go yarn nodejs go-swagger)
options=(!lto)
backup=(
etc/gotosocial/config.yaml
etc/gotosocial/template/2fa.tmpl
etc/gotosocial/template/404.tmpl
etc/gotosocial/template/about.tmpl
etc/gotosocial/template/authorize-interaction.tmpl
etc/gotosocial/template/authorize.tmpl
etc/gotosocial/template/confirm-email.tmpl
etc/gotosocial/template/confirmed-email.tmpl
etc/gotosocial/template/domain-allowlist.tmpl
etc/gotosocial/template/domain-blocklist.tmpl
etc/gotosocial/template/email_confirm.tmpl
etc/gotosocial/template/email_new_report.tmpl
etc/gotosocial/template/email_new_signup.tmpl
etc/gotosocial/template/email_report_closed.tmpl
etc/gotosocial/template/email_reset.tmpl
etc/gotosocial/template/email_signup_approved.tmpl
etc/gotosocial/template/email_signup_rejected.tmpl
etc/gotosocial/template/email_test.tmpl
etc/gotosocial/template/error.tmpl
etc/gotosocial/template/finalize.tmpl
etc/gotosocial/template/index.tmpl
etc/gotosocial/template/index_register.tmpl
etc/gotosocial/template/index_what_is_this.tmpl
etc/gotosocial/template/login-info.tmpl
etc/gotosocial/template/login_button.tmpl
etc/gotosocial/template/maintenance.tmpl
etc/gotosocial/template/oob.tmpl
etc/gotosocial/template/page.tmpl
etc/gotosocial/template/page_footer.tmpl
etc/gotosocial/template/page_header.tmpl
etc/gotosocial/template/page_ogmeta.tmpl
etc/gotosocial/template/page_stylesheets.tmpl
etc/gotosocial/template/profile-gallery.tmpl
etc/gotosocial/template/profile.tmpl
etc/gotosocial/template/profile_about_user.tmpl
etc/gotosocial/template/profile_fields.tmpl
etc/gotosocial/template/profile_header.tmpl
etc/gotosocial/template/settings.tmpl
etc/gotosocial/template/sign-in.tmpl
etc/gotosocial/template/sign-up.tmpl
etc/gotosocial/template/signed-up.tmpl
etc/gotosocial/template/status.tmpl
etc/gotosocial/template/status_attachment.tmpl
etc/gotosocial/template/status_attributes.tmpl
etc/gotosocial/template/status_header.tmpl
etc/gotosocial/template/status_info.tmpl
etc/gotosocial/template/status_poll.tmpl
etc/gotosocial/template/tag.tmpl
etc/gotosocial/template/thread.tmpl
)
source=(
"$_pkgname::git+https://codeberg.org/superseriousbusiness/gotosocial#tag=v$pkgver"
sysusers.conf
tmpfiles.conf
use-fhs-directories.patch
modded.patch
)
sha512sums=('75df2cf6d197f77ede26854353a59e63cd956f6ff2c029b1964ae74f90844cc7faf8ab563ce610623429dea4875cc613d9a60d7a0c434ca26c598badab229ac5'
'2ff5499a31e12733cb20a9261942ed135fbac327d5a836b8955f3e86c009a603cf965440d9dbe6db64b80d0f652ba56faddb0ef398393b72474d8cf6c438ab80'
'b89fad3073e140f17167515b38942e5b5e2bc2aee03c484e1bb7cf6444f86cb1e2a13a60b101e04d22633d348be073ca26cd309da4746e5062c12b4f3ce4b38a'
'87edf6e6acee86a621c838a7db32f1c9aab70bc5640f8eae099c5133a2be77ec2f711261d716a6821e4c0414436592170b1ae7a5f652bc8aeab49c8dbd0fedde'
'54ce7741e0e5e53a5719bb7f396175ad19f63f5714257d6d4b6befd934906ea9515cc1b203688e152dfd0a57315d405c6e6ee92e48069b606768aa5658a2e76a')
b2sums=('28e357ce4d63f222b2078cf92d51ca5438db5e9a1427c2f145adafcfc5fa2aa1001547c7c87bd49158de470c7eaf7da2e7f5af7c7808d9656909442de43d7da8'
'ccf672731b88fc6700b0b81737790365e1eea0066bad1bbf6b13dac1e5b42af69063838efca47a6d9c16ee3f6308e2e23b92cf79d4226cd88f8551fb7361649b'
'4f65af952441c0f54bb32049a149675e207f8993678423d369c4095c57476464614ac720eccc64d7a93a81268ad7ca41cae75ca7211bd7b78f9035f6e5341f04'
'3671911545d15cc21045b37fbe6983c05499e66b8a6a1e1b3eccbb5c2686914c88b090dec0bfe8e2919d8787e5b4c59bfb1e2c292cad30a8b552ab57e91d5fdf'
'9b0f65ad56fbdd92b5e827b169d4152609a075bd3d7c90d227e1c8736692fbf58eb672d7138e3bfb04e9308248c25dfe56d9df6a99c86263a96ed38395fd0319')
prepare() {
cd "$_pkgname"
# create directory for build output
mkdir build
patch -p1 -i "$srcdir/modded.patch"
# download dependencies
export GOPATH="${srcdir}"
go mod download
# use FHS directories
patch -p1 -i "$srcdir/use-fhs-directories.patch"
}
build() {
cd "$_pkgname"
# set Go flags
export CGO_CPPFLAGS="${CPPFLAGS}"
export CGO_CFLAGS="${CFLAGS}"
export CGO_CXXFLAGS="${CXXFLAGS}"
export GOPATH="${srcdir}"
# generate up-to-date swagger.yaml
swagger generate spec --scan-models --exclude-deps -o web/assets/swagger.yaml
sed -e "s/REPLACE_ME/$pkgver/" -i web/assets/swagger.yaml
go build -v \
-buildmode=pie \
-mod=readonly \
-modcacherw \
-ldflags "-compressdwarf=false \
-linkmode external \
-extldflags '${LDFLAGS}' \
-X main.Version=$pkgver" \
-o build \
./cmd/...
# generate web assets
yarn --cwd ./web/source install --frozen-lockfile
yarn --cwd ./web/source ts-patch install
yarn --cwd ./web/source build
}
package() {
# systemd integration
install -vDm644 sysusers.conf "$pkgdir/usr/lib/sysusers.d/$_pkgname.conf"
install -vDm644 tmpfiles.conf "$pkgdir/usr/lib/tmpfiles.d/$_pkgname.conf"
install -vDm644 "$_pkgname/example/$_pkgname.service" -t "$pkgdir/usr/lib/systemd/system"
cd "$_pkgname"
# binary
install -vDm755 -t "$pkgdir/usr/bin" "build/$_pkgname"
# configuration
install -vDm640 -t "$pkgdir/etc/$_pkgname" example/config.yaml
# web frontend
install -vd "$pkgdir/usr/share/$_pkgname"
cp -vr web/assets/* "$pkgdir/usr/share/$_pkgname"
cp -vr web/template "$pkgdir/etc/$_pkgname"
}