Gentoo Archives: gentoo-commits

From: Patrick McLean <chutzpah@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-dns/dnsmasq/files/, net-dns/dnsmasq/
Date: Wed, 03 Jul 2019 21:36:59
Message-Id: 1562189759.232e5f1c871dffeddf6dce91d803a4e8354c0b9c.chutzpah@gentoo
1 commit: 232e5f1c871dffeddf6dce91d803a4e8354c0b9c
2 Author: Craig Andrews <candrews <AT> gentoo <DOT> org>
3 AuthorDate: Thu Jun 27 16:32:12 2019 +0000
4 Commit: Patrick McLean <chutzpah <AT> gentoo <DOT> org>
5 CommitDate: Wed Jul 3 21:35:59 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=232e5f1c
7
8 net-dns/dnsmasq: Compatibility with dev-libs/nettle-3.5
9
10 Closes: https://bugs.gentoo.org/688778
11 Package-Manager: Portage-2.3.67, Repoman-2.3.16
12 Signed-off-by: Craig Andrews <candrews <AT> gentoo.org>
13 Closes: https://github.com/gentoo/gentoo/pull/12342
14 Signed-off-by: Patrick McLean <chutzpah <AT> gentoo.org>
15
16 net-dns/dnsmasq/dnsmasq-2.80-r1.ebuild | 213 +++++++++++++++++++++
17 .../dnsmasq/files/dnsmasq-2.80-nettle-3.5.patch | 42 ++++
18 2 files changed, 255 insertions(+)
19
20 diff --git a/net-dns/dnsmasq/dnsmasq-2.80-r1.ebuild b/net-dns/dnsmasq/dnsmasq-2.80-r1.ebuild
21 new file mode 100644
22 index 00000000000..20c55be8ff0
23 --- /dev/null
24 +++ b/net-dns/dnsmasq/dnsmasq-2.80-r1.ebuild
25 @@ -0,0 +1,213 @@
26 +# Copyright 1999-2019 Gentoo Authors
27 +# Copyright 2017-2018 Sony Interactive Entertainment Inc.
28 +# Distributed under the terms of the GNU General Public License v2
29 +
30 +EAPI=7
31 +
32 +inherit toolchain-funcs flag-o-matic user systemd
33 +
34 +DESCRIPTION="Small forwarding DNS server"
35 +HOMEPAGE="http://www.thekelleys.org.uk/dnsmasq/doc.html"
36 +SRC_URI="http://www.thekelleys.org.uk/dnsmasq/${P}.tar.xz"
37 +
38 +LICENSE="|| ( GPL-2 GPL-3 )"
39 +SLOT="0"
40 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd"
41 +
42 +IUSE="auth-dns conntrack dbus +dhcp dhcp-tools dnssec +dumpfile id idn libidn2"
43 +IUSE+=" +inotify ipv6 lua nls script selinux static tftp"
44 +
45 +PATCHES=(
46 + "${FILESDIR}/${P}-nettle-3.5.patch"
47 +)
48 +
49 +DM_LINGUAS=(de es fi fr id it no pl pt_BR ro)
50 +
51 +BDEPEND="app-arch/xz-utils
52 + virtual/pkgconfig
53 + nls? ( sys-devel/gettext )
54 +"
55 +
56 +COMMON_DEPEND="dbus? ( sys-apps/dbus:= )
57 + idn? (
58 + !libidn2? ( net-dns/libidn:0= )
59 + libidn2? ( >=net-dns/libidn2-2.0:= )
60 + )
61 + lua? ( dev-lang/lua:* )
62 + conntrack? ( net-libs/libnetfilter_conntrack:= )
63 + nls? ( sys-devel/gettext )
64 +"
65 +
66 +DEPEND="${COMMON_DEPEND}
67 + dnssec? (
68 + dev-libs/nettle:=[gmp]
69 + static? ( >=dev-libs/nettle-3.4[static-libs(+)] )
70 + )
71 +"
72 +
73 +RDEPEND="${COMMON_DEPEND}
74 + dnssec? (
75 + !static? (
76 + >=dev-libs/nettle-3.4:=[gmp]
77 + )
78 + )
79 + selinux? ( sec-policy/selinux-dnsmasq )
80 +"
81 +
82 +REQUIRED_USE="dhcp-tools? ( dhcp )
83 + lua? ( script )
84 + libidn2? ( idn )"
85 +
86 +use_have() {
87 + local useflag no_only uword
88 + if [[ ${1} == '-n' ]]; then
89 + no_only=1
90 + shift
91 + fi
92 + useflag="${1}"
93 + shift
94 +
95 + uword="${1:-${useflag}}"
96 + shift
97 +
98 + while [[ ${uword} ]]; do
99 + uword="${uword^^}"
100 +
101 + if ! use "${useflag}"; then
102 + printf -- " -DNO_%s" "${uword}"
103 + elif [[ -z "${no_only}" ]]; then
104 + printf -- " -DHAVE_%s" "${uword}"
105 + fi
106 + uword="${1}"
107 + shift
108 + done
109 +}
110 +
111 +pkg_pretend() {
112 + if use static; then
113 + einfo "Only sys-libs/gmp and dev-libs/nettle are statically linked."
114 + use dnssec || einfo "Thus, ${P}[!dnssec,static] makes no sense;" \
115 + "the static USE flag is ignored."
116 + fi
117 +}
118 +
119 +pkg_setup() {
120 + enewgroup dnsmasq
121 + enewuser dnsmasq -1 -1 /dev/null dnsmasq
122 +}
123 +
124 +src_prepare() {
125 + default
126 +
127 + sed -i -r 's:lua5.[0-9]+:lua:' Makefile
128 + sed -i "s:%%PREFIX%%:${EPREFIX}/usr:" dnsmasq.conf.example
129 +}
130 +
131 +src_configure() {
132 + COPTS=(
133 + "$(use_have -n auth-dns auth)"
134 + "$(use_have conntrack)"
135 + "$(use_have dbus)"
136 + "$(use libidn2 || use_have idn)"
137 + "$(use_have libidn2)"
138 + "$(use_have -n inotify)"
139 + "$(use_have -n dhcp dhcp dhcp6)"
140 + "$(use_have -n ipv6 ipv6 dhcp6)"
141 + "$(use_have -n id id)"
142 + "$(use_have lua luascript)"
143 + "$(use_have -n script)"
144 + "$(use_have -n tftp)"
145 + "$(use_have dnssec)"
146 + "$(use_have static dnssec_static)"
147 + "$(use_have -n dumpfile)"
148 + )
149 +}
150 +
151 +src_compile() {
152 + emake \
153 + PREFIX=/usr \
154 + MANDIR=/usr/share/man \
155 + CC="$(tc-getCC)" \
156 + PKG_CONFIG="$(tc-getPKG_CONFIG)" \
157 + CFLAGS="${CFLAGS}" \
158 + LDFLAGS="${LDFLAGS}" \
159 + COPTS="${COPTS[*]}" \
160 + CONFFILE="/etc/${PN}.conf" \
161 + all$(use nls && printf -- "-i18n\n")
162 +
163 + use dhcp-tools && emake -C contrib/lease-tools \
164 + PREFIX=/usr \
165 + MANDIR=/usr/share/man \
166 + CC="$(tc-getCC)" \
167 + PKG_CONFIG="$(tc-getPKG_CONFIG)" \
168 + CFLAGS="${CFLAGS}" \
169 + LDFLAGS="${LDFLAGS}" \
170 + all
171 +}
172 +
173 +src_install() {
174 + local lingua puid
175 + emake \
176 + PREFIX=/usr \
177 + MANDIR=/usr/share/man \
178 + COPTS="${COPTS[*]}" \
179 + DESTDIR="${ED}" \
180 + install$(use nls && printf -- "-i18n\n")
181 +
182 + for lingua in "${DM_LINGUAS[@]}"; do
183 + has ${lingua} ${LINGUAS-${lingua}} \
184 + || rm -rf "${ED}"/usr/share/locale/${lingua}
185 + done
186 + [[ -d "${D}"/usr/share/locale/ ]] && \
187 + rmdir --ignore-fail-on-non-empty "${ED}"/usr/share/locale/
188 +
189 + dodoc CHANGELOG CHANGELOG.archive FAQ dnsmasq.conf.example
190 + dodoc -r logo
191 +
192 + docinto html/
193 + dodoc *.html
194 +
195 + newinitd "${FILESDIR}"/dnsmasq-init-r4 ${PN}
196 + newconfd "${FILESDIR}"/dnsmasq.confd-r1 ${PN}
197 +
198 + insinto /etc/logrotate.d
199 + newins "${FILESDIR}"/dnsmasq.logrotate ${PN}
200 +
201 + insinto /etc
202 + newins dnsmasq.conf.example dnsmasq.conf
203 +
204 + insinto /usr/share/dnsmasq
205 + doins trust-anchors.conf
206 +
207 + if use dhcp; then
208 + keepdir /var/lib/misc
209 + newinitd "${FILESDIR}"/dnsmasq-init-dhcp-r3 ${PN}
210 + fi
211 + if use dbus; then
212 + insinto /etc/dbus-1/system.d
213 + doins dbus/dnsmasq.conf
214 + fi
215 +
216 + if use dhcp-tools; then
217 + dosbin contrib/lease-tools/{dhcp_release,dhcp_lease_time}
218 + doman contrib/lease-tools/{dhcp_release,dhcp_lease_time}.1
219 + if use ipv6; then
220 + dosbin contrib/lease-tools/dhcp_release6
221 + doman contrib/lease-tools/dhcp_release6.1
222 + fi
223 + fi
224 +
225 + systemd_newunit "${FILESDIR}"/${PN}.service-r1 ${PN}.service
226 +}
227 +
228 +pkg_preinst() {
229 + # temporary workaround to (hopefully) prevent leases file from being removed
230 + [[ -f /var/lib/misc/dnsmasq.leases ]] && \
231 + cp /var/lib/misc/dnsmasq.leases "${T}"
232 +}
233 +
234 +pkg_postinst() {
235 + # temporary workaround to (hopefully) prevent leases file from being removed
236 + [[ -f "${T}"/dnsmasq.leases ]] && \
237 + cp "${T}"/dnsmasq.leases /var/lib/misc/dnsmasq.leases
238 +}
239
240 diff --git a/net-dns/dnsmasq/files/dnsmasq-2.80-nettle-3.5.patch b/net-dns/dnsmasq/files/dnsmasq-2.80-nettle-3.5.patch
241 new file mode 100644
242 index 00000000000..7d77a21de7c
243 --- /dev/null
244 +++ b/net-dns/dnsmasq/files/dnsmasq-2.80-nettle-3.5.patch
245 @@ -0,0 +1,42 @@
246 +From 6fd9aba7abe1e084123bc5002959350897774ace Mon Sep 17 00:00:00 2001
247 +From: Vladislav Grishenko <themiron@××××.ru>
248 +Date: Wed, 26 Jun 2019 20:27:11 +0500
249 +Subject: [PATCH] Fix build with libnettle 3.5
250 +
251 +---
252 + src/crypto.c | 8 ++++++--
253 + 1 file changed, 6 insertions(+), 2 deletions(-)
254 +
255 +diff --git a/src/crypto.c b/src/crypto.c
256 +index 1f1c12b..9cfe371 100644
257 +--- a/src/crypto.c
258 ++++ b/src/crypto.c
259 +@@ -296,6 +296,10 @@ static int dnsmasq_ecdsa_verify(struct blockdata *key_data, unsigned int key_len
260 + static struct ecc_point *key_256 = NULL, *key_384 = NULL;
261 + static mpz_t x, y;
262 + static struct dsa_signature *sig_struct;
263 ++#if NETTLE_VERSION_MAJOR == 3 && NETTLE_VERSION_MINOR < 4
264 ++#define nettle_get_secp_256r1() (&nettle_secp_256r1)
265 ++#define nettle_get_secp_384r1() (&nettle_secp_384r1)
266 ++#endif
267 +
268 + if (!sig_struct)
269 + {
270 +@@ -315,7 +319,7 @@ static int dnsmasq_ecdsa_verify(struct blockdata *key_data, unsigned int key_len
271 + if (!(key_256 = whine_malloc(sizeof(struct ecc_point))))
272 + return 0;
273 +
274 +- nettle_ecc_point_init(key_256, &nettle_secp_256r1);
275 ++ nettle_ecc_point_init(key_256, nettle_get_secp_256r1());
276 + }
277 +
278 + key = key_256;
279 +@@ -328,7 +332,7 @@ static int dnsmasq_ecdsa_verify(struct blockdata *key_data, unsigned int key_len
280 + if (!(key_384 = whine_malloc(sizeof(struct ecc_point))))
281 + return 0;
282 +
283 +- nettle_ecc_point_init(key_384, &nettle_secp_384r1);
284 ++ nettle_ecc_point_init(key_384, nettle_get_secp_384r1());
285 + }
286 +
287 + key = key_384;