summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: bb20bc3084e273f2c57efea08be472d44f4c703f (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
# Maintainer: meowkate <meowkatee@gmail.com>
# Contributor: leo <douglarek@gmail.com>

_name=dae
pkgname=$_name-next-git
pkgver=1.0.0.r885.g3942dff
pkgrel=1
pkgdesc="A Linux lightweight and high-performance transparent proxy solution based on eBPF."
arch=('x86_64' 'aarch64')
url="https://github.com/LostAttractor/dae"
license=('AGPL-3.0-or-later')
provides=("$_name-next")
conflicts=("$_name")
depends=(
	'glibc'
	'v2ray-geoip'
	'v2ray-domain-list-community'
)
makedepends=('clang' 'go' 'git' 'jq')
install="${_name}.install"
source=(
	"git+https://github.com/LostAttractor/dae.git"
	"git+https://github.com/LostAttractor/outbound.git#branch=next"
)
sha256sums=('SKIP'
            'SKIP')

pkgver() {
	cd "$srcdir/$_name"
	local version=$(jq -r .version package.json)
	printf "%s.r%s.g%s" "${version}" \
		"$(git rev-list --count HEAD)" \
		"$(git rev-parse --short=7 HEAD)"
}

prepare() {
	cd "$srcdir/$_name"
	git submodule update --init --recursive
}

build() {
	cd "$srcdir/$_name"
	export CFLAGS="-fno-stack-protector"
	export CGO_ENABLED=1
	export CGO_CPPFLAGS="${CPPFLAGS}"
	export CGO_CFLAGS="${CFLAGS}"
	export CGO_CXXFLAGS="${CXXFLAGS}"
	export CGO_LDFLAGS="${LDFLAGS}"
	export BUILD_ARGS="-buildmode=pie -trimpath -mod=readonly -modcacherw"
	make VERSION="${pkgver}"
}

package() {
	cd "$srcdir/$_name"
	install -Dm755 "dae" -t "${pkgdir}/usr/bin/"
	install -Dm644 "install/${_name}.service" -t "${pkgdir}/usr/lib/systemd/system/"
	install -Dm644 "example.dae" "${pkgdir}/etc/dae/config.dae.example"

	mkdir -p "${pkgdir}/usr/share/${_name}/"
	ln -vs /usr/share/v2ray/geoip.dat "${pkgdir}/usr/share/${_name}/geoip.dat"
	ln -vs /usr/share/v2ray/geosite.dat "${pkgdir}/usr/share/${_name}/geosite.dat"
}