summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: ad9d3f8a0f2ad27bae17b116b1cf9d82bfb140a4 (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
69
70
71
72
73
# Maintainer: Christian Hesse <mail@eworm.de>

pkgbase=wireguard-git
pkgname=(wireguard-dkms-git wireguard-tools-git)
pkgver=0.0.20190601.r2.gaab8bec
pkgrel=1
pkgdesc='next generation secure network tunnel - git checkout'
arch=('x86_64' 'i686')
url='http://www.wireguard.com/'
license=('GPL')
makedepends=('git' 'libmnl' 'bash-completion')
source=('git+https://git.zx2c4.com/WireGuard')
sha256sums=('SKIP')

pkgver() {
	cd WireGuard/

	if GITTAG="$(git describe --abbrev=0 --tags 2>/dev/null)"; then
		printf '%s.r%s.g%s' \
			"$(sed -e "s/^${pkgname%%-git}//" -e 's/^[-_/a-zA-Z]\+//' -e 's/[-_+]/./g' <<< ${GITTAG})" \
			"$(git rev-list --count ${GITTAG}..)" \
			"$(git rev-parse --short HEAD)"
	else
		printf '0.r%s.g%s' \
			"$(git rev-list --count master)" \
			"$(git rev-parse --short HEAD)"
	fi
}

prepare() {
	cd WireGuard/

	find contrib/examples/ -name '.gitignore' -delete
}

build() {
	cd WireGuard/

	make -C src/tools/
}

package_wireguard-dkms-git() {
	depends=('dkms')
	provides=('wireguard-dkms' 'WIREGUARD-MODULE')
	conflicts=('wireguard-dkms')

	cd WireGuard/

	make -C src/ \
		DESTDIR="${pkgdir}/" \
		DKMSDIR="/usr/src/wireguard-${pkgver}/" \
		dkms-install
}

package_wireguard-tools-git() {
	depends=('libmnl' 'WIREGUARD-MODULE')
	optdepends=('openresolv: for DNS functionality')
	provides=('wireguard-tools')
	conflicts=('wireguard-tools')

	cd WireGuard/

	make -C src/tools/ \
		DESTDIR="${pkgdir}/" \
		WITH_BASHCOMPLETION=yes \
		WITH_WGQUICK=yes \
		WITH_SYSTEMDUNITS=yes \
		install

	install -d -m0755 "${pkgdir}"/usr/share/${pkgbase}/
	cp -r contrib/examples/ "${pkgdir}"/usr/share/${pkgbase}/
}