lilac/repo/caddy-bgme/PKGBUILD

108 lines
3.5 KiB
Bash

# Base on https://github.com/archlinux/svntogit-packages/tree/packages/bash/trunk
# Contributor: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Contributor: Christian Rebischke <chris.rebischke@archlinux.org>
# Contributor: Wei Congrui < crvv.mail at gmail dot com >
# Contributor: Carl George < arch at cgtx dot us >
# Contributor: Eric Engeström <eric at engestrom dot ch>
# Contributor: Andreas Linz <klingt.net at gmail dot com>
# Contributor: Akshay S Dinesh <asdofindia at gmail dot com>
pkgname=caddy-bgme
_pkgname=caddy
pkgver=2.7.0.beta.1
_gitcommit=v2.7.0-beta.1
_distcommit=5ded5351fc9f6f35286e38c4552fc2d8b37f4df3
pkgrel=5
pkgdesc='Fast web server with automatic HTTPS'
url='https://caddyserver.com'
arch=('x86_64')
license=('Apache')
depends=('glibc')
makedepends=('go' 'git' 'gzip')
conflicts=('caddy' 'caddy-bgme-git')
provides=('caddy')
backup=('etc/caddy/Caddyfile')
source=(
caddy-git::"git+https://github.com/caddyserver/caddy#tag=${_gitcommit}"
caddy-dist::"git+https://github.com/caddyserver/dist#commit=${_distcommit}"
forwardproxy::"git+https://github.com/klzgrad/forwardproxy.git"
main.go
caddy.sysusers
caddy.tmpfiles
Caddyfile
)
sha512sums=(
'SKIP'
'SKIP'
'SKIP'
'aa9fefd87c87e3a120af66fcd745448831b99baab9b795a35544a752147422920d200e4c0ea9d0ceb0880f80e01c351522209fbcfce0d5b7d7cac940565755a3'
'c893d88fec89e37da6596030c8dce7103e7e575371e8542a24d2a0741e877358d85219f2d8ade9d6aa0f515efe1156a4badd9fef5f65f553a5b0c72330c4728f'
'55ee8d3f8b14f9adddc7a1026addcea4f85b4bae4cd512fd4da2a5e8adaae4b6fd0f486d2e3847f75518f4710a897b4fca84e48ee15700b968bad762125c4742'
'716da3f4edeb3561243aeaf5c32b01ff7a4ac810b6deba8364fb12a1f71b6a5278c34a97b289bcfdc48784679b942bf780f1f36d416a575791168c94b0d59fe0'
)
pkgver() {
cd "${_pkgname}-git"
git describe --tags --match 'v*' | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}
prepare() {
mkdir ${_pkgname}
cd ${_pkgname}
cp ../main.go .
go mod init caddy
sed -i -e '$a replace github.com/caddyserver/forwardproxy => ../forwardproxy' go.mod
go get github.com/caddyserver/caddy/v2@${_gitcommit}
go mod tidy
# welcome page
cp ../caddy-dist/welcome/index.html .
sed 's|/var/www/html|/srv/http|g' -i index.html
}
build() {
cd ${_pkgname}
export CGO_LDFLAGS="${LDFLAGS}"
export CGO_CPPFLAGS="${CPPFLAGS}"
export CGO_CFLAGS="${CFLAGS}"
export CGO_CXXFLAGS="${CXXFLAGS}"
export GOFLAGS="-buildmode=pie -trimpath -ldflags=-linkmode=external -mod=readonly -modcacherw"
go build .
for i in zsh bash fish; do
./caddy completion $i >caddy.$i
done
./caddy manpage --directory manpages
gzip manpages/*
}
check() {
cd "${_pkgname}"
./caddy version
./caddy build-info
./caddy list-modules
}
package() {
cd "${_pkgname}"
install -Dm 755 caddy -t "${pkgdir}/usr/bin"
install -Dm 644 "${srcdir}/caddy-dist/init/caddy.service" "${srcdir}/caddy-dist/init/caddy-api.service" -t "${pkgdir}/usr/lib/systemd/system"
install -Dm 644 "${srcdir}/caddy.tmpfiles" "${pkgdir}/usr/lib/tmpfiles.d/caddy.conf"
install -Dm 644 "${srcdir}/caddy.sysusers" "${pkgdir}/usr/lib/sysusers.d/caddy.conf"
install -Dm 644 "${srcdir}/Caddyfile" -t "${pkgdir}/etc/caddy"
install -d "${pkgdir}/etc/caddy/conf.d"
install -Dm 644 index.html "${pkgdir}/usr/share/caddy/index.html"
install -Dm 644 caddy.zsh "${pkgdir}/usr/share/zsh/site-functions/_caddy"
install -Dm 644 caddy.bash "${pkgdir}/usr/share/bash-completion/completions/caddy"
install -Dm 644 caddy.fish -t "${pkgdir}/usr/share/fish/vendor_completions.d"
install -Dm 644 manpages/* -t "${pkgdir}/usr/share/man/man8"
}
# vim: ts=2 sw=2 et: