Gentoo Archives: gentoo-commits

From: "Anthony G. Basile" <blueness@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/musl:master commit in: sys-apps/iproute2/files/, sys-apps/iproute2/
Date: Wed, 31 Oct 2018 23:58:13
Message-Id: 1541029649.cef0e5b17c9afc97d6908aab52816f69e52594b3.blueness@gentoo
1 commit: cef0e5b17c9afc97d6908aab52816f69e52594b3
2 Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
3 AuthorDate: Wed Oct 31 23:47:29 2018 +0000
4 Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
5 CommitDate: Wed Oct 31 23:47:29 2018 +0000
6 URL: https://gitweb.gentoo.org/proj/musl.git/commit/?id=cef0e5b1
7
8 sys-apps/iproute2: sync with upstream stable version
9
10 Signed-off-by: Anthony G. Basile <blueness <AT> gentoo.org>
11 Package-Manager: Portage-2.3.49, Repoman-2.3.11
12
13 .../files/iproute2-4.17.0-configure-nomagic.patch | 207 +++++++++++++++++++++
14 sys-apps/iproute2/iproute2-4.17.0-r1.ebuild | 154 +++++++++++++++
15 2 files changed, 361 insertions(+)
16
17 diff --git a/sys-apps/iproute2/files/iproute2-4.17.0-configure-nomagic.patch b/sys-apps/iproute2/files/iproute2-4.17.0-configure-nomagic.patch
18 new file mode 100644
19 index 0000000..30b5db3
20 --- /dev/null
21 +++ b/sys-apps/iproute2/files/iproute2-4.17.0-configure-nomagic.patch
22 @@ -0,0 +1,207 @@
23 +The hand-rolled configure script, for multiple options (selinux,mnl,elf), sets
24 +a variable as well as modifying CFLAGS & LDLIBS.
25 +
26 +If config.mk is later amended to disable a feature, the CFLAGS/LDLIBS tweaks
27 +are still in place.
28 +
29 +Push the CFLAGS/LDLIBS changes into new conditional Makefile code, so that they
30 +are only passed when correctly needed.
31 +
32 +Prior Gentoo testcase for reproduction:
33 +USE=minimal ebuild ... compile.
34 +- Linking with libelf, libmnl & libcap based only on presence.
35 +- Links based on libselinux based only on presence.
36 +
37 +Closes: https://bugs.gentoo.org/643722
38 +Signed-off-by: Robin H. Johnson <robbat2@g.o>
39 +
40 +Forward-ported from v4.14.1 to v4.16.0 by Lars Wendler <polynomial-c@g.o>
41 +Added libcap to v4.17.0 by Lars Wendler <polynomial-c@g.o>
42 +
43 +--- iproute2-4.17.0/bridge/Makefile
44 ++++ iproute2-4.17.0/bridge/Makefile
45 +@@ -2,6 +2,7 @@
46 + BROBJ = bridge.o fdb.o monitor.o link.o mdb.o vlan.o
47 +
48 + include ../config.mk
49 ++include ../config.include
50 +
51 + all: bridge
52 +
53 +--- iproute2-4.17.0/config.include
54 ++++ iproute2-4.17.0/config.include
55 +@@ -0,0 +1,26 @@
56 ++# We can only modify CFLAGS/LDLIBS after all the config options are known.
57 ++ifeq ($(IP_CONFIG_SETNS),y)
58 ++ CFLAGS += $(IP_CONFIG_SETNS_CFLAGS)
59 ++endif
60 ++ifeq ($(HAVE_ELF),y)
61 ++ CFLAGS += $(HAVE_ELF_CFLAGS)
62 ++ LDLIBS += $(HAVE_ELF_LDLIBS)
63 ++endif
64 ++ifeq ($(HAVE_SELINUX),y)
65 ++ CFLAGS += $(HAVE_SELINUX_CFLAGS)
66 ++ LDLIBS += $(HAVE_SELINUX_LDLIBS)
67 ++endif
68 ++ifeq ($(HAVE_MNL),y)
69 ++ CFLAGS += $(HAVE_MNL_CFLAGS)
70 ++ LDLIBS += $(HAVE_MNL_LDLIBS)
71 ++endif
72 ++ifeq ($(HAVE_CAP),y)
73 ++ CFLAGS += $(HAVE_CAP_CFLAGS)
74 ++ LDLIBS += $(HAVE_CAP_LDLIBS)
75 ++endif
76 ++
77 ++# Rules can only be declared after all variables in them are known.
78 ++%.o: %.c
79 ++ $(QUIET_CC)$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
80 ++
81 ++# vim: ft=make:
82 +--- iproute2-4.17.0/configure
83 ++++ iproute2-4.17.0/configure
84 +@@ -212,7 +212,7 @@
85 + then
86 + echo "IP_CONFIG_SETNS:=y" >>$CONFIG
87 + echo "yes"
88 +- echo "CFLAGS += -DHAVE_SETNS" >>$CONFIG
89 ++ echo "IP_CONFIG_SETNS_CFLAGS += -DHAVE_SETNS" >>$CONFIG
90 + else
91 + echo "no"
92 + fi
93 +@@ -257,8 +257,8 @@
94 + echo "HAVE_ELF:=y" >>$CONFIG
95 + echo "yes"
96 +
97 +- echo 'CFLAGS += -DHAVE_ELF' `${PKG_CONFIG} libelf --cflags` >> $CONFIG
98 +- echo 'LDLIBS += ' `${PKG_CONFIG} libelf --libs` >>$CONFIG
99 ++ echo 'HAVE_ELF_CFLAGS += -DHAVE_ELF' `${PKG_CONFIG} libelf --cflags` >> $CONFIG
100 ++ echo 'HAVE_ELF_LDLIBS += ' `${PKG_CONFIG} libelf --libs` >>$CONFIG
101 + else
102 + echo "no"
103 + fi
104 +@@ -272,8 +272,8 @@
105 + echo "HAVE_SELINUX:=y" >>$CONFIG
106 + echo "yes"
107 +
108 +- echo 'LDLIBS +=' `${PKG_CONFIG} --libs libselinux` >>$CONFIG
109 +- echo 'CFLAGS += -DHAVE_SELINUX' `${PKG_CONFIG} --cflags libselinux` >>$CONFIG
110 ++ echo 'HAVE_SELINUX_CFLAGS += -DHAVE_SELINUX' `${PKG_CONFIG} --cflags libselinux` >>$CONFIG
111 ++ echo 'HAVE_SELINUX_LDLIBS +=' `${PKG_CONFIG} --libs libselinux` >>$CONFIG
112 + else
113 + echo "no"
114 + fi
115 +@@ -286,8 +286,8 @@
116 + echo "HAVE_MNL:=y" >>$CONFIG
117 + echo "yes"
118 +
119 +- echo 'CFLAGS += -DHAVE_LIBMNL' `${PKG_CONFIG} libmnl --cflags` >>$CONFIG
120 +- echo 'LDLIBS +=' `${PKG_CONFIG} libmnl --libs` >> $CONFIG
121 ++ echo 'HAVE_MNL_CFLAGS += -DHAVE_LIBMNL' `${PKG_CONFIG} libmnl --cflags` >>$CONFIG
122 ++ echo 'HAVE_MNL_LDLIBS +=' `${PKG_CONFIG} libmnl --libs` >> $CONFIG
123 + else
124 + echo "no"
125 + fi
126 +@@ -343,8 +343,8 @@
127 + echo "HAVE_CAP:=y" >>$CONFIG
128 + echo "yes"
129 +
130 +- echo 'CFLAGS += -DHAVE_LIBCAP' `${PKG_CONFIG} libcap --cflags` >>$CONFIG
131 +- echo 'LDLIBS +=' `${PKG_CONFIG} libcap --libs` >> $CONFIG
132 ++ echo 'HAVE_CAP_CFLAGS += -DHAVE_LIBCAP' `${PKG_CONFIG} libcap --cflags` >>$CONFIG
133 ++ echo 'HAVE_CAP_LDLIBS +=' `${PKG_CONFIG} libcap --libs` >> $CONFIG
134 + else
135 + echo "no"
136 + fi
137 +@@ -426,7 +426,3 @@
138 +
139 + echo -n "libcap support: "
140 + check_cap
141 +-
142 +-echo >> $CONFIG
143 +-echo "%.o: %.c" >> $CONFIG
144 +-echo ' $(QUIET_CC)$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<' >> $CONFIG
145 +--- iproute2-4.17.0/devlink/Makefile
146 ++++ iproute2-4.17.0/devlink/Makefile
147 +@@ -1,5 +1,6 @@
148 + # SPDX-License-Identifier: GPL-2.0
149 + include ../config.mk
150 ++include ../config.include
151 +
152 + TARGETS :=
153 +
154 +--- iproute2-4.17.0/genl/Makefile
155 ++++ iproute2-4.17.0/genl/Makefile
156 +@@ -2,6 +2,7 @@
157 + GENLOBJ=genl.o
158 +
159 + include ../config.mk
160 ++include ../config.include
161 + SHARED_LIBS ?= y
162 +
163 + CFLAGS += -fno-strict-aliasing
164 +--- iproute2-4.17.0/ip/Makefile
165 ++++ iproute2-4.17.0/ip/Makefile
166 +@@ -15,6 +15,7 @@
167 + RTMONOBJ=rtmon.o
168 +
169 + include ../config.mk
170 ++include ../config.include
171 +
172 + ALLOBJ=$(IPOBJ) $(RTMONOBJ)
173 + SCRIPTS=ifcfg rtpr routel routef
174 +--- iproute2-4.17.0/lib/Makefile
175 ++++ iproute2-4.17.0/lib/Makefile
176 +@@ -1,5 +1,6 @@
177 + # SPDX-License-Identifier: GPL-2.0
178 + include ../config.mk
179 ++include ../config.include
180 +
181 + CFLAGS += -fPIC
182 +
183 +--- iproute2-4.17.0/misc/Makefile
184 ++++ iproute2-4.17.0/misc/Makefile
185 +@@ -5,6 +5,7 @@
186 + TARGETS=ss nstat ifstat rtacct lnstat
187 +
188 + include ../config.mk
189 ++include ../config.include
190 +
191 + ifeq ($(HAVE_BERKELEY_DB),y)
192 + TARGETS += arpd
193 +--- iproute2-4.17.0/netem/Makefile
194 ++++ iproute2-4.17.0/netem/Makefile
195 +@@ -1,5 +1,6 @@
196 + # SPDX-License-Identifier: GPL-2.0
197 + include ../config.mk
198 ++include ../config.include
199 +
200 + DISTGEN = maketable normal pareto paretonormal
201 + DISTDATA = normal.dist pareto.dist paretonormal.dist experimental.dist
202 +--- iproute2-4.17.0/rdma/Makefile
203 ++++ iproute2-4.17.0/rdma/Makefile
204 +@@ -1,5 +1,6 @@
205 + # SPDX-License-Identifier: GPL-2.0
206 + include ../config.mk
207 ++include ../config.include
208 +
209 + TARGETS :=
210 +
211 +--- iproute2-4.17.0/tc/Makefile
212 ++++ iproute2-4.17.0/tc/Makefile
213 +@@ -4,6 +4,7 @@
214 + emp_ematch.yacc.o emp_ematch.lex.o
215 +
216 + include ../config.mk
217 ++include ../config.include
218 +
219 + SHARED_LIBS ?= y
220 +
221 +--- iproute2-4.17.0/tipc/Makefile
222 ++++ iproute2-4.17.0/tipc/Makefile
223 +@@ -1,5 +1,6 @@
224 + # SPDX-License-Identifier: GPL-2.0
225 + include ../config.mk
226 ++include ../config.include
227 +
228 + TARGETS :=
229 +
230
231 diff --git a/sys-apps/iproute2/iproute2-4.17.0-r1.ebuild b/sys-apps/iproute2/iproute2-4.17.0-r1.ebuild
232 new file mode 100644
233 index 0000000..397fdab
234 --- /dev/null
235 +++ b/sys-apps/iproute2/iproute2-4.17.0-r1.ebuild
236 @@ -0,0 +1,154 @@
237 +# Copyright 1999-2018 Gentoo Authors
238 +# Distributed under the terms of the GNU General Public License v2
239 +
240 +EAPI=6
241 +
242 +inherit toolchain-funcs flag-o-matic multilib
243 +
244 +if [[ ${PV} == "9999" ]] ; then
245 + EGIT_REPO_URI="git://git.kernel.org/pub/scm/linux/kernel/git/shemminger/iproute2.git"
246 + inherit git-r3
247 +else
248 + SRC_URI="mirror://kernel/linux/utils/net/${PN}/${P}.tar.xz"
249 + KEYWORDS="~amd64 ~arm ~arm64 ~mips ~ppc ~x86"
250 +fi
251 +
252 +DESCRIPTION="kernel routing and traffic control utilities"
253 +HOMEPAGE="https://wiki.linuxfoundation.org/networking/iproute2"
254 +
255 +LICENSE="GPL-2"
256 +SLOT="0"
257 +IUSE="atm berkdb caps elf +iptables ipv6 minimal selinux"
258 +
259 +# We could make libmnl optional, but it's tiny, so eh
260 +RDEPEND="
261 + !net-misc/arpd
262 + !minimal? ( net-libs/libmnl )
263 + caps? ( sys-libs/libcap )
264 + elf? ( virtual/libelf )
265 + iptables? ( >=net-firewall/iptables-1.4.20:= )
266 + berkdb? ( sys-libs/db:= )
267 + atm? ( net-dialup/linux-atm )
268 + selinux? ( sys-libs/libselinux )
269 +"
270 +# We require newer linux-headers for ipset support #549948 and some defines #553876
271 +DEPEND="
272 + ${RDEPEND}
273 + app-arch/xz-utils
274 + iptables? ( virtual/pkgconfig )
275 + >=sys-devel/bison-2.4
276 + sys-devel/flex
277 + >=sys-kernel/linux-headers-3.16
278 + elibc_glibc? ( >=sys-libs/glibc-2.7 )
279 +"
280 +
281 +PATCHES=(
282 + "${FILESDIR}"/${PN}-3.1.0-mtu.patch #291907
283 + "${FILESDIR}"/${PN}-4.17.0-configure-nomagic.patch # bug 643722
284 + "${FILESDIR}"/${P}-musl.patch
285 +)
286 +
287 +src_prepare() {
288 + if ! use ipv6 ; then
289 + PATCHES+=(
290 + "${FILESDIR}"/${PN}-4.11.0-no-ipv6.patch #326849
291 + )
292 + fi
293 +
294 + default
295 +
296 + sed -i \
297 + -e '/^CC :\?=/d' \
298 + -e "/^LIBDIR/s:=.*:=/$(get_libdir):" \
299 + -e "s:-O2:${CFLAGS} ${CPPFLAGS}:" \
300 + -e "/^HOSTCC/s:=.*:= $(tc-getBUILD_CC):" \
301 + -e "/^DBM_INCLUDE/s:=.*:=${T}:" \
302 + Makefile || die
303 +
304 + # Use /run instead of /var/run.
305 + sed -i \
306 + -e 's:/var/run:/run:g' \
307 + include/namespace.h \
308 + man/man8/ip-netns.8 || die
309 +
310 + # build against system headers
311 + rm -r include/netinet #include/linux include/ip{,6}tables{,_common}.h include/libiptc
312 + sed -i 's:TCPI_OPT_ECN_SEEN:16:' misc/ss.c || die
313 +
314 + use minimal && sed -i -e '/^SUBDIRS=/s:=.*:=lib tc ip:' Makefile
315 +}
316 +
317 +src_configure() {
318 + tc-export AR CC PKG_CONFIG
319 +
320 + # This sure is ugly. Should probably move into toolchain-funcs at some point.
321 + local setns
322 + pushd "${T}" >/dev/null
323 + printf '#include <sched.h>\nint main(){return setns(0, 0);}\n' > test.c
324 + ${CC} ${CFLAGS} ${CPPFLAGS} -D_GNU_SOURCE ${LDFLAGS} test.c >&/dev/null && setns=y || setns=n
325 + echo 'int main(){return 0;}' > test.c
326 + ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} test.c -lresolv >&/dev/null || sed -i '/^LDLIBS/s:-lresolv::' "${S}"/Makefile
327 + popd >/dev/null
328 +
329 + # run "configure" script first which will create "config.mk"...
330 + econf
331 +
332 + # ...now switch on/off requested features via USE flags
333 + # this is only useful if the test did not set other things, per bug #643722
334 + cat <<-EOF >> config.mk
335 + TC_CONFIG_ATM := $(usex atm y n)
336 + TC_CONFIG_XT := $(usex iptables y n)
337 + TC_CONFIG_NO_XT := $(usex iptables n y)
338 + # We've locked in recent enough kernel headers #549948
339 + TC_CONFIG_IPSET := y
340 + HAVE_BERKELEY_DB := $(usex berkdb y n)
341 + HAVE_CAP := $(usex caps y n)
342 + HAVE_MNL := $(usex minimal n y)
343 + HAVE_ELF := $(usex elf y n)
344 + HAVE_SELINUX := $(usex selinux y n)
345 + IP_CONFIG_SETNS := ${setns}
346 + # Use correct iptables dir, #144265 #293709
347 + IPT_LIB_DIR := $(use iptables && ${PKG_CONFIG} xtables --variable=xtlibdir)
348 + EOF
349 +}
350 +
351 +src_compile() {
352 + emake V=1
353 +}
354 +
355 +src_install() {
356 + if use minimal ; then
357 + into /
358 + dosbin tc/tc
359 + dobin ip/ip
360 + return 0
361 + fi
362 +
363 + emake \
364 + DESTDIR="${D}" \
365 + LIBDIR="${EPREFIX%/}"/$(get_libdir) \
366 + SBINDIR="${EPREFIX%/}"/sbin \
367 + CONFDIR="${EPREFIX%/}"/etc/iproute2 \
368 + DOCDIR="${EPREFIX%/}"/usr/share/doc/${PF} \
369 + MANDIR="${EPREFIX%/}"/usr/share/man \
370 + ARPDDIR="${EPREFIX%/}"/var/lib/arpd \
371 + install
372 +
373 + dodir /bin
374 + mv "${ED%/}"/{s,}bin/ip || die #330115
375 +
376 + dolib.a lib/libnetlink.a
377 + insinto /usr/include
378 + doins include/libnetlink.h
379 + # This local header pulls in a lot of linux headers it
380 + # doesn't directly need. Delete this header that requires
381 + # linux-headers-3.8 until that goes stable. #467716
382 + sed -i '/linux\/netconf.h/d' "${ED%/}"/usr/include/libnetlink.h || die
383 +
384 + if use berkdb ; then
385 + dodir /var/lib/arpd
386 + # bug 47482, arpd doesn't need to be in /sbin
387 + dodir /usr/bin
388 + mv "${ED%/}"/sbin/arpd "${ED%/}"/usr/bin/ || die
389 + fi
390 +}