diff --git a/soju/PKGBUILD b/soju/PKGBUILD new file mode 100644 index 0000000..4fba80f --- /dev/null +++ b/soju/PKGBUILD @@ -0,0 +1,110 @@ +# Maintainer: Thorben Günther + +pkgbase=soju +pkgname=('soju' 'soju-znc-import') +pkgver=0.3.0 +pkgrel=1 +pkgdesc="A user-friendly IRC bouncer" +arch=('x86_64') +url="https://soju.im" +license=('AGPL3') +makedepends=('go' 'scdoc') +source=( + "https://git.sr.ht/~emersion/soju/refs/download/v$pkgver/$pkgname-$pkgver.tar.gz"{,.sig} + 'systemd.service' + 'sysusers.conf' + 'tmpfiles.conf' +) +sha512sums=('9507be35a91fb6fdf96b657f6c5142acba49ee36e4a0de4d060604949f4336db49a79c70038ceebb04354595c5eeb3c7c8f080a458a743335eb7130065775946' + 'SKIP' + '8304fb401114d51714841983c5b96b01d63dab3117733ffab2a469aa6f677e128892434accfdd3298df28eb585f2275798eb9c10f6fec715f33e8bcff30b0d7d' + 'dcd7d35aa61a494cab84c31be57fe3db65a5f1efb06319f9cf3e1f2084dad49f75fdda37b5741faa3a7c1d0a282990ccbc87612895d35aa1773c80487d19019c' + 'b5be4beda3411ad7e9035430d0fa9b02d71f15890a921f9bacb32216d727db5765b15d99ac804670e9052ecb5968c2494f5c10b88d3421960133f8b7962a77a4') +b2sums=('506f7ee78834c21d0909fa093f756760ed9c0d8fa51c62986d4728c6d2e761df7a90684fa0aaa3dabda22a80672da5e72b96196ac95b6779fc581448c4e1143b' + 'SKIP' + 'aaddf3018723b2dbfd8a54921696bed761a9017adf785167db9a4a329cfad987dfe0063c2d4ce5c7531a7b371b4a8a297200149559523643ce0f0183ed04c96d' + '260be525b83bb695c45c3007bbd54f6732cc54af54d56335001db53d962a7a6f9293e7ba1e7e6f86b3d729ab97fd3ce04ebedd4376d53902ec77976fc9c60042' + 'b9d005ebf14aede222239daa73d91b9af55d7383069ee4525ddd5cf795b8e28eca68d8f707de3a55dee024107bbf4a0727b680c0b8bb229c210be6fa50a762e3') +validpgpkeys=('34FF9526CFEF0E97A340E2E40FDE7BE0E88F5E48') + +prepare() { + cd "$pkgbase-$pkgver" + + # create directory for build output + mkdir build + + # download dependencies + go mod download +} + +build() { + cd "$pkgbase-$pkgver" + + # set Go flags + export CGO_CPPFLAGS="${CPPFLAGS}" + export CGO_CFLAGS="${CFLAGS}" + export CGO_CXXFLAGS="${CXXFLAGS}" + + local GO_BLD_FLAGS=( + -v + -trimpath + -buildmode=pie + -mod=readonly + -modcacherw + -ldflags "-linkmode external -extldflags ${LDFLAGS}" + ) + + # binaries + go build \ + "${GO_BLD_FLAGS[@]}" \ + -o build \ + ./cmd/... + + go build \ + "${GO_BLD_FLAGS[@]}" \ + -o build/soju-znc-import \ + ./contrib/znc-import.go + + # man page + scdoc < doc/soju.1.scd > build/soju.1 +} + +check() { + cd "$pkgbase-$pkgver" + go test -v ./... +} + +package_soju() { + pkgdesc="A user-friendly IRC bouncer" + depends=('glibc') + optdepends=('postgresql: PostgreSQL support') + backup=('etc/soju/config') + + # systemd integration + install -vDm644 systemd.service "$pkgdir/usr/lib/systemd/system/$pkgname.service" + install -vDm644 sysusers.conf "$pkgdir/usr/lib/sysusers.d/$pkgname.conf" + install -vDm644 tmpfiles.conf "$pkgdir/usr/lib/tmpfiles.d/$pkgname.conf" + + cd "$pkgbase-$pkgver" + + # binaries + install -vDm755 -t "$pkgdir/usr/bin" build/soju{,ctl} + + # documentation + install -vDm644 -t "$pkgdir/usr/share/man/man1" build/soju.1 + find . \ + -type f \ + -name "*.md" \ + -exec install -vDm644 -t "$pkgdir/usr/share/doc/$pkgname" "{}" + + + # configuration + install -vDm644 config.in "$pkgdir/etc/soju/config" +} + +package_soju-znc-import() { + pkgdesc="A tool to migrate configuration from ZNC to soju" + depends=('glibc') + + cd "$pkgbase-$pkgver" + install -vDm755 -t "$pkgdir/usr/bin" "build/$pkgname" +} diff --git a/soju/systemd.service b/soju/systemd.service new file mode 100644 index 0000000..d5c7d8c --- /dev/null +++ b/soju/systemd.service @@ -0,0 +1,13 @@ +[Unit] +Description=soju IRC bouncer service +After=network.target + +[Service] +Type=simple +User=soju +Restart=always +ExecStart=/usr/bin/soju --config /etc/soju/config +ExecReload=/bin/kill -HUP $MAINPID + +[Install] +WantedBy=multi-user.target diff --git a/soju/sysusers.conf b/soju/sysusers.conf new file mode 100644 index 0000000..5d62936 --- /dev/null +++ b/soju/sysusers.conf @@ -0,0 +1 @@ +u soju - "soju user" /var/lib/soju diff --git a/soju/tmpfiles.conf b/soju/tmpfiles.conf new file mode 100644 index 0000000..1e9850e --- /dev/null +++ b/soju/tmpfiles.conf @@ -0,0 +1,2 @@ +d /var/lib/soju 0750 soju soju - +d /var/lib/soju/logs 0750 soju soju -