summaryrefslogtreecommitdiff
path: root/sys-apps/iproute2
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2019-01-12 16:58:08 +0000
committerV3n3RiX <venerix@redcorelinux.org>2019-01-12 16:58:08 +0000
commitc8a77dfe4d3d307c1d5dd2650b7297447d8b609d (patch)
tree9ea78393bc3ecd6ab4de449383d4e97e5f3648ae /sys-apps/iproute2
parent2891d29af8907ce881662f4a02844926d7a293c7 (diff)
gentoo resync : 12.01.2019
Diffstat (limited to 'sys-apps/iproute2')
-rw-r--r--sys-apps/iproute2/Manifest4
-rw-r--r--sys-apps/iproute2/files/iproute2-4.20.0-configure-nomagic.patch208
-rw-r--r--sys-apps/iproute2/files/iproute2-4.20.0-no-ipv6.patch38
-rw-r--r--sys-apps/iproute2/iproute2-4.20.0.ebuild155
4 files changed, 405 insertions, 0 deletions
diff --git a/sys-apps/iproute2/Manifest b/sys-apps/iproute2/Manifest
index d869064ed4ac..7157214b3d2e 100644
--- a/sys-apps/iproute2/Manifest
+++ b/sys-apps/iproute2/Manifest
@@ -5,11 +5,15 @@ AUX iproute2-4.14.1-fix-tc-actions.patch 6665 BLAKE2B e2ff926f2122973bcbe61e1671
AUX iproute2-4.14.1-posix-shell.patch 1841 BLAKE2B ba1ab797c264dc74180b85f842810af120462df3e15523f132b67968f7be0ae68086d9c01f33cc70fb7680ce2229c76960fe7a232ce6bd1069903976c7143349 SHA512 bb4c3c75c25ec551fe006ae15a0e3bc31c1f49861083894d6d51320be52dbac60634951332135b888faf9363857b53695f3cc418029445a4578b5e9233aec4f3
AUX iproute2-4.17.0-configure-nomagic.patch 5654 BLAKE2B b56f7a3a02822c99a1f2c7ca1bcd0af633dc2f57d454c44dabd81b923f43afee1dfdfffda1d1293c101041316c8496275d773c2495f73817fb4ff90d0a85daed SHA512 97f35b0e8a93e5570fdade6a47864518686a358c9c6b5a55832d66baae628140015a90418b49b8426f66011c8b8a9dc7713d89c3e0e45938b3dc948a92350d42
AUX iproute2-4.2.0-no-ipv6.patch 1336 BLAKE2B bafb155e6bbd902eb0fff7d8875cc4ef7956de0071273dd373ebd09ef46ba23eb22f4226a044585faa2a00c9e4c2854e57e0e06eb1ac735edea9dce2721cadcc SHA512 f4219a094f367c9f8fac089beeffca31abbbc5d4ade1681e23a92f3dd2e1a95f331322938936b0b1771ea5a56224e0f14008f4d38a8708357a5d2b2b70efbbd5
+AUX iproute2-4.20.0-configure-nomagic.patch 5835 BLAKE2B e21e79a5f804b4f3ebd82334541dd6d9e931308cfa218dfd7743f5a807126d6bf52d63e9e84f7683be41b2249ea8aa13991ea3f4d486702d3d4d2c4e9a51b238 SHA512 a41b87a11d71120c3f3df9f9dbecc789df0355de517700749ea0b9bb4fb9ffeb94dd9218f9b2edc75ffc865e63a9a00af381816b36b0a929c0c9c7828c949660
+AUX iproute2-4.20.0-no-ipv6.patch 1334 BLAKE2B 612fa64a897fe8c601aca529a09508cc865f2f0fb7cb865ba28f3369748086622b6910f25052047c972f495b5e20014cdf6e9f73b230124f372cfe6301bc0bf2 SHA512 f4b42667d4433225b2e4272b6e629fc43b73ede02ac0e706d2e46d81ffcecd19ca45b8b9789904b4bd6d10d34c82239f9b3c33cfcf3f9e5b309d828a3494c864
DIST iproute2-4.14.1.tar.xz 636876 BLAKE2B 232dbe29b9af516d8345c86c044359d3b0cfe73fb88a2ba1dcd05534b52dea37c9155d2b273a4a0d40b55fba8b5503a0fbe5bc71f37864c0a2ba9d6f08b6bf41 SHA512 e593b68c46ef5f98bd6911ee7beb38388a14935a29fefabdeccc96aa012593b6f3a49b3bb1baed7d77e54f1f4a857172e058b73407f4070f158b8713f44f5d2c
DIST iproute2-4.17.0.tar.xz 675268 BLAKE2B 3d1455c119c9c56b11a64092c152fcea2b161f571006878215425b95deef779fed523368252ce672a1a70251c019edbe6ff2bdac8c3ee8abab1fb29e2a3c669c SHA512 ccd7fb70afd58f1fcd4e17c38a24607207da853c4d6118fda423efa6e51faad3ad03c4d6d58a579c40ef9c68aaf13b1c455e12b0c36e155712d3d4db3c2ff4b5
DIST iproute2-4.19.0.tar.xz 720408 BLAKE2B 2d0ece5dd8f1beb7912d025c269a9edd2ecd87aea04971a28eca9f9b7ea82d0e4aa397c9338c0cb6cb463887678a541a5407644e82244ffbbae0eb8f6ac088e8 SHA512 47c750da2247705b1b1d1621f58987333e54370d0fff2f24106194022de793ff35dfd67fd1be127ce019008705702092d31dac49abf930a7c0dc5c7e7c0665b8
+DIST iproute2-4.20.0.tar.xz 707016 BLAKE2B d62c6b995c4c1f79617e2f8149ff2ed297d741965e81bffebfa475514f5e96f0c9300e65d12bdd14ab492ce66675677eb41af6816876d5e1360218e4f32f4bc8 SHA512 ed29638c864062e199152c7b3b24b6495987ca6f79cc9ab1b529dab37a8a840fa2b5858d5db2b94eeefa1c0d72ff666a790107e27d11a597b189bfb7a01a4b8b
EBUILD iproute2-4.14.1-r2.ebuild 4092 BLAKE2B b3e3ae2b24182aa2d99f16120231bd4ac2029b73b9af53f0098046ecce73049e3dac510ee405f4dd12aa8c0e45b0504b7f82425c8063d05b5a958475ac2ce9d6 SHA512 c4f5cb98704d5a78d74a17a057bebb89f059c0a622d5e7ed28c6b36a73ed6be6d2a9205ed6b1ac4401f23ae46372e25d85a1038631d6ed215b2fd68c2e6a4c73
EBUILD iproute2-4.17.0-r1.ebuild 4265 BLAKE2B 12f2034aebd08983d8349dfa07935bfbeb04126b2af45c1a88c00e7a40ff865fb00e498955aa2f0e6a0e1c55e702d281f653b1cf9817e8bdeebc21b8e79b1fbe SHA512 e46431a3827de15fe0d0bd4837a66f378c3e4bc067ca29ae5292faa2bcda10b3bfc79e1eedc31ab4f38db8d245750bc9de9733202e87a2a974bef2cff60640dd
EBUILD iproute2-4.19.0-r1.ebuild 4278 BLAKE2B bedd85f0cfac4e0db1e210067f287bd4be04e89d6623373ed61097ce91e59636f00ef68a1a39335dc43335e5ca6d3e5ab94091084ae6fc703b7fa939305ca15f SHA512 a71917519ea3a8cff82a3eb5f50cb71723bd3749d2dfa7d7e7a5fa4db27325a14880d9b108ef4bbe450553c65f4711f73f94208acc19b12263cd97ebd9bafa18
+EBUILD iproute2-4.20.0.ebuild 4314 BLAKE2B a4267caef40fefa2ef46a8103c0ca558a51f4f298ed25630614752035c3d2cdadef160904c77f46a978c3d85f2fbf1714d5cd0b9d9c6fb52b8d04cf68f52f664 SHA512 68768fd94cc1571b51e3e87dfa8f0fe009ca354ccca5a5e9b2faa0db5e6f827be637f5cc5594d7c08136e9ff2e8b664bedd2296c02bcad143150e7ebe3c765e5
EBUILD iproute2-9999.ebuild 4310 BLAKE2B 0569ce4999daa8315da5fa8692ad3bef4623133ea91c8520950b14c0dabeb63f922fbdda33ddad194b44ea205554a61afe225a28f9e5711bb501f3add3fd2f7d SHA512 d70a72670a882f7b1ecc13018e993282a0d532d3d8a8e024d8ab655746daf00d7316ab71ec9caad15c1d9195ba25aea722adb1b73a0753f77fefe48516f03e71
MISC metadata.xml 581 BLAKE2B b63c391d8d9ba608c12ea74f0cdf0d4d762d18e5b62ab1e2489f34140def1691bc295d8d252ab984b313b6fb037cd4d5a74d992db7ca670557bd8458501f8c04 SHA512 607dd3006049664a4c780a65b187fb938cbf7c5e79b445eb4a69c3115af8fe6718ea227a68cfcf4b42fd92c3e760579a92b49a58415d01ccb0715fdf9c052a97
diff --git a/sys-apps/iproute2/files/iproute2-4.20.0-configure-nomagic.patch b/sys-apps/iproute2/files/iproute2-4.20.0-configure-nomagic.patch
new file mode 100644
index 000000000000..94df85017dfe
--- /dev/null
+++ b/sys-apps/iproute2/files/iproute2-4.20.0-configure-nomagic.patch
@@ -0,0 +1,208 @@
+The hand-rolled configure script, for multiple options (selinux,mnl,elf), sets
+a variable as well as modifying CFLAGS & LDLIBS.
+
+If config.mk is later amended to disable a feature, the CFLAGS/LDLIBS tweaks
+are still in place.
+
+Push the CFLAGS/LDLIBS changes into new conditional Makefile code, so that they
+are only passed when correctly needed.
+
+Prior Gentoo testcase for reproduction:
+USE=minimal ebuild ... compile.
+- Linking with libelf, libmnl & libcap based only on presence.
+- Links based on libselinux based only on presence.
+
+Closes: https://bugs.gentoo.org/643722
+Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
+
+Forward-ported from v4.14.1 to v4.16.0 by Lars Wendler <polynomial-c@gentoo.org>
+Added libcap to v4.17.0 by Lars Wendler <polynomial-c@gentoo.org>
+Forward-ported from v4.17.0 to v4.20.0 by Lars Wendler <polynomial-c@gentoo.org>
+
+--- iproute2-4.20.0/bridge/Makefile
++++ iproute2-4.20.0/bridge/Makefile
+@@ -2,6 +2,7 @@
+ BROBJ = bridge.o fdb.o monitor.o link.o mdb.o vlan.o
+
+ include ../config.mk
++include ../config.include
+
+ all: bridge
+
+--- iproute2-4.20.0/config.include
++++ iproute2-4.20.0/config.include
+@@ -0,0 +1,26 @@
++# We can only modify CFLAGS/LDLIBS after all the config options are known.
++ifeq ($(IP_CONFIG_SETNS),y)
++ CFLAGS += $(IP_CONFIG_SETNS_CFLAGS)
++endif
++ifeq ($(HAVE_ELF),y)
++ CFLAGS += $(HAVE_ELF_CFLAGS)
++ LDLIBS += $(HAVE_ELF_LDLIBS)
++endif
++ifeq ($(HAVE_SELINUX),y)
++ CFLAGS += $(HAVE_SELINUX_CFLAGS)
++ LDLIBS += $(HAVE_SELINUX_LDLIBS)
++endif
++ifeq ($(HAVE_MNL),y)
++ CFLAGS += $(HAVE_MNL_CFLAGS)
++ LDLIBS += $(HAVE_MNL_LDLIBS)
++endif
++ifeq ($(HAVE_CAP),y)
++ CFLAGS += $(HAVE_CAP_CFLAGS)
++ LDLIBS += $(HAVE_CAP_LDLIBS)
++endif
++
++# Rules can only be declared after all variables in them are known.
++%.o: %.c
++ $(QUIET_CC)$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(CPPFLAGS) -c -o $@ $<
++
++# vim: ft=make:
+--- iproute2-4.20.0/configure
++++ iproute2-4.20.0/configure
+@@ -188,7 +188,7 @@
+ if $CC -I$INCLUDE -o $TMPDIR/setnstest $TMPDIR/setnstest.c >/dev/null 2>&1; then
+ echo "IP_CONFIG_SETNS:=y" >>$CONFIG
+ echo "yes"
+- echo "CFLAGS += -DHAVE_SETNS" >>$CONFIG
++ echo "IP_CONFIG_SETNS_CFLAGS += -DHAVE_SETNS" >>$CONFIG
+ else
+ echo "no"
+ fi
+@@ -231,8 +231,8 @@
+ echo "HAVE_ELF:=y" >>$CONFIG
+ echo "yes"
+
+- echo 'CFLAGS += -DHAVE_ELF' `${PKG_CONFIG} libelf --cflags` >> $CONFIG
+- echo 'LDLIBS += ' `${PKG_CONFIG} libelf --libs` >>$CONFIG
++ echo 'HAVE_ELF_CFLAGS += -DHAVE_ELF' `${PKG_CONFIG} libelf --cflags` >> $CONFIG
++ echo 'HAVE_ELF_LDLIBS += ' `${PKG_CONFIG} libelf --libs` >>$CONFIG
+ else
+ echo "no"
+ fi
+@@ -245,8 +245,8 @@
+ echo "HAVE_SELINUX:=y" >>$CONFIG
+ echo "yes"
+
+- echo 'LDLIBS +=' `${PKG_CONFIG} --libs libselinux` >>$CONFIG
+- echo 'CFLAGS += -DHAVE_SELINUX' `${PKG_CONFIG} --cflags libselinux` >>$CONFIG
++ echo 'HAVE_SELINUX_CFLAGS += -DHAVE_SELINUX' `${PKG_CONFIG} --cflags libselinux` >>$CONFIG
++ echo 'HAVE_SELINUX_LDLIBS +=' `${PKG_CONFIG} --libs libselinux` >>$CONFIG
+ else
+ echo "no"
+ fi
+@@ -258,8 +258,8 @@
+ echo "HAVE_MNL:=y" >>$CONFIG
+ echo "yes"
+
+- echo 'CFLAGS += -DHAVE_LIBMNL' `${PKG_CONFIG} libmnl --cflags` >>$CONFIG
+- echo 'LDLIBS +=' `${PKG_CONFIG} libmnl --libs` >> $CONFIG
++ echo 'HAVE_MNL_CFLAGS += -DHAVE_LIBMNL' `${PKG_CONFIG} libmnl --cflags` >>$CONFIG
++ echo 'HAVE_MNL_LDLIBS +=' `${PKG_CONFIG} libmnl --libs` >> $CONFIG
+ else
+ echo "no"
+ fi
+@@ -316,8 +316,8 @@
+ echo "HAVE_CAP:=y" >>$CONFIG
+ echo "yes"
+
+- echo 'CFLAGS += -DHAVE_LIBCAP' `${PKG_CONFIG} libcap --cflags` >>$CONFIG
+- echo 'LDLIBS +=' `${PKG_CONFIG} libcap --libs` >> $CONFIG
++ echo 'HAVE_CAP_CFLAGS += -DHAVE_LIBCAP' `${PKG_CONFIG} libcap --cflags` >>$CONFIG
++ echo 'HAVE_CAP_LDLIBS +=' `${PKG_CONFIG} libcap --libs` >> $CONFIG
+ else
+ echo "no"
+ fi
+@@ -397,7 +397,3 @@
+
+ echo -n "libcap support: "
+ check_cap
+-
+-echo >> $CONFIG
+-echo "%.o: %.c" >> $CONFIG
+-echo ' $(QUIET_CC)$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(CPPFLAGS) -c -o $@ $<' >> $CONFIG
+--- iproute2-4.20.0/devlink/Makefile
++++ iproute2-4.20.0/devlink/Makefile
+@@ -1,5 +1,6 @@
+ # SPDX-License-Identifier: GPL-2.0
+ include ../config.mk
++include ../config.include
+
+ TARGETS :=
+
+--- iproute2-4.20.0/genl/Makefile
++++ iproute2-4.20.0/genl/Makefile
+@@ -2,6 +2,7 @@
+ GENLOBJ=genl.o
+
+ include ../config.mk
++include ../config.include
+ SHARED_LIBS ?= y
+
+ CFLAGS += -fno-strict-aliasing
+--- iproute2-4.20.0/ip/Makefile
++++ iproute2-4.20.0/ip/Makefile
+@@ -15,6 +15,7 @@
+ RTMONOBJ=rtmon.o
+
+ include ../config.mk
++include ../config.include
+
+ ALLOBJ=$(IPOBJ) $(RTMONOBJ)
+ SCRIPTS=ifcfg rtpr routel routef
+--- iproute2-4.20.0/lib/Makefile
++++ iproute2-4.20.0/lib/Makefile
+@@ -1,5 +1,6 @@
+ # SPDX-License-Identifier: GPL-2.0
+ include ../config.mk
++include ../config.include
+
+ CFLAGS += -fPIC
+
+--- iproute2-4.20.0/misc/Makefile
++++ iproute2-4.20.0/misc/Makefile
+@@ -5,6 +5,7 @@
+ TARGETS=ss nstat ifstat rtacct lnstat
+
+ include ../config.mk
++include ../config.include
+
+ ifeq ($(HAVE_BERKELEY_DB),y)
+ TARGETS += arpd
+--- iproute2-4.20.0/netem/Makefile
++++ iproute2-4.20.0/netem/Makefile
+@@ -1,5 +1,6 @@
+ # SPDX-License-Identifier: GPL-2.0
+ include ../config.mk
++include ../config.include
+
+ DISTGEN = maketable normal pareto paretonormal
+ DISTDATA = normal.dist pareto.dist paretonormal.dist experimental.dist
+--- iproute2-4.20.0/rdma/Makefile
++++ iproute2-4.20.0/rdma/Makefile
+@@ -1,5 +1,6 @@
+ # SPDX-License-Identifier: GPL-2.0
+ include ../config.mk
++include ../config.include
+
+ TARGETS :=
+
+--- iproute2-4.20.0/tc/Makefile
++++ iproute2-4.20.0/tc/Makefile
+@@ -4,6 +4,7 @@
+ emp_ematch.yacc.o emp_ematch.lex.o
+
+ include ../config.mk
++include ../config.include
+
+ SHARED_LIBS ?= y
+
+--- iproute2-4.20.0/tipc/Makefile
++++ iproute2-4.20.0/tipc/Makefile
+@@ -1,5 +1,6 @@
+ # SPDX-License-Identifier: GPL-2.0
+ include ../config.mk
++include ../config.include
+
+ TARGETS :=
+
diff --git a/sys-apps/iproute2/files/iproute2-4.20.0-no-ipv6.patch b/sys-apps/iproute2/files/iproute2-4.20.0-no-ipv6.patch
new file mode 100644
index 000000000000..31733e99f72c
--- /dev/null
+++ b/sys-apps/iproute2/files/iproute2-4.20.0-no-ipv6.patch
@@ -0,0 +1,38 @@
+--- iproute2-4.20.0/ip/ipmonitor.c
++++ iproute2-4.20.0/ip/ipmonitor.c
+@@ -118,7 +118,6 @@
+
+ case RTM_NEWPREFIX:
+ print_headers(fp, "[PREFIX]", ctrl);
+- print_prefix(n, arg);
+ return 0;
+
+ case RTM_NEWRULE:
+--- iproute2-4.20.0/ip/iptunnel.c
++++ iproute2-4.20.0/ip/iptunnel.c
+@@ -549,13 +549,6 @@
+ break;
+ case AF_INET:
+ break;
+- /*
+- * This is silly enough but we have no easy way to make it
+- * protocol-independent because of unarranged structure between
+- * IPv4 and IPv6.
+- */
+- case AF_INET6:
+- return do_ip6tunnel(argc, argv);
+ default:
+ fprintf(stderr, "Unsupported protocol family: %d\n", preferred_family);
+ exit(-1);
+--- iproute2-4.20.0/ip/Makefile
++++ iproute2-4.20.0/ip/Makefile
+@@ -1,7 +1,7 @@
+ # SPDX-License-Identifier: GPL-2.0
+ IPOBJ=ip.o ipaddress.o ipaddrlabel.o iproute.o iprule.o ipnetns.o \
+- rtm_map.o iptunnel.o ip6tunnel.o tunnel.o ipneigh.o ipntable.o iplink.o \
+- ipmaddr.o ipmonitor.o ipmroute.o ipprefix.o iptuntap.o iptoken.o \
++ rtm_map.o iptunnel.o tunnel.o ipneigh.o ipntable.o iplink.o \
++ ipmaddr.o ipmonitor.o ipmroute.o iptuntap.o iptoken.o \
+ ipxfrm.o xfrm_state.o xfrm_policy.o xfrm_monitor.o iplink_dummy.o \
+ iplink_ifb.o iplink_nlmon.o iplink_team.o iplink_vcan.o iplink_vxcan.o \
+ iplink_vlan.o link_veth.o link_gre.o iplink_can.o iplink_xdp.o \
diff --git a/sys-apps/iproute2/iproute2-4.20.0.ebuild b/sys-apps/iproute2/iproute2-4.20.0.ebuild
new file mode 100644
index 000000000000..aa41574d98b7
--- /dev/null
+++ b/sys-apps/iproute2/iproute2-4.20.0.ebuild
@@ -0,0 +1,155 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit toolchain-funcs flag-o-matic multilib
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="git://git.kernel.org/pub/scm/linux/kernel/git/shemminger/iproute2.git"
+ inherit git-r3
+else
+ SRC_URI="mirror://kernel/linux/utils/net/${PN}/${P}.tar.xz"
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+fi
+
+DESCRIPTION="kernel routing and traffic control utilities"
+HOMEPAGE="https://wiki.linuxfoundation.org/networking/iproute2"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE="atm berkdb caps elf +iptables ipv6 minimal selinux"
+
+# We could make libmnl optional, but it's tiny, so eh
+RDEPEND="
+ !net-misc/arpd
+ dev-libs/libbsd
+ !minimal? ( net-libs/libmnl )
+ caps? ( sys-libs/libcap )
+ elf? ( virtual/libelf )
+ iptables? ( >=net-firewall/iptables-1.4.20:= )
+ berkdb? ( sys-libs/db:= )
+ atm? ( net-dialup/linux-atm )
+ selinux? ( sys-libs/libselinux )
+"
+# We require newer linux-headers for ipset support #549948 and some defines #553876
+DEPEND="
+ ${RDEPEND}
+ app-arch/xz-utils
+ iptables? ( virtual/pkgconfig )
+ >=sys-devel/bison-2.4
+ sys-devel/flex
+ >=sys-kernel/linux-headers-3.16
+ virtual/pkgconfig
+ elibc_glibc? ( >=sys-libs/glibc-2.7 )
+"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-3.1.0-mtu.patch #291907
+ "${FILESDIR}"/${PN}-4.20.0-configure-nomagic.patch # bug 643722
+)
+
+src_prepare() {
+ if ! use ipv6 ; then
+ PATCHES+=(
+ "${FILESDIR}"/${PN}-4.20.0-no-ipv6.patch #326849
+ )
+ fi
+
+ default
+
+ sed -i \
+ -e '/^CC :\?=/d' \
+ -e "/^LIBDIR/s:=.*:=/$(get_libdir):" \
+ -e "s:-O2:${CFLAGS} ${CPPFLAGS}:" \
+ -e "/^HOSTCC/s:=.*:= $(tc-getBUILD_CC):" \
+ -e "/^DBM_INCLUDE/s:=.*:=${T}:" \
+ Makefile || die
+
+ # Use /run instead of /var/run.
+ sed -i \
+ -e 's:/var/run:/run:g' \
+ include/namespace.h \
+ man/man8/ip-netns.8 || die
+
+ # build against system headers
+ rm -r include/netinet #include/linux include/ip{,6}tables{,_common}.h include/libiptc
+ sed -i 's:TCPI_OPT_ECN_SEEN:16:' misc/ss.c || die
+
+ use minimal && sed -i -e '/^SUBDIRS=/s:=.*:=lib tc ip:' Makefile
+}
+
+src_configure() {
+ tc-export AR CC PKG_CONFIG
+
+ # This sure is ugly. Should probably move into toolchain-funcs at some point.
+ local setns
+ pushd "${T}" >/dev/null
+ printf '#include <sched.h>\nint main(){return setns(0, 0);}\n' > test.c
+ ${CC} ${CFLAGS} ${CPPFLAGS} -D_GNU_SOURCE ${LDFLAGS} test.c >&/dev/null && setns=y || setns=n
+ echo 'int main(){return 0;}' > test.c
+ ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} test.c -lresolv >&/dev/null || sed -i '/^LDLIBS/s:-lresolv::' "${S}"/Makefile
+ popd >/dev/null
+
+ # run "configure" script first which will create "config.mk"...
+ econf
+
+ # ...now switch on/off requested features via USE flags
+ # this is only useful if the test did not set other things, per bug #643722
+ cat <<-EOF >> config.mk
+ TC_CONFIG_ATM := $(usex atm y n)
+ TC_CONFIG_XT := $(usex iptables y n)
+ TC_CONFIG_NO_XT := $(usex iptables n y)
+ # We've locked in recent enough kernel headers #549948
+ TC_CONFIG_IPSET := y
+ HAVE_BERKELEY_DB := $(usex berkdb y n)
+ HAVE_CAP := $(usex caps y n)
+ HAVE_MNL := $(usex minimal n y)
+ HAVE_ELF := $(usex elf y n)
+ HAVE_SELINUX := $(usex selinux y n)
+ IP_CONFIG_SETNS := ${setns}
+ # Use correct iptables dir, #144265 #293709
+ IPT_LIB_DIR := $(use iptables && ${PKG_CONFIG} xtables --variable=xtlibdir)
+ EOF
+}
+
+src_compile() {
+ emake V=1
+}
+
+src_install() {
+ if use minimal ; then
+ into /
+ dosbin tc/tc
+ dobin ip/ip
+ return 0
+ fi
+
+ emake \
+ DESTDIR="${D}" \
+ LIBDIR="${EPREFIX%/}"/$(get_libdir) \
+ SBINDIR="${EPREFIX%/}"/sbin \
+ CONFDIR="${EPREFIX%/}"/etc/iproute2 \
+ DOCDIR="${EPREFIX%/}"/usr/share/doc/${PF} \
+ MANDIR="${EPREFIX%/}"/usr/share/man \
+ ARPDDIR="${EPREFIX%/}"/var/lib/arpd \
+ install
+
+ dodir /bin
+ mv "${ED%/}"/{s,}bin/ip || die #330115
+
+ dolib.a lib/libnetlink.a
+ insinto /usr/include
+ doins include/libnetlink.h
+ # This local header pulls in a lot of linux headers it
+ # doesn't directly need. Delete this header that requires
+ # linux-headers-3.8 until that goes stable. #467716
+ sed -i '/linux\/netconf.h/d' "${ED%/}"/usr/include/libnetlink.h || die
+
+ if use berkdb ; then
+ dodir /var/lib/arpd
+ # bug 47482, arpd doesn't need to be in /sbin
+ dodir /usr/bin
+ mv "${ED%/}"/sbin/arpd "${ED%/}"/usr/bin/ || die
+ fi
+}