aboutsummaryrefslogtreecommitdiffstats
path: root/community/pdns/APKBUILD
blob: fece7d75ebec9025d691ffab7b087abc3df6bc06 (plain) (blame)
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# Contributor: wenerme <wenermail@gmail.com>
# Contributor: Ɓukasz Jendrysik <scadu@yandex.com>
# Contributor: Matt Smith <mcs@darkregion.net>
# Contributor: Olivier Mauras <olivier@mauras.ch>
# Contributor: Daniel Isaksen <d@duniel.no>
# Contributor: Fabian Zoske <fabian@zoske.it>
# Maintainer:  Matt Smith <mcs@darkregion.net>
pkgname=pdns
pkgver=4.4.1
pkgrel=6
pkgdesc="PowerDNS Authoritative Server"
url="https://www.powerdns.com/"
# aarch64 blocked by broken luajit userdata
# s390x blocked by failing testsuite
arch="all !aarch64 !s390x !riscv64"
license="GPL-2.0-only WITH OpenSSL-Exception"
checkdepends="findutils"
makedepends="$depends_dev
	boost-dev curl curl-dev geoip-dev krb5-dev openssl-dev
	libsodium-dev lua-dev mariadb-connector-c-dev openldap-dev
	postgresql-dev protobuf-dev sqlite-dev unixodbc-dev
	yaml-cpp-dev zeromq-dev mariadb-dev luajit-dev libmaxminddb-dev"
install="$pkgname.pre-install $pkgname-backend-pgsql.post-upgrade"
subpackages="$pkgname-doc $pkgname-openrc $pkgname-tools
	$pkgname-backend-bind:backend_bind
	$pkgname-backend-geoip:backend_geoip
	$pkgname-backend-ldap:backend_ldap
	$pkgname-backend-ua2:backend_lua2
	$pkgname-backend-mariadb:backend_mariadb:noarch
	$pkgname-backend-mysql:backend_mysql
	$pkgname-backend-odbc:backend_odbc
	$pkgname-backend-pipe:backend_pipe
	$pkgname-backend-pgsql:backend_pgsql
	$pkgname-backend-random:backend_random
	$pkgname-backend-remote:backend_remote
	$pkgname-backend-sqlite3:backend_sqlite3"
pkgusers="pdns"
pkggroups="pdns"
source="https://downloads.powerdns.com/releases/pdns-$pkgver.tar.bz2
	$pkgname.initd
	$pkgname.conf
	pdns-boost-containers-exceptions.patch
	"

# secfixes:
#   4.3.1-r0:
#     - CVE-2020-17482
#   4.1.11-r0:
#     - CVE-2019-10203
#   4.1.10-r0:
#     - CVE-2019-10162
#     - CVE-2019-10163
#   4.1.7-r0:
#     - CVE-2019-3871
#   4.1.5-r0:
#     - CVE-2018-10851
#     - CVE-2018-14626
#   4.0.5-r0:
#     - CVE-2017-15091

build() {
	./configure --prefix=/usr \
		--sysconfdir="/etc/$pkgname" \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--localstatedir=/var \
		--libdir="/usr/lib/$pkgname" \
		--with-modules="" \
		--with-dynmodules="bind geoip ldap lua2 gmysql godbc pipe gpgsql random remote gsqlite3" \
		--enable-tools \
		--enable-unit-tests \
		--disable-static \
		--enable-remotebackend-zeromq
	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() {
	PDNS_TEST_NO_IPV6=1 make check || _cat_found_file 'test-suite.log'
}

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

	install -m755 -D "$srcdir/$pkgname.initd" \
		"$pkgdir/etc/init.d/$pkgname"
	rm "$pkgdir/etc/$pkgname/$pkgname.conf-dist"
	install -m600 -D "$srcdir/$pkgname.conf" \
		"$pkgdir/etc/$pkgname/$pkgname.conf"
	chown pdns:pdns "$pkgdir/etc/$pkgname/$pkgname.conf"

	# pdns-backend-pgsql.post-upgrade needs to be updated when this file path changes
	cp -v -p "$pkgdir/usr/share/doc/pdns/4.1.0_to_4.2.0_schema.pgsql.sql" "$pkgdir/etc/$pkgname/"
}

tools() {
	_tool_names="zone2ldap zone2sql zone2json
		dnsgram dnsreplay dnsscan dnsscope dnswasher dumresp
		pdns_notify nproxy nsec3dig saxfr stubquery ixplore
		sdig calidns dnsbulktest dnstcpbench dnspcap2protobuf"

	mkdir -p "$subpkgdir"
	cd "$subpkgdir"

	mkdir -p "$subpkgdir/usr/bin"
	for _tool in $_tool_names; do
		mv "$pkgdir/usr/bin/$_tool" "$subpkgdir/usr/bin/"
	done; unset -v _tool
}

_backend() {
	local backend=$1
	shift

	pkgdesc="$backend backend module for PowerDNS"
	depends="$pkgname $*"

	mkdir -p "$subpkgdir"
}

_mv_backend() {
	local backend=$1
	_backend "$@"

	mkdir -p "$subpkgdir/usr/lib/pdns/pdns"
	mv "$pkgdir/usr/lib/pdns/pdns/lib${backend}backend.so" \
		"$subpkgdir/usr/lib/pdns/pdns/"
}

backend_bind() { _mv_backend bind; }
backend_geoip() { _mv_backend geoip geoip; }
backend_ldap() { _mv_backend ldap; }
backend_lua2() { _mv_backend lua2 lua2; }
backend_mariadb() { _backend mariadb $pkgname-backend-mysql; }
backend_mysql() { _mv_backend gmysql mariadb-client; }
backend_odbc() { _mv_backend godbc unixodbc; }
backend_pipe() { _mv_backend pipe; }
backend_pgsql() { _mv_backend gpgsql postgresql-client; }
backend_random() { _mv_backend random; }
backend_remote() { _mv_backend remote; }
backend_sqlite3() { _mv_backend gsqlite3 sqlite; }
#backend_tinydns() { _mv_backend tinydns; }

# temporary split for 4.1.11 schema fix
backend_pgsql() {
	_mv_backend gpgsql postgresql-client

	mkdir -p "$subpkgdir/etc/$pkgname"
	mv "$pkgdir/etc/$pkgname/4.1.0_to_4.2.0_schema.pgsql.sql" "$subpkgdir/etc/$pkgname/"
}

sha512sums="a6f31972f77ded8ecfb523e8810dd90e5b7aa628746fee2a9a0daae2a7935800f111ce8617ffd71d5ce3881947d4ffc36c9cb37996a7bcc514536bb4abe1f79e  pdns-4.4.1.tar.bz2
3a55547e1b6407e7d2faa6e02982ed903c2364381af1b7eeb626ae3a8b0e32558dd79bf31c982b134414e5636d4868c1f3660ac523f25d2440ed6f7b436843bf  pdns.initd
3f809f3257680c3e496fa6a4c86c8a636db5d9d5b92aef96fe54c29b8266ee590deb792d13205cc171e27307fa73295dd3b101b09102fd66a2393a7cdbf9dd27  pdns.conf
a8581c78d0023e57dc98514c53ee63354276e8cb97b38b1d87bd32485d268ad8a8a79151f6a888b03ad65bcb1fa2b532a264e63bdc31e324e803e485e47fec78  pdns-boost-containers-exceptions.patch"