summaryrefslogtreecommitdiff
path: root/ergo/PKGBUILD
diff options
context:
space:
mode:
Diffstat (limited to 'ergo/PKGBUILD')
-rw-r--r--ergo/PKGBUILD78
1 files changed, 78 insertions, 0 deletions
diff --git a/ergo/PKGBUILD b/ergo/PKGBUILD
new file mode 100644
index 0000000..642a2e4
--- /dev/null
+++ b/ergo/PKGBUILD
@@ -0,0 +1,78 @@
+# Maintainer: Deposite Pirate <dpirate at metalpunks dot info>
+#
+# Upstream: https://git.metalpunks.info/arch-ports
+
+pkgname=ergo
+pkgver=2.7.0
+pkgrel=3
+pkgdesc="A modern IRC server written in Go"
+arch=('x86_64')
+url="https://github.com/ergochat/ergo"
+license=('MIT')
+install=ergo.install
+depends=('glibc')
+makedepends=('go' 'git')
+source=("git+$url#tag=v$pkgver"
+ "ergo-paths.patch"
+ "ergo.service"
+ "ergo.sysusers"
+ "ergo.tmpfiles")
+sha256sums=('SKIP'
+ '824b6618d0377c50645ff75cf1f3ad903e217476738728bc57102fd26ca766c8'
+ '366b7b10e44e9c0bbe2ee434b1011a9dc71fceb7836502db9a9e1c4400452d12'
+ '1930c0e32093b32ff7c05fe8548c20a90846acea08b62aab3194c1be7240a756'
+ '1bc9acdd7fc1fb8251a0165a19d6f4383069e522827535b9c1f717de5495cb29')
+backup=('etc/ergo.conf')
+replaces=('oragono')
+conflicts=('oragono')
+provides=('oragono')
+
+prepare() {
+ cd "${srcdir}/${pkgname}"
+
+ # Fix paths
+ patch -p1 -i ../ergo-paths.patch
+}
+
+build() {
+ export GOPATH=$(pwd)/..
+ cd "${srcdir}/${pkgname}"
+
+ GIT_COMMIT="$(git rev-parse HEAD 2> /dev/null)"
+
+ # flags from https://wiki.archlinux.org/index.php/Go_package_guidelines
+ # to address issues namcap warns about:
+ # ergo W: ELF file ('usr/bin/ergo') lacks FULL RELRO, check LDFLAGS.
+ # ergo W: ELF file ('usr/bin/ergo') lacks PIE.
+ # related: https://bugs.archlinux.org/task/60928
+ go build \
+ -trimpath \
+ -buildmode=pie \
+ -ldflags "-X main.commit=${GIT_COMMIT} -linkmode external -extldflags \"${LDFLAGS}\"" \
+ -v \
+ .
+
+ rm languages/README.md
+ rm -rf languages/example
+}
+
+check() {
+ export GOPATH=$(pwd)/..
+ cd "${srcdir}/${pkgname}"
+
+ go test ./...
+}
+
+package() {
+ install -Dm644 ergo.service "${pkgdir}/usr/lib/systemd/system/ergo.service"
+ install -Dm644 "${srcdir}/ergo.sysusers" "${pkgdir}/usr/lib/sysusers.d/ergo.conf"
+ install -Dm644 "${srcdir}/ergo.tmpfiles" "${pkgdir}/usr/lib/tmpfiles.d/ergo.conf"
+
+ cd "${srcdir}/${pkgname}"
+ install -Dm755 -d "${pkgdir}/usr/share/${pkgname}/i18n"
+ cp languages/* "${pkgdir}/usr/share/${pkgname}/i18n/"
+ install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
+ install -Dm755 ergo "${pkgdir}/usr/bin/ergo"
+ install -Dm644 default.yaml "${pkgdir}/etc/ergo.conf"
+ install -Dm644 ergo.motd "${pkgdir}/usr/share/${pkgname}/default.motd"
+}