aboutsummaryrefslogtreecommitdiffstats
path: root/community/dnsdist/APKBUILD
blob: 49af6a92d13f6bf440ad16e9ab796d5db66f2059 (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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# Maintainer: Peter van Dijk <peter.van.dijk@powerdns.com>
pkgname=dnsdist
pkgver=1.6.1
pkgrel=2
pkgdesc="dnsdist is a highly DNS-, DoS-, and abuse-aware loadbalancer."
url="https://dnsdist.org/"
# s390x and mips64 blocked by h2o
# riscv64 blocked by luajit
arch="all !s390x !mips64 !riscv64"
license="GPL-2.0-only WITH OpenSSL-Exception"
_lua_version=5.4
depends="$pkgname-common !$pkgname-luajit"
checkdepends="findutils"
makedepends="boost-dev fstrm-dev libedit-dev libsodium-dev lua$_lua_version-dev
	net-snmp-dev re2-dev luajit-dev h2o-dev wslay-dev"
pkgusers="dnsdist"
pkggroups="dnsdist"
install="$pkgname-common.pre-install"
subpackages="$pkgname-common::noarch $pkgname-doc $pkgname-luajit"
source="https://downloads.powerdns.com/releases/dnsdist-$pkgver.tar.bz2"

[ "$CARCH" = "ppc64le" ] && options="!check" # failing tests

prepare() {
	default_prepare
	cp -a "$builddir" "$builddir-jit"
}

_configure() {
	local _arg="$1"
	local _luajit

	[ "$_arg" = '-jit' ] || _arg='' _luajit="lua$_lua_version"

	cd "$builddir$_arg"

	# LIBH2OEVLOOP_LIBS env variable is because of a pkgconfig bug as per
	# https://bugs.launchpad.net/ubuntu/+source/h2o/+bug/1826152 and can be
	# removed when fixed upstream.
	LIBH2OEVLOOP_LIBS="-lh2o-evloop -lwslay" ./configure \
		--build="$CBUILD" \
		--host="$CHOST" \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--enable-dnscrypt \
		--enable-dns-over-tls \
		--enable-dns-over-https \
		--enable-unit-tests \
		--with-re2 \
		--with-boost=/usr/include \
		--with-net-snmp \
		--with-lua${_luajit:+=$_luajit}
}

build() {
	_configure
	make

	[ -d "$builddir-jit" ] || return 0

	_configure -jit
	make
}

_cat_found_file() {
	local _rc="$?"
	find . -name "$1" -type f -ls -printf '%P {{{\n' -exec cat -v -n '{}' ';' -printf '}}} %P\n'
	return "$_rc"
}

check() {
	make check || _cat_found_file 'test-suite.log'
	./dnsdist --version

	if cd "$builddir-jit"; then
		make check || _cat_found_file 'test-suite.log'
		./dnsdist --version
	fi
}

package() {
	make DESTDIR="$pkgdir" install

	mv "$pkgdir/usr/bin/$pkgname" "$pkgdir/usr/bin/$pkgname-lua"

	if cd "$builddir-jit"; then
		make -j1 DESTDIR="$pkgdir" install-exec
		mv "$pkgdir/usr/bin/$pkgname" "$pkgdir/usr/bin/$pkgname-luajit"
	fi

	mv "$pkgdir/usr/bin/$pkgname-lua" "$pkgdir/usr/bin/$pkgname"
}

common() {
	pkgdesc="$pkgname common files"
	depends=""

	mkdir -p "$subpkgdir"
}

luajit() {
	pkgdesc="$pkgname with luajit bindings"
	depends="$pkgname-common !$pkgname"

	mkdir -p "$subpkgdir/usr/bin"
	mv "$pkgdir/usr/bin/$pkgname-luajit" "$subpkgdir/usr/bin/$pkgname"
}

sha512sums="
68e114eeb1a7ae8a4ce52a7de31095c46d0ba8f572676a8ef1e858b97da199c04ec88656c7642160ba07b7db325cc2a49cd91794da8dd2e81a5301d089c34f90  dnsdist-1.6.1.tar.bz2
"