aboutsummaryrefslogtreecommitdiffstats
path: root/community/kea/APKBUILD
blob: aa356fcc0b8d7b242464ae805a9d4462b06c52ed (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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
# Contributor: Steve Holweg <skytep@gmail.com>
# Contributor: Baptiste Jonglez <baptiste--aur@jonglez.org>
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
pkgname=kea
# NOTE: Upgrade only to even-numbered versions (e.g. 1.8.x, 1.10.x)!
#   Odd-numbered versions are development versions.
# NOTE: When bumping, always rebuild all kea hooks (kea-* aports)!
pkgver=2.0.0
pkgrel=0
pkgdesc="DHCPv4 and DHCPv6 server from ISC"
url="https://kea.isc.org/"
arch="all"
license="MPL2"
depends="kea-dhcp4 kea-dhcp6"
depends_dev="boost-dev log4cplus-dev"
checkdepends="procps"
makedepends="
	$depends_dev
	autoconf
	automake
	bison
	botan-dev
	flex
	libcap
	libtool
	mariadb-dev
	postgresql-dev
	python3-dev
	"
pkgusers="kea"
pkggroups="kea"
install="$pkgname-common.pre-install $pkgname-common.post-upgrade"
subpackages="
	$pkgname-doc
	$pkgname-static
	$pkgname-dev
	$pkgname-admin::noarch
	$pkgname-ctrl-agent:ctrlagent
	$pkgname-dhcp-ddns:dhcpddns
	$pkgname-dhcp4
	$pkgname-dhcp6
	$pkgname-http
	$pkgname-shell::noarch
	$pkgname-hook-mysql-cb:hook_mysql_cb
	$pkgname-hook-ha:hook_ha
	$pkgname-hook-stat-cmds:hook_stat_cmds
	$pkgname-hook-lease-cmds:hook_lease_cmds
	$pkgname-hook-flex-option:hook_flex_option
	$pkgname-hook-bootp:hook_bootp
	$pkgname-hook-run-script:hook_run_script
	$pkgname-common
	"
source="https://ftp.isc.org/isc/$pkgname/$pkgver/$pkgname-$pkgver.tar.gz
	disable-db-tests.patch
	tests-fix-missing-libco.patch
	configs-fix-paths.patch
	use-runstatedir-for-pid-file-location.patch
	put-LOCKFILE_DIR-to-runstatedir.patch
	move-api-files-to-doc.patch
	kea-admin-remove-builddir.patch
	kea.initd.in
	"
validpgpkeys="BE0E9748B718253A28BB89FFF1B11BF05CF02E57" # Internet Systems Consortium, Inc. (Signing key, 2017-2018) <codesign@isc.org>

# secfixes:
#   1.7.2-r0:
#     - CVE-2019-6472
#     - CVE-2019-6473
#     - CVE-2019-6474

# NOTE: libkea-dhcpsrv.so depends on libkea-{mysql,pgsql}, that's why
#   kea-common depends on libpq and libmariadb. :(

prepare() {
	default_prepare

	autoreconf -fv

	# Remove the builddir path from the scripts.
	# NOTE: There's a new script each release, so using patch file would be
	# very inconvenient.
	find src/share/database/scripts/ \
		-name '*.sh.in' \
		-exec sed -i 's|^\s*. @abs_top_builddir@/src/bin/admin/admin-utils.sh.*|echo "admin-utils.sh not found!"; exit 1|' {} \;
}

build() {
	# Complete build for dev and doc

	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--localstatedir=/var \
		--libexecdir=/usr/lib \
		--runstatedir=/run \
		--with-mysql \
		--with-pgsql \
		--disable-rpath \
		--enable-generate-messages \
		--enable-generate-parser \
		--enable-shell
	make
}

check() {
	make check
}

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

	cd "$pkgdir"

	# Allow kea to run under unpriviliged user.
	local name; for name in kea-dhcp-ddns kea-dhcp6; do
		setcap 'cap_net_bind_service=+ep' ./usr/sbin/$name
	done
	setcap 'cap_net_bind_service,cap_net_raw=+ep' ./usr/sbin/kea-dhcp4

	install -d -m 0750 -o kea -g kea ./var/log/kea ./var/lib/kea

	# keactrl is unnecessary since we provide OpenRC init scripts.
	rm ./usr/sbin/keactrl ./etc/kea/keactrl.conf

	rm -Rf ./run
}

dev() {
	default_dev

	amove ./usr/bin/kea-msg-compiler
}

admin() {
	pkgdesc="Databases administration tools for Kea DHCP server"
	depends="$pkgname-common=$pkgver-r$pkgrel"

	amove ./usr/sbin/kea-admin
	amove ./usr/share/kea
}

ctrlagent() {
	pkgdesc="Kea Control Agent - REST service for controlling Kea DHCP server"
	depends="$pkgname-common=$pkgver-r$pkgrel"

	amove usr/sbin/kea-ctrl-agent
	amove ./etc/kea/kea-ctrl-agent.conf

	_install_initd kea-ctrl-agent
}

dhcpddns() {
	pkgdesc="Kea DHCP Dynamic DNS Server"
	depends="$pkgname-common=$pkgver-r$pkgrel"

	amove ./usr/sbin/kea-dhcp-ddns
	amove ./etc/kea/kea-dhcp-ddns.conf
	amove ./usr/lib/libkea-asiodns.so.*
	amove ./usr/lib/libkea-d2srv.so.*

	_install_initd kea-dhcp-ddns
}

dhcp4() {
	pkgdesc="Kea IPv4 DHCP Server"
	depends="$pkgname-common=$pkgver-r$pkgrel"

	amove ./usr/sbin/kea-dhcp4
	amove ./etc/kea/kea-dhcp4.conf

	_install_initd kea-dhcp4
}

dhcp6() {
	pkgdesc="Kea IPv6 DHCP Server"
	depends="$pkgname-common=$pkgver-r$pkgrel"

	amove ./usr/sbin/kea-dhcp6
	amove ./etc/kea/kea-dhcp6.conf

	_install_initd kea-dhcp6
}

# Needed only by ctrl-agent and hooks.
http() {
	depends=""

	amove ./usr/lib/libkea-http.so*
}

shell() {
	pkgdesc="Text client for Kea DHCP Control Agent"
	depends="python3"

	amove ./usr/sbin/kea-shell
	amove ./usr/lib/python3*
}

hook_mysql_cb() {
	pkgdesc="Kea MySQL Configuration Backend hooks library"
	depends=""

	amove ./usr/lib/kea/hooks/libdhcp_mysql_cb.so
}

hook_ha() {
	pkgdesc="Kea High Availability hooks library"
	depends="$pkgname-hook-lease-cmds"

	amove ./usr/lib/kea/hooks/libdhcp_ha.so
}

hook_stat_cmds() {
	pkgdesc="Kea Statistics Commands hooks library"
	depends=""

	amove ./usr/lib/kea/hooks/libdhcp_stat_cmds.so
}

hook_lease_cmds() {
	pkgdesc="Kea Lease Commands hooks library"
	depends=""

	amove ./usr/lib/kea/hooks/libdhcp_lease_cmds.so
}

hook_flex_option() {
	pkgdesc="Kea Flexible Option hooks library"
	depends=""

	amove ./usr/lib/kea/hooks/libdhcp_flex_option.so
}

hook_bootp() {
	pkgdesc="Kea BOOTP hooks library"
	depends=""

	amove ./usr/lib/kea/hooks/libdhcp_bootp.so
}

hook_run_script() {
	pkgdesc="Kea Run Script hooks library"
	depends=""

	amove ./usr/lib/kea/hooks/libdhcp_run_script.so
}

common() {
	pkgdesc="Common files and libraries for Kea DHCP Server"
	replaces="kea-utils"  # for backward compatibility
	provides="kea-utils=$pkgver-r$pkgrel"  # for backward compatibility
	depends=""

	mkdir -p "$subpkgdir"
	mv "$pkgdir"/* "$subpkgdir"/
}

_install_initd() {
	local name="$1"

	install -Dm755 "$srcdir"/kea.initd.in "$subpkgdir"/etc/init.d/$name
	sed -i "s|@@NAME@@|$name|g" "$subpkgdir"/etc/init.d/$name
}

sha512sums="
9b5f520b75bbe72dfb209737958e90f337c78b3a4bf4662581d4a816bf9325ed1f277f1a593449044ef483375948006490a572eb50469842c5f56e69c8b105c3  kea-2.0.0.tar.gz
b467fd19bb64a5d59d12c8d4aeec519321bec9aa91eee3975d52be5d141464ce327ad8073ba1e238c134f359b2fac420b0eb39fa9b4d334e612305ecaabba01c  disable-db-tests.patch
97c49d45b12d1a0fe727f46d4d140cf50676cb83b25f41e7e01007d0d6000f5ecd25e900737a1e36e27e84c4eaf799378d35e9d36ffbf3fdeadad4e035e8316e  tests-fix-missing-libco.patch
3439046a80de33b31bf3f12e3c9728e47119e245fb888a1e4484a443b20e7b364f0e15e10fa96b4fcfcec29e6d2828ba9ab728a83028546a9c28f30fc404512d  configs-fix-paths.patch
e22be00f74b30de0ff035de38a4b159231dbd6b248572cdb1c65dfc789f86630b4a03a22d2686607ccc5893305043526c3463bdd1fc43fdd2bf6138864ab16e0  use-runstatedir-for-pid-file-location.patch
52de95e9b4de3e518b4fbbce19799230684a2924433e666c24b866e537ffeaea9cd16b0b41499a17dd3ed528be1f899e94e67f6e464d551149b850cdbf29c1b2  put-LOCKFILE_DIR-to-runstatedir.patch
100b70f3ccecb46b98e9fd599ab6f0c3aa191d862d914ed84f4d34efea0cc119817d1e14b967c0f5024614af1ef6841a8d12e789945cad147d943965f194ece1  move-api-files-to-doc.patch
982751601d89c091d0aecf535862ad505ebf4e5f64af5f3fcfe9f791cc717aafc72915828eb467b984f8270a1e653b49968f76b39f51389ba4b69d806e1f717e  kea-admin-remove-builddir.patch
4029a526a210cb49ca480fea728dfae5933371244df6348411081db1e8b23924cbbdde5fa745ab4c14552a95451953a18a65d7660227bc0bb1d51be708fab92f  kea.initd.in
"