summaryrefslogtreecommitdiffstats
path: root/main/unbound/APKBUILD
blob: 161d5b5398c32e7793fa6bc0a583bcef11373ee9 (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
# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=unbound
pkgver=1.4.19
pkgrel=2
pkgdesc="Unbound is a validating, recursive, and caching DNS resolver"
pkgusers="unbound"
pkggroups="unbound"
url="http://unbound.net/"
arch="all"
license="BSD"
depends="dnssec-root"
depends_dev="openssl-dev expat-dev ldns-dev libevent-dev"
makedepends="$depends_dev python-dev swig"
install="$pkgname.pre-install"
subpackages="$pkgname-dev $pkgname-doc $pkgname-libs py-unbound:py $pkgname-migrate"
source="http://unbound.net/downloads/unbound-$pkgver.tar.gz
	conf.patch
	swig.patch
	update-unbound-root-hints
	migrate-dnscache-to-unbound
	root.hints
	unbound.initd"

_builddir="$srcdir"/unbound-$pkgver
prepare() {
	local i
	cd "$_builddir"
	for i in $source; do
		case $i in
		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
		esac
	done
}

build() {
	cd "$_builddir"
	./configure --prefix=/usr \
		--sysconfdir=/etc \
		--with-pidfile=/var/run/unbound/unbound.pid \
		--with-username=unbound \
		--with-libevent \
		--with-ldns \
		--with-pthreads \
		--with-rootkey-file=/usr/share/dnssec/root-anchors.txt \
		--disable-static \
		--disable-rpath \
		--with-ssl \
		--without-pythonmodule \
		--with-pyunbound \
		|| return 1
	# do not link to libpython
	sed -i -e '/^LIBS=/s/-lpython.*[[:space:]]/ /' Makefile

	make || return 1
}

package() {
	cd "$_builddir"
	make DESTDIR="$pkgdir" install || return 1
	rm "$pkgdir"/usr/lib/*.la || return 1
	rm "$pkgdir"/usr/lib/python*/*/*.la || return 1
	install -D contrib/update-anchor.sh \
		"$pkgdir"/usr/share/$pkgname/update-anchor.sh \
		|| return 1
        install -m755 -D "$srcdir"/unbound.initd \
                "$pkgdir"/etc/init.d/unbound || return 1
	install -d -o unbound -g unbound "$pkgdir"/var/run/unbound || return 1
	install -m644 "$srcdir"/root.hints "$pkgdir"/etc/unbound/ || return 1
	install -Dm755 "$srcdir"/update-unbound-root-hints \
		"$pkgdir"/etc/periodic/monthly/update-unbound-root-hints \
		|| return 1
}

libs() {
	pkgdesc="unbound shared libraries"
	mkdir -p "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/lib*.so.* "$subpkgdir"/usr/lib/
}

py() {
	pkgdesc="Python bindings to libunbound"
	mkdir -p "$subpkgdir"/usr/lib/
	mv "$pkgdir"/usr/lib/python* "$subpkgdir"/usr/lib/
}

migrate() {
	pkgdesc="Simple tool to migrate from dnscache to unbound"
	mkdir -p "$subpkgdir"/usr/bin/
	install -m755 "$srcdir"/migrate-dnscache-to-unbound \
		"$subpkgdir"/usr/bin/
}

md5sums="39f121e1921c7b5ad2f05a4d756a0487  unbound-1.4.19.tar.gz
32fe2914a2723142d3eae9ea556872d3  conf.patch
cca28c13f9b835dfe94ea91012d76e2b  swig.patch
c1c71cd0e7f9630536a2abf2513c675d  update-unbound-root-hints
01abc5360897967be608eaf4ec1c25dc  migrate-dnscache-to-unbound
d7a1cb305b7b5b72df4e574777f76723  root.hints
29f8a33fbe40ffb79dd1fb727e01af48  unbound.initd"