Gentoo Archives: gentoo-commits

From: Matt Thode <prometheanfire@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-dns/dnsmasq/
Date: Wed, 01 Mar 2017 17:00:26
Message-Id: 1488387588.c0bc85784b5c37614ccaa1a774c25ce31d6f7d42.prometheanfire@gentoo
1 commit: c0bc85784b5c37614ccaa1a774c25ce31d6f7d42
2 Author: Matthew Thode <prometheanfire <AT> gentoo <DOT> org>
3 AuthorDate: Wed Mar 1 16:59:48 2017 +0000
4 Commit: Matt Thode <prometheanfire <AT> gentoo <DOT> org>
5 CommitDate: Wed Mar 1 16:59:48 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c0bc8578
7
8 net-dns/dnsmasq: add support dhcp_release6, needed for openstack ocata
9
10 Package-Manager: Portage-2.3.3, Repoman-2.3.1
11
12 net-dns/dnsmasq/dnsmasq-2.76-r1.ebuild | 192 +++++++++++++++++++++++++++++++++
13 1 file changed, 192 insertions(+)
14
15 diff --git a/net-dns/dnsmasq/dnsmasq-2.76-r1.ebuild b/net-dns/dnsmasq/dnsmasq-2.76-r1.ebuild
16 new file mode 100644
17 index 00000000000..be4541c90f7
18 --- /dev/null
19 +++ b/net-dns/dnsmasq/dnsmasq-2.76-r1.ebuild
20 @@ -0,0 +1,192 @@
21 +# Copyright 1999-2017 Gentoo Foundation
22 +# Distributed under the terms of the GNU General Public License v2
23 +
24 +EAPI=6
25 +
26 +inherit eutils toolchain-funcs flag-o-matic user systemd
27 +
28 +DESCRIPTION="Small forwarding DNS server"
29 +HOMEPAGE="http://www.thekelleys.org.uk/dnsmasq/doc.html"
30 +SRC_URI="http://www.thekelleys.org.uk/dnsmasq/${P}.tar.xz"
31 +
32 +LICENSE="|| ( GPL-2 GPL-3 )"
33 +SLOT="0"
34 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~sparc-fbsd ~x86-fbsd"
35 +IUSE="auth-dns conntrack dbus +dhcp dhcp-tools dnssec idn +inotify ipv6 lua nls script selinux static tftp"
36 +DM_LINGUAS="de es fi fr id it no pl pt_BR ro"
37 +for dm_lingua in ${DM_LINGUAS}; do
38 + IUSE+=" linguas_${dm_lingua}"
39 +done
40 +
41 +CDEPEND="dbus? ( sys-apps/dbus )
42 + idn? ( net-dns/libidn )
43 + lua? ( dev-lang/lua:* )
44 + conntrack? ( net-libs/libnetfilter_conntrack )
45 + nls? (
46 + sys-devel/gettext
47 + net-dns/libidn
48 + )
49 +"
50 +
51 +DEPEND="${CDEPEND}
52 + app-arch/xz-utils
53 + dnssec? (
54 + dev-libs/nettle[gmp]
55 + static? (
56 + dev-libs/nettle[static-libs(+)]
57 + )
58 + )
59 + virtual/pkgconfig"
60 +
61 +RDEPEND="${CDEPEND}
62 + dnssec? (
63 + !static? (
64 + dev-libs/nettle[gmp]
65 + )
66 + )
67 + selinux? ( sec-policy/selinux-dnsmasq )
68 +"
69 +
70 +REQUIRED_USE="dhcp-tools? ( dhcp )
71 + lua? ( script )"
72 +
73 +use_have() {
74 + local useflag no_only uword
75 + if [[ $1 == '-n' ]]; then
76 + no_only=1
77 + shift
78 + fi
79 + useflag="${1}"
80 + shift
81 +
82 + uword="${1:-${useflag}}"
83 + shift
84 +
85 + while [[ ${uword} ]]; do
86 + uword="${uword^^}"
87 +
88 + if ! use "${useflag}"; then
89 + echo -n " -DNO_${uword}"
90 + elif [[ -z "${no_only}" ]]; then
91 + echo -n " -DHAVE_${uword}"
92 + fi
93 + uword="${1}"
94 + shift
95 + done
96 +}
97 +
98 +pkg_pretend() {
99 + if use static; then
100 + einfo "Only sys-libs/gmp and dev-libs/nettle are statically linked."
101 + use dnssec || einfo "Thus, ${P}[!dnssec,static] makes no sense; the static USE flag is ignored."
102 + fi
103 +}
104 +
105 +pkg_setup() {
106 + enewgroup dnsmasq
107 + enewuser dnsmasq -1 -1 /dev/null dnsmasq
108 +}
109 +
110 +src_prepare() {
111 + default
112 +
113 + sed -i -r 's:lua5.[0-9]+:lua:' Makefile
114 + sed -i "s:%%PREFIX%%:${EPREFIX}/usr:" dnsmasq.conf.example
115 +}
116 +
117 +src_configure() {
118 + COPTS="$(use_have -n auth-dns auth)"
119 + COPTS+="$(use_have conntrack)"
120 + COPTS+="$(use_have dbus)"
121 + COPTS+="$(use_have idn)"
122 + COPTS+="$(use_have -n inotify)"
123 + COPTS+="$(use_have -n dhcp dhcp dhcp6)"
124 + COPTS+="$(use_have -n ipv6 ipv6 dhcp6)"
125 + COPTS+="$(use_have lua luascript)"
126 + COPTS+="$(use_have -n script)"
127 + COPTS+="$(use_have -n tftp)"
128 + COPTS+="$(use_have dnssec)"
129 + COPTS+="$(use_have static dnssec_static)"
130 +}
131 +
132 +src_compile() {
133 + emake \
134 + PREFIX=/usr \
135 + MANDIR=/usr/share/man \
136 + CC="$(tc-getCC)" \
137 + PKG_CONFIG="$(tc-getPKG_CONFIG)" \
138 + CFLAGS="${CFLAGS}" \
139 + LDFLAGS="${LDFLAGS}" \
140 + COPTS="${COPTS}" \
141 + CONFFILE="/etc/${PN}.conf" \
142 + all$(use nls && echo "-i18n")
143 +
144 + use dhcp-tools && emake -C contrib/lease-tools \
145 + PREFIX=/usr \
146 + MANDIR=/usr/share/man \
147 + CC="$(tc-getCC)" \
148 + PKG_CONFIG="$(tc-getPKG_CONFIG)" \
149 + CFLAGS="${CFLAGS}" \
150 + LDFLAGS="${LDFLAGS}" \
151 + all
152 +}
153 +
154 +src_install() {
155 + local lingua puid
156 + emake \
157 + PREFIX=/usr \
158 + MANDIR=/usr/share/man \
159 + COPTS="${COPTS}" \
160 + DESTDIR="${D}" \
161 + install$(use nls && echo "-i18n")
162 +
163 + for lingua in ${DM_LINGUAS}; do
164 + use linguas_${lingua} || rm -rf "${D}"/usr/share/locale/${lingua}
165 + done
166 + [[ -d "${D}"/usr/share/locale/ ]] && rmdir --ignore-fail-on-non-empty "${D}"/usr/share/locale/
167 +
168 + dodoc CHANGELOG CHANGELOG.archive FAQ dnsmasq.conf.example
169 + dodoc -r logo
170 +
171 + docinto html/
172 + dodoc *.html
173 +
174 + newinitd "${FILESDIR}"/dnsmasq-init-r2 ${PN}
175 + newconfd "${FILESDIR}"/dnsmasq.confd-r1 ${PN}
176 +
177 + insinto /etc
178 + newins dnsmasq.conf.example dnsmasq.conf
179 +
180 + insinto /usr/share/dnsmasq
181 + doins trust-anchors.conf
182 +
183 + if use dhcp; then
184 + dodir /var/lib/misc
185 + newinitd "${FILESDIR}"/dnsmasq-init-dhcp-r1 ${PN}
186 + fi
187 + if use dbus; then
188 + insinto /etc/dbus-1/system.d
189 + doins dbus/dnsmasq.conf
190 + fi
191 +
192 + if use dhcp-tools; then
193 + dosbin contrib/lease-tools/{dhcp_release,dhcp_lease_time}
194 + doman contrib/lease-tools/{dhcp_release,dhcp_lease_time}.1
195 + if use ipv6; then
196 + dosbin contrib/lease-tools/dhcp_release6
197 + doman contrib/lease-tools/dhcp_release6.1
198 + fi
199 + fi
200 +
201 + systemd_newunit "${FILESDIR}"/${PN}.service-r1 ${PN}.service
202 +}
203 +
204 +pkg_preinst() {
205 + # temporary workaround to (hopefully) prevent leases file from being removed
206 + [[ -f /var/lib/misc/dnsmasq.leases ]] && cp /var/lib/misc/dnsmasq.leases "${T}"
207 +}
208 +
209 +pkg_postinst() {
210 + # temporary workaround to (hopefully) prevent leases file from being removed
211 + [[ -f "${T}"/dnsmasq.leases ]] && cp "${T}"/dnsmasq.leases /var/lib/misc/dnsmasq.leases
212 +}