aboutsummaryrefslogtreecommitdiffstats
path: root/main/unbound/APKBUILD
blob: 6f5726b11a1e763623b559d98852c8dbd1f992ae (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
# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Contributor: Carlo Landmeter <clandmeter@alpinelinux.org>
# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=unbound
pkgver=1.13.1
pkgrel=1
pkgdesc="Unbound is a validating, recursive, and caching DNS resolver"
url="http://unbound.net/"
arch="all"
license="BSD-3-Clause"
depends="dns-root-hints dnssec-root"
depends_dev="expat-dev"
_depends_migrate="/bin/sh apk-tools dns-root-hints openrc"
makedepends="$depends_dev libevent-dev openssl-dev python3-dev swig linux-headers"
checkdepends="bind-tools ldns-tools"
install="$pkgname.pre-install"
pkgusers="unbound"
pkggroups="unbound"
subpackages="$pkgname-dev $pkgname-doc $pkgname-libs $pkgname-dbg
	$pkgname-openrc py-unbound:py $pkgname-migrate::noarch"
source="https://unbound.net/downloads/unbound-$pkgver.tar.gz
	conf.patch
	migrate-dnscache-to-unbound
	$pkgname.initd
	$pkgname.confd
	"

# secfixes:
#   1.10.1-r0:
#     - CVE-2020-12662
#     - CVE-2020-12663
#   1.9.5-r0:
#     - CVE-2019-18934
#   1.9.4-r0:
#     - CVE-2019-16866

build() {
	PYTHON_VERSION=3 ./configure \
		--build="$CBUILD" \
		--host="$CHOST" \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		--with-username=unbound \
		--with-run-dir="" \
		--with-pidfile="" \
		--with-rootkey-file=/usr/share/dnssec-root/trusted-key.key \
		--with-libevent \
		--with-pthreads \
		--disable-static \
		--disable-rpath \
		--with-ssl \
		--without-pythonmodule \
		--with-pyunbound

	# do not link to libpython
	sed -i -e '/^LIBS=/s/-lpython.*[[:space:]]/ /' Makefile

	make
}

check() {
	make test
}

package() {
	make DESTDIR="$pkgdir" install
	make DESTDIR="$pkgdir" unbound-event-install

	install -Dm755 contrib/update-anchor.sh \
		"$pkgdir"/usr/share/$pkgname/update-anchor.sh

	mkdir -p "$pkgdir"/usr/share/doc/$pkgname/
	install -m644 doc/CREDITS doc/Changelog doc/FEATURES \
		doc/README doc/TODO "$pkgdir"/usr/share/doc/$pkgname/

	cd "$pkgdir"

	mkdir -p ./etc/unbound
	rm -f ./etc/unbound/root.hints
	ln -s ../../usr/share/dns-root-hints/named.root ./etc/unbound/root.hints

	install -Dm755 "$srcdir"/unbound.initd ./etc/init.d/unbound
	install -Dm644 "$srcdir"/unbound.confd ./etc/conf.d/unbound
}

libs() {
	pkgdesc="unbound shared libraries"
	depends="$depends_libs"

	mkdir -p "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/lib*.so.* "$subpkgdir"/usr/lib/
}

openrc() {
	depends="$depends_openrc"

	default_openrc
}

py() {
	pkgdesc="Python bindings to libunbound"
	depends="$depends_py"

	mkdir -p "$subpkgdir"/usr/lib/
	mv "$pkgdir"/usr/lib/python* "$subpkgdir"/usr/lib/
}

migrate() {
	pkgdesc="Simple tool to migrate from dnscache to unbound"
	depends="$_depends_migrate"

	install -m755 -D "$srcdir"/migrate-dnscache-to-unbound \
		"$subpkgdir"/usr/bin/migrate-dnscache-to-unbound
}

sha512sums="f4d26dca28dbcc33a5e65a55147fa01077c331292e88b6a87798cb6c3d4edb0515015d131fd893c92b74d22d9998a640f0adce404e6192d61ebe69a6a599287c  unbound-1.13.1.tar.gz
10e76b0c0e256cf81d55a6f089644693feb94bd2470730bcbcedb5f340397d2316f3a9ee57adc3d5e84e83cc26109c8cb48f6e2e3bfdbd186e40071b7b4284f1  conf.patch
0a5c7b8f2b8c79c5384bce05962c8f8f5f31ce3aeb967b0e897361a24ea7065eb4e7c28ff3acfb0fb0d46be966d4e526e64b231f49b589ec63f576c25433bb59  migrate-dnscache-to-unbound
c8e29190a7ab2803bb528fcc008d9788c1d46ca96abd7273023778068156aa65330a99af76a755929d24dfa936a3900bd400368ddf7b89fb3bcef29dbaa32683  unbound.initd
0ceae15d69deb24baa16990226de31fe743d84779a2595f31b4910b46ef925fc132cec1683d0a06141f707d9cbe517d731015702c60d9df4958ccfb9abd5a23f  unbound.confd"