# Contributor: Carlo Landmeter # Maintainer: Chloe Kudryavtsev pkgname=caddy pkgver=1.0.4 pkgrel=2 pkgdesc="Fast, cross-platform HTTP/2 web server with automatic HTTPS" url="https://caddyserver.com/" arch="all !s390x" license="Apache-2.0" # TestVisibleErrorWithPanic fails options="net !check" # tests fail on x86 builders due to containerization edge-cases case $CARCH in x86) options="$options !check";; esac depends="ca-certificates" makedepends="go libcap bash" subpackages="$pkgname-openrc" install="$pkgname.pre-install" pkgusers="$pkgname" pkggroups="$pkgname" source="$pkgname-$pkgver.tar.gz::https://github.com/caddyserver/caddy/archive/v$pkgver.tar.gz $pkgname.initd $pkgname.confd $pkgname.conf " builddir="$srcdir/src/github.com/mholt/$pkgname" export GOPATH="$srcdir" prepare() { mkdir -p ${builddir%/*} mv "$srcdir"/$pkgname-$pkgver "$builddir"/ default_prepare } build() { GO111MODULE=on go build -v -o bin/caddy -ldflags \ "-X github.com/mholt/caddy/caddy/caddymain.gitTag=$pkgver" \ ./caddy } check() { GO111MODULE=on go test ./... } package() { install -Dm755 bin/caddy "$pkgdir"/usr/sbin/caddy # caddy currently does not support dropping privileges so we # change attributes with setcat to allow access to priv ports # https://caddyserver.com/docs/faq setcap cap_net_bind_service=+ep \ "$pkgdir"/usr/sbin/caddy install -d -o caddy -g caddy \ "$pkgdir"/var/lib/caddy \ "$pkgdir"/etc/caddy \ "$pkgdir"/var/www install -Dm755 "$srcdir"/$pkgname.initd \ "$pkgdir"/etc/init.d/$pkgname install -Dm644 "$srcdir"/$pkgname.confd \ "$pkgdir"/etc/conf.d/$pkgname install -Dm644 "$srcdir"/$pkgname.conf \ "$pkgdir"/etc/$pkgname/$pkgname.conf } cleanup_srcdir() { go clean -modcache default_cleanup_srcdir } sha512sums="49dae9c0965000ba1cf36a6148ff78718383a511d671fb73edc3b08e4219db0a9902fc70e40bcbb13ffa7afaa520fd1e6303ea3776059de04085896c018d9c02 caddy-1.0.4.tar.gz 1fbab66fbc913f194a94eee6e60e218fcc762b9467258ff22eed43dc98664692f2f2525226068fe3ca101cfe5b6727f16774c2a49c575abb83782416680f399a caddy.initd 7808688e92ab9950403a9b8ad29777f5bd0f75aa8cccc1d49958bb1e5af1b972dfba0c6d31931354f702a3a13933d0a1b8f28b82eed263773d71b79ec95cc15c caddy.confd c24805d17234e6cf40fe1dd102c03f05cf6129d43f58f5567d540a0e4400ce89994820bb0e317f611c65459ae26bcf7110e23a8fecaae11ca78a561892b45d75 caddy.conf"