summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 9ad0388d6ceeedc6f68958210a3afc833167b585 (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
# Maintainer: Jingbei Li <i@jingbei.li>
# Contributor: Pritunl <contact@pritunl.com>

_pkgname=pritunl-dns
pkgname=${_pkgname}-git
pkgver=86.32a1408
pkgrel=1
pkgdesc="Pritunl DNS mapping service"
arch=('x86_64' 'armv6h' 'armv7h' 'aarch64')
license=("custom")
url="https://github.com/pritunl/${_pkgname}"
depends=(go)
makedepends=(git)
provides=("${_pkgname}")
conflicts=("${_pkgname}")
source=("git+$url")
sha256sums=('SKIP')

pkgver() {
	cd $_pkgname
	echo "$(git rev-list --count master).$(git rev-parse --short master)"
}

prepare() {
	export GOPATH=$srcdir/go

	mkdir -p $GOPATH/src/github.com/pritunl
	ln -rTsf $_pkgname $GOPATH/src/github.com/pritunl/$_pkgname

	cd $GOPATH/src/github.com/pritunl/$_pkgname
	# https://github.com/sirupsen/logrus/issues/1041
	# https://github.com/pritunl/pritunl-web/pull/2
	find . -type f -exec sed 's/Sirupsen/sirupsen/g' -i {} \;

	go mod init
}

build() {
	export GOPATH=$srcdir/go

	cd $GOPATH/src/github.com/pritunl/$_pkgname
	go install \
		-gcflags "all=-trimpath=$GOPATH" \
		-asmflags "all=-trimpath=$GOPATH" \
		-ldflags "-extldflags $LDFLAGS" \
		-v ./...
}

package() {
	export GOPATH=$srcdir/go

	cd "$srcdir/$_pkgname"
	install -Dm755 $GOPATH/bin/${_pkgname} $pkgdir/usr/bin/${_pkgname}
}