aboutsummaryrefslogtreecommitdiffstats
path: root/community/tailscale/APKBUILD
blob: ad19a9206373e1d4987aa15d9b37236dfc4070c1 (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
74
75
76
# Contributor: Robert Günzler <r@gnzler.io>
# Contributor: Christine Dodrill <xe@tailscale.com>
# Maintainer: Robert Günzler <r@gnzler.io>
pkgname=tailscale
pkgver=1.8.5
pkgrel=2
pkgdesc="The easiest, most secure way to use WireGuard and 2FA"
url="https://tailscale.com/"
license="BSD-3-Clause"
arch="all !s390x !mips !mips64" # upstream still doesn't have hardware to debug this
options="chmod-clean"
depends="iptables"
makedepends="go linux-headers"
subpackages="$pkgname-doc $pkgname-openrc"
source="$pkgname-$pkgver.tar.gz::https://github.com/tailscale/tailscale/archive/v$pkgver.tar.gz
	tailscale.confd
	tailscale.initd
	tailscale.logrotate
	tailscale.modules-load
	"
builddir="$srcdir/src/github.com/tailscale/$pkgname"

prepare() {
	export GOPATH="$srcdir"

	mkdir -p "$(dirname $builddir)"
	mv "$srcdir"/$pkgname-$pkgver "$builddir"/

	default_prepare
}

build() {
	msg2 "Prepare GOPATH and GOBIN..."
	export GOPATH="$srcdir"
	export GOBIN="$GOPATH/bin"

	msg2 "Building tailscale..."

	TAGS="netcgo osusergo static_build xversion"
	VERSIONFLAGS="
	-X tailscale.com/version.Short=$pkgver
	-X tailscale.com/version.Long=$pkgver-AlpineLinux
	-X tailscale.com/version.GitCommit=AlpineLinux
	"
	GOLDFLAGS="-w -s"

	go build -tags "$TAGS" -ldflags "$VERSIONFLAGS $GOLDFLAGS" ./cmd/tailscale
	go build -tags "$TAGS" -ldflags "$VERSIONFLAGS $GOLDFLAGS" ./cmd/tailscaled
}

check() {
	# shellcheck disable=SC2046
	go test $(go list ./... | grep -v 'wgengine/magicsock')
}

package() {
	install -m755 -D tailscale \
		"$pkgdir"/usr/bin/tailscale
	install -m755 -D tailscaled \
		"$pkgdir"/usr/sbin/tailscaled

	install -m644 -D -t "$pkgdir"/usr/share/doc/$pkgname README.md

	install -m755 -D "$srcdir"/tailscale.initd "$pkgdir"/etc/init.d/tailscale
	install -m644 -D "$srcdir"/tailscale.confd "$pkgdir"/etc/conf.d/tailscale
	install -m644 -D "$srcdir"/tailscale.logrotate "$pkgdir"/etc/logrotate.d/tailscale
	install -m644 -D "$srcdir"/tailscale.modules-load "$pkgdir"/usr/lib/modules-load.d/tailscale.conf
}

sha512sums="
1eb845bac6fce07bf76fa0c8a5a5d07b1ade2292a946c53beebef40282c17f4d1e49d8fe7692cff775900418d33c8d6868b8dd61b409277a65e694ba803a46da  tailscale-1.8.5.tar.gz
24706f10a6f5f7091c0f73a13e0c2d72e969e92e6f7aa21abe504f8e2c16af4d1d80fd28c33acbe4866dd8174abd9dc201d97eb5271f6355f7589a56f470f52c  tailscale.confd
5cb35e0144d3bc2c20b1fde1ee402aab642b666c259bb324bf1c742a79fd8b3892cf2e7419e684764a50b6a29dc562ee674915bbf16a76eda543fd9c8988428c  tailscale.initd
c139461ff829359bfdc66866ef4cd6561f781e2bc3b40e5cfe9c9d06e3e749d179835ee8548d2b2e725f9a59644db64b1136393dff78ae29955c905e76c8ef46  tailscale.logrotate
871b650ff982be061532b4c5fe4812f41e6e2c58fc69b24f8a745f9a43389da44e742a69b0467b3c3d9e2b031af0728e20f10fa4584695c4f5ac87768a1fd34e  tailscale.modules-load
"