aboutsummaryrefslogtreecommitdiffstats
path: root/main/dnsmasq/APKBUILD
blob: 4360ac70c65068a71747957e20a6de4f926814f0 (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
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
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
pkgname=dnsmasq
pkgver=2.90
pkgrel=0
pkgdesc="A lightweight DNS, DHCP, RA, TFTP and PXE server"
url="https://www.thekelleys.org.uk/dnsmasq/"
arch="all"
license="GPL-2.0-or-later"
depends="$pkgname-common=$pkgver-r$pkgrel"
makedepends="
	coreutils
	dbus-dev
	linux-headers
	nettle-dev
	"
install="
	$pkgname.pre-install
	$pkgname.pre-upgrade
	$pkgname-dnssec.pre-install
	$pkgname-dnssec.pre-upgrade
	$pkgname-dnssec-dbus.pre-install
	$pkgname-dnssec-dbus.pre-upgrade
	"
subpackages="
	$pkgname-doc
	$pkgname-dnssec
	$pkgname-dnssec-dbus
	$pkgname-openrc
	$pkgname-common::noarch
	"
source="https://www.thekelleys.org.uk/dnsmasq/dnsmasq-$pkgver.tar.xz
	0000-underflow.patch

	config.h.patch
	dnsmasq.conf.patch
	$pkgname.initd
	$pkgname.confd
	"

# secfixes:
#   2.90-r0:
#     - CVE-2023-50387
#     - CVE-2023-50868
#   2.89-r3:
#     - CVE-2023-28450
#   2.86-r1:
#     - CVE-2022-0934
#   2.85-r0:
#     - CVE-2021-3448
#   2.83-r0:
#     - CVE-2020-25681
#     - CVE-2020-25682
#     - CVE-2020-25683
#     - CVE-2020-25684
#     - CVE-2020-25685
#     - CVE-2020-25686
#     - CVE-2020-25687
#   2.80-r5:
#     - CVE-2019-14834
#   2.79-r0:
#     - CVE-2017-15107
#   2.78-r0:
#     - CVE-2017-13704
#     - CVE-2017-14491
#     - CVE-2017-14492
#     - CVE-2017-14493
#     - CVE-2017-14494
#     - CVE-2017-14495
#     - CVE-2017-14496

build() {
	export CFLAGS="$CFLAGS -flto=auto"
	make LDFLAGS="$LDFLAGS" CFLAGS="$CFLAGS" COPTS="-DHAVE_DNSSEC" all
	mv src/dnsmasq src/dnsmasq~dnssec

	make LDFLAGS="$LDFLAGS" CFLAGS="$CFLAGS" COPTS="-DHAVE_DNSSEC -DHAVE_DBUS" all
	mv src/dnsmasq src/dnsmasq~dbus

	make LDFLAGS="$LDFLAGS" CFLAGS="$CFLAGS" clean all
}

# dnsmasq doesn't provide any test suite (shame on them!), so just check that
# the binary isn't totally broken...
check() {
	./src/dnsmasq --help >/dev/null
}

package() {
	provider_priority=100  # highest (other providers are dnsmasq-dnssec, dnsmasq-dnssec-dbus)

	make PREFIX=/usr DESTDIR="$pkgdir" install

	install -D -m755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
	install -D -m644 "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname
}

dnssec() {
	pkgdesc="$pkgdesc with DNSSEC support"
	provides="$pkgname=$pkgver-r$pkgrel"
	provider_priority=20  # middle (other providers are dnsmasq, dnsmasq-dnssec-dbus)

	install -D -m 755 "$builddir"/src/dnsmasq~dnssec "$subpkgdir"/usr/sbin/dnsmasq
}

dbus() {
	pkgdesc="$pkgdesc with DNSSEC and D-Bus support"
	provides="
		$pkgname=$pkgver-r$pkgrel
		$pkgname-dbus=$pkgver-r$pkgrel
		$pkgname-dnssec=$pkgver-r$pkgrel
		"
	provider_priority=10  # lowest (other providers are dnsmasq, dnsmasq-dnssec)

	cd "$builddir"
	install -D -m755 src/dnsmasq~dbus "$subpkgdir"/usr/sbin/dnsmasq
	install -D -m644 dbus/dnsmasq.conf -t "$subpkgdir"/usr/share/dbus-1/system.d/
}

common() {
	pkgdesc="$pkgdesc (common files)"
	depends=""
	replaces="$pkgname<2.86-r1 $pkgname-dnssec<2.86-r3"

	install -D -m644 "$builddir"/dnsmasq.conf.example "$subpkgdir"/etc/dnsmasq.conf
	install -d -m755 "$subpkgdir"/etc/dnsmasq.d

	install -D -m644 "$builddir"/trust-anchors.conf \
		"$subpkgdir"/usr/share/$pkgname/trust-anchors.conf
}

openrc() {
	default_openrc
	install_if="openrc $pkgname-common=$pkgver-r$pkgrel"
}

sha512sums="
e169de1892f935e219b0f49d90107f95cba42b40bca20bd3c973313c2cd4df58b929af6628cd988419051d81c3b4ccf8e9f816274df7d0840e79f5bf49602442  dnsmasq-2.90.tar.xz
5083bbe7150276d2226ba4b5bab73c513fe7baf4843b85d83d1ab16cb50e2dcc1dbd9ed04a89e2f9ea61796b12ea36206cc49a2574ce75abb37cb46279bd9aeb  0000-underflow.patch
d0274417019af84911f3f4a850e785797bdc77732fd93504fe21db7317a874d2ab54bf7a211d000a751cdc43e225a30be4c1a315ab2383fc3fcc619e436aed97  config.h.patch
41679e0e889607896dcf7fdeb179b9b7a79095c9f86aebda131ac09c12e3ef2a94cece0018ab33ea08d3e6f6bbae44379e9d6fb8987fae29e68ecad952ccdd45  dnsmasq.conf.patch
0c609a55ca0140d8f31f8f6eb4cb96eca7bc76385d48739998bea926b409f3d72cbfdffc30ad3f9e3a62db4ea3280f7fe6a60a12fc091164814a7cdf6a14b307  dnsmasq.initd
c6ecec498f07916cd3c5ff183ff2a2ec478cf95ee43c0082d164b548d72b13fc9ba7cfbca9fb50e919e146708b5ce7f3b3a6565b36223c4efe1481172214ad93  dnsmasq.confd
"