blob: eec61da2e216e717d0116885e28b03233c496415 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
# Maintainer:
_pkgname="zrepl"
pkgname="$_pkgname-git"
pkgver=0.6.1.r15.g9c63736
pkgrel=1
pkgdesc="One-stop ZFS backup & replication solution"
url="https://github.com/zrepl/zrepl"
license=('MIT')
arch=('x86_64')
depends=(
'glibc'
)
makedepends=(
'go'
'git'
)
provides=("$_pkgname=${pkgver%%.r*}")
conflicts=("$_pkgname")
_pkgsrc="$_pkgname"
source=("$_pkgsrc"::"git+$url.git")
sha256sums=('SKIP')
pkgver() {
cd "$_pkgsrc"
git describe --long --tags --abbrev=7 --exclude='*[a-zA-Z][a-zA-Z]*' \
| sed -E 's/^[^0-9]*//;s/([^-]*-g)/r\1/;s/-/./g'
}
prepare() {
sed -e 's&/usr/local/bin/&/usr/bin/&g' -i "$_pkgsrc/dist/systemd/$_pkgname.service"
}
build() {
export GOPATH="${srcdir}"
export CGO_CPPFLAGS="${CPPFLAGS}"
export CGO_CFLAGS="${CFLAGS}"
export CGO_CXXFLAGS="${CXXFLAGS}"
export CGO_LDFLAGS="${LDFLAGS}"
export GOFLAGS="-buildmode=pie -trimpath -ldflags=-linkmode=external -mod=readonly -modcacherw"
export GO_LDFLAGS="-X github.com/zrepl/zrepl/version.zreplVersion=$pkgver"
cd "$_pkgsrc"
go build -o "$_pkgname" .
}
package() {
install -Dm755 "$_pkgsrc/$_pkgname" -t "$pkgdir/usr/bin/"
install -Dm644 "$_pkgsrc/dist/systemd/$_pkgname.service" -t "$pkgdir/usr/lib/systemd/system/"
install -Dm644 "$_pkgsrc/LICENSE" -t "$pkgdir/usr/share/licenses/$pkgname/"
install -dm755 "$pkgdir/usr/share/$_pkgname/samples"
cp --reflink=auto -a "$_pkgsrc"/config/samples/* "$pkgdir/usr/share/$_pkgname/samples/"
install -dm755 "$pkgdir/usr/share/zsh/site-functions"
"$pkgdir/usr/bin/$_pkgname" gencompletion zsh "$pkgdir/usr/share/zsh/site-functions/_zrepl"
install -dm755 "$pkgdir/usr/share/bash-completion/completions"
"$pkgdir/usr/bin/$_pkgname" gencompletion bash "$pkgdir/usr/share/bash-completion/completions/zrepl"
chmod -R u+rwX,go+rX,go-w "$pkgdir"
}
|