commit:     2c9ce55f5a952047e51963f9e4acff8b7c0c0655
Author:     Jory A. Pratt <anarchy <AT> gentoo <DOT> org>
AuthorDate: Sun Jan  3 16:45:28 2016 +0000
Commit:     Jory Pratt <anarchy <AT> gentoo <DOT> org>
CommitDate: Sun Jan  3 16:45:28 2016 +0000
URL:        https://gitweb.gentoo.org/proj/musl.git/commit/?id=2c9ce55f

sys-apps/iproute2 - Fix up build to fully with with musl on ~arch

 sys-apps/iproute2/Manifest                         |   4 +
 .../iproute2/files/iproute2-4.2.0-no-ipv6.patch    |  37 ++++++
 sys-apps/iproute2/files/iproute2-4.3.0-musl.patch  |  95 +++++++++++++++
 sys-apps/iproute2/iproute2-4.3.0.ebuild            | 131 +++++++++++++++++++++
 4 files changed, 267 insertions(+)

diff --git a/sys-apps/iproute2/Manifest b/sys-apps/iproute2/Manifest
index 4810bcb..7f0172d 100644
--- a/sys-apps/iproute2/Manifest
+++ b/sys-apps/iproute2/Manifest
@@ -6,11 +6,15 @@ AUX iproute2-3.8.0-musl-headers.patch 2701 SHA256 
3d6c6ff432f68ab76bc818aee6228e
 AUX iproute2-3.8.0-old-mount-libc.patch 871 SHA256 
dc9fc407b09763f79663dbad627961f8a3446881737cc666f0cb67235f160d51 SHA512 
cda73ce07c21d18c68fcff08e282e87a2d4b53cf7779e8a1ef669d7275974c8f3638ca530031aafcfc7eb4885264ceb7abb308b9da6f5568889a84cb4c7df1f9
 WHIRLPOOL 
d2057e6bad82dce7844886d551d70af9207e111494b9cc23abc433857741afa48f30671091c8821a60aaa07ca621f243fbeee10322da11ac44d02f4f588b88bf
 AUX iproute2-4.0.0-fix-build-with-musl.patch 586 SHA256 
e617316ce2803b6ad0dca43426a7a6c8762809f8e1e984da8c935bcff4db8e34 SHA512 
2473432adbc02f0085be7b689af00527bc87f3ee89e313425dbc3a02e1a4569b1c397fc7160a2b26907c5edff3fdd5bd38d7e27043a9bebfbc36d714c8281953
 WHIRLPOOL 
a6b451b38bb977a0b52fa904905c599922693c425537d5173c981dc2082d6c55f9a0d01514405e57c5719c376357f4759333ea3ad5dea849f4cef9df76d12181
 AUX iproute2-4.0.0-tc-show-buffer-overflow.patch 1717 SHA256 
2ddb5ea744185f5ebff79961a054570b166ad1a5f3df0b91b59927d1b86c7aa3 SHA512 
f5b507ce9d9a2cf4b86c0c2e2a18c5295226707df707eb229ec2f880b0fee64740a039fe5aa334c1dfc2d04faec4200cdb27dfaf631119a8705dd698f2767a77
 WHIRLPOOL 
801e25b3f6984b59d95eb494dfa63502e2c32551c8f5376ab6109a6bf5b9401f1b7bf6a0e0456dc68abb207d9505b5dbade675ea39e709e27a839357a431c444
+AUX iproute2-4.2.0-no-ipv6.patch 1336 SHA256 
b352b11d22e922038adb2b1ae083b6e47b89744f94d6de732bb85abd9cfa80e6 SHA512 
f4219a094f367c9f8fac089beeffca31abbbc5d4ade1681e23a92f3dd2e1a95f331322938936b0b1771ea5a56224e0f14008f4d38a8708357a5d2b2b70efbbd5
 WHIRLPOOL 
35faf6227ad1b4409b6742cb754b6570c25f65bd6a63e2237fd9613075827811bd1b9e86dd5d099b061e14906f752ef5aecea8ccbe95748d98f892d111a3a0b7
 AUX iproute2-4.3.0-musl-noiptables.patch 1166 SHA256 
1910d28fe0aa89ba71cd30bb38b43119414102ce323dc47eee8bec290e5f52e7 SHA512 
f1b988c5ae5b5d159d1a2bedec678b8680b3358a6ea3a9d581b642cd706cfd1cb31c7cd590e1fe8969c3d3bebb2912fb5fa8011cfc39d2a17a4092617ae15766
 WHIRLPOOL 
87ee199c0f06b8c750412625e204b10261945954c07fade452ea2cf956405d7094d02357e1ed92f1aafcc9d34c7e7109cb10ee1aed31adf0e94989f2701bd877
+AUX iproute2-4.3.0-musl.patch 2989 SHA256 
bf10609ba7dcb04cb134745dd7af4c8c66d6b667400dd30abb3325ebdfd446fb SHA512 
8cf23bca01b111e2dfa26e944de151b35d6278833066276e603cd567f8084c16ee5b0dd527dd0626828f3099ae5907bdef4783672bfe23605f43ce9c3b4c2182
 WHIRLPOOL 
40d5bdb8dcd84e43a6798584aba35a11d1b5a79e54dcf80da0f465041330c5a76c2c4297fd78aa2a272181954407b404030bb9cca4dc74e4f7b36b5f98775cd7
 DIST iproute2-3.19.0.tar.xz 455004 SHA256 
e2f9f8c36e166f2ba6c0e1e7a9ad84cdf7c1615b93df49dac44563d7b57fd7b0 SHA512 
fc533b6a526cfda234f043ac25302a3206a81ab2a740640b997b6bfb22e6f94ddc21b704191a358ea8721a327ba785e0224a4b4129111ef5008b4003379c3706
 WHIRLPOOL 
6a0aa1a948286d7dcb3663d787167c27760d756385295bf0ca631920aed50fbd984c19204247097116ef0d4e293c3c8dbe13b0b44c6ec83e7815a7461293c89f
 DIST iproute2-4.0.0.tar.xz 459364 SHA256 
5cd06eb1050b858b308b65705725042bb566fd261135e35a73dafb48cd632618 SHA512 
8e0587ed484a9697af99b4f37b460fddd28136b3c19898a11809b1e8ca9a75a18dcc83bc512f5b74361e6128732e69a3e66b3a62c38a5ae5f13c3e18af186be4
 WHIRLPOOL 
6abdf2b4587abd7a73d2b7692a4bb478ac379dc3a27f564ad78e34f25f06ae5dd9e0e4873c6510d30767a398375dcdcd2da777412c725885e0c3d4bd89c71a9b
 DIST iproute2-4.1.1.tar.xz 496388 SHA256 
73077a989efb934450bd655cbd9aaddaa747cb696c64d0c9a3323768a6a8e66f SHA512 
af2e4021faf931d17a67c242c66b4f6a6ce93a69cee5408dd3951d488da511c99d693534e91d0a317bd82dfdcb6a543605cecf2514d512004639db8d17afb93e
 WHIRLPOOL 
24542b56275675609aaad69ca68e89145d4da84ddb2429ae546179a249bcc1213f89168673657966122e01e992763fec053c118fbd69b7db1677ad7be97397b6
+DIST iproute2-4.3.0.tar.xz 525364 SHA256 
f03b1188dd6c039512424de82ff7a8f3b446680bd4e908ff42a7b9b137422995 SHA512 
14736158e76cef3dfc3af1a881faf97901bce6dcc9ffe52de92c8a64ae466f2c8ceaa32349553215dbe371115e7cd5cedcbf9922a0d72da9e7ebe3a73fac3687
 WHIRLPOOL 
cd772090f20bbb50e4556c609f28a07acc60ff344989f2ad112c13e1dbc6f60b09e9f5bc6bd29322b1b1635b6266d70aff1aa8f5c37ed458ae569697b7401c0e
 EBUILD iproute2-3.19.0-r99.ebuild 3700 SHA256 
552f58b5f02887a93c347450df11fd236fb1bb49cb82962c0fbc75863b9750bd SHA512 
a1fee8a1268ec96a6e90b5c5bc40a0d7a6cd23d4ecb8bf5617d0145b1db0a62bef85bbd37719e86997f8103feb09c98b025fb82b1bbae885cc5b6f6a3b346d39
 WHIRLPOOL 
73209031bf4ccebda47195632c09fc4f017854723c734f51e4bfa9f20bfd284f1272d891b4c8f22b25e6b28e12cc0289e28c78a765d0c71ce5bcbdce2b925363
 EBUILD iproute2-4.0.0-r99.ebuild 3867 SHA256 
e87ce20beee93a16efc68a9eafb13b666465121e344615f8152c6b039a017d22 SHA512 
5a81a56bd880012c309bebb20d55e97b0d19ced6e6ff69711f4dfa78892417f55131cd14fc285a146bf7fd75e9e4a094ab1dc584d921a49ea0f7087fd642ecc1
 WHIRLPOOL 
3abcb67e2fbd6b6a85095d3cbc4daa0ec1d534a67ccbbc86b0d6f540b00252fbe66a4af76b79ed2d77029580216ede5f32726f8afe5ba1d676860d3e53deef00
 EBUILD iproute2-4.1.1-r99.ebuild 4004 SHA256 
0bb7fe762de032771f0c46eaf77284bfd5b0120115315ba607099b11e8ebe671 SHA512 
f55d0a4004eb626678acb3aed712cc31ace1f00274b9cabdd1ea111dc6be2e5f1dd01b5d3be3304d01cd37c7c61f522511d0ff3a2e5ec628b5a089aba87c4a65
 WHIRLPOOL 
dc2334cf12d4efe1a73c853b1c339fc7665df493552b6bc659dca623b8cea980fe5ed27daada02a93a9efa5749184a5f1a557fac3e816b08259e3497f9310a3c
+EBUILD iproute2-4.3.0.ebuild 3873 SHA256 
f9f85b6689ea2b5148c0b7b9f89683181ffa140426483f3584156568dfe76ffc SHA512 
6a89c4a094e714318b65fe0d23f4008ca0d08be328f66f7407b3754a6ddb39c9c3b78306a4a3c93345d8f89d605554683481cff4810399e601588fe1f60541ad
 WHIRLPOOL 
45dc9cf6c45b9b99057034c0fb34fd61269c51e8ae75ae191002bf64537bbc4e73f571784211c0098b04788f597af19e34a7c3418791a9eb44b2eda3b16f70d3
 MISC metadata.xml 317 SHA256 
45312a0c8b9363b8eaa97110513ca39053ffcd967af978900ee0a01aa81c00aa SHA512 
2e6ed50522276dd0b09a61ba0c68ccc226ff33b64da2af87e92e349354f379cae040eb753961aeedc2a894eb65415fba7763541efe21bf328fe0a69706aeb872
 WHIRLPOOL 
73003e9201c29cba545b3245b53da9c36dc4b3c209ece693a9401b954896f6db5d29b209318fb7dd1c33db8920d01e097feaa88ef4ec0cb07590e850803bce09

diff --git a/sys-apps/iproute2/files/iproute2-4.2.0-no-ipv6.patch 
b/sys-apps/iproute2/files/iproute2-4.2.0-no-ipv6.patch
new file mode 100644
index 0000000..b29e1aa
--- /dev/null
+++ b/sys-apps/iproute2/files/iproute2-4.2.0-no-ipv6.patch
@@ -0,0 +1,37 @@
+--- iproute2-4.2.0/ip/ipmonitor.c
++++ iproute2-4.2.0/ip/ipmonitor.c
+@@ -115,7 +115,6 @@
+       }
+       if (n->nlmsg_type == RTM_NEWPREFIX) {
+               print_headers(fp, "[PREFIX]", ctrl);
+-              print_prefix(who, n, arg);
+               return 0;
+       }
+       if (n->nlmsg_type == RTM_NEWRULE || n->nlmsg_type == RTM_DELRULE) {
+--- iproute2-4.2.0/ip/iptunnel.c
++++ iproute2-4.2.0/ip/iptunnel.c
+@@ -637,13 +637,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.2.0/ip/Makefile
++++ iproute2-4.2.0/ip/Makefile
+@@ -1,6 +1,6 @@
+ 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_vlan.o link_veth.o link_gre.o iplink_can.o \
+     iplink_macvlan.o iplink_macvtap.o ipl2tp.o link_vti.o link_vti6.o \

diff --git a/sys-apps/iproute2/files/iproute2-4.3.0-musl.patch 
b/sys-apps/iproute2/files/iproute2-4.3.0-musl.patch
new file mode 100644
index 0000000..52e2940
--- /dev/null
+++ b/sys-apps/iproute2/files/iproute2-4.3.0-musl.patch
@@ -0,0 +1,95 @@
+From 48596709d8ab59727b79a5c6db33ebb251c36543 Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazz...@free-electrons.com>
+Date: Thu, 19 Nov 2015 17:44:25 +0100
+Subject: [PATCH] Avoid in6_addr redefinition
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Due to both <netinet/in.h> and <linux/in6.h> being included, the
+in6_addr is being redefined: once from the C library headers and once
+from the kernel headers. This causes some build failures with for
+example the musl C library:
+
+In file included from ../include/linux/xfrm.h:4:0,
+                 from xfrm.h:29,
+                 from ipxfrm.c:39:
+../include/linux/in6.h:32:8: error: redefinition of ‘struct in6_addr’
+ struct in6_addr {
+        ^
+In file included from 
.../output/host/usr/x86_64-buildroot-linux-musl/sysroot/usr/include/netdb.h:9:0,
+                 from ipxfrm.c:34:
+.../output/host/usr/x86_64-buildroot-linux-musl/sysroot/usr/include/netinet/in.h:24:8:
 note: originally defined here
+ struct in6_addr
+        ^
+
+In order to fix this, use just the C library header <netinet/in.h>.
+
+Original patch taken from
+http://git.alpinelinux.org/cgit/aports/tree/main/iproute2/musl-fixes.patch.
+
+Signed-off-by: Thomas Petazzoni <thomas.petazz...@free-electrons.com>
+---
+ include/libiptc/ipt_kernel_headers.h | 2 --
+ include/linux/if_bridge.h            | 1 -
+ include/linux/netfilter.h            | 2 --
+ include/linux/xfrm.h                 | 1 -
+ 4 files changed, 6 deletions(-)
+
+diff --git a/include/libiptc/ipt_kernel_headers.h 
b/include/libiptc/ipt_kernel_headers.h
+index 7e87828..9566be5 100644
+--- a/include/libiptc/ipt_kernel_headers.h
++++ b/include/libiptc/ipt_kernel_headers.h
+@@ -15,12 +15,10 @@
+ #else /* libc5 */
+ #include <sys/socket.h>
+ #include <linux/ip.h>
+-#include <linux/in.h>
+ #include <linux/if.h>
+ #include <linux/icmp.h>
+ #include <linux/tcp.h>
+ #include <linux/udp.h>
+ #include <linux/types.h>
+-#include <linux/in6.h>
+ #endif
+ #endif
+diff --git a/include/linux/if_bridge.h b/include/linux/if_bridge.h
+index ee197a3..f823aa4 100644
+--- a/include/linux/if_bridge.h
++++ b/include/linux/if_bridge.h
+@@ -15,7 +15,6 @@
+ 
+ #include <linux/types.h>
+ #include <linux/if_ether.h>
+-#include <linux/in6.h>
+ 
+ #define SYSFS_BRIDGE_ATTR     "bridge"
+ #define SYSFS_BRIDGE_FDB      "brforward"
+diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
+index b71b4c9..3e4e6ae 100644
+--- a/include/linux/netfilter.h
++++ b/include/linux/netfilter.h
+@@ -4,8 +4,6 @@
+ #include <linux/types.h>
+ 
+ #include <linux/sysctl.h>
+-#include <linux/in.h>
+-#include <linux/in6.h>
+ 
+ /* Responses from hook functions. */
+ #define NF_DROP 0
+diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h
+index b8f5451..a9761a5 100644
+--- a/include/linux/xfrm.h
++++ b/include/linux/xfrm.h
+@@ -1,7 +1,6 @@
+ #ifndef _LINUX_XFRM_H
+ #define _LINUX_XFRM_H
+ 
+-#include <linux/in6.h>
+ #include <linux/types.h>
+ 
+ /* All of the structures in this file may not change size as they are
+-- 
+2.6.3
+

diff --git a/sys-apps/iproute2/iproute2-4.3.0.ebuild 
b/sys-apps/iproute2/iproute2-4.3.0.ebuild
new file mode 100644
index 0000000..cb388c0
--- /dev/null
+++ b/sys-apps/iproute2/iproute2-4.3.0.ebuild
@@ -0,0 +1,131 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+inherit eutils 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-2
+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="http://www.linuxfoundation.org/collaborate/workgroups/networking/iproute2";
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE="atm berkdb +iptables ipv6 minimal selinux"
+
+# We could make libmnl optional, but it's tiny, so eh
+RDEPEND="!net-misc/arpd
+       !minimal? ( net-libs/libmnl )
+       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
+       sys-devel/flex
+       >=sys-kernel/linux-headers-3.16
+       elibc_glibc? ( >=sys-libs/glibc-2.7 )"
+
+src_prepare() {
+       epatch "${FILESDIR}"/${PN}-3.1.0-mtu.patch #291907
+       use ipv6 || epatch "${FILESDIR}"/${PN}-4.2.0-no-ipv6.patch #326849
+       epatch "${FILESDIR}"/${PN}-4.3.0-musl.patch
+       epatch "${FILESDIR}"/${PN}-4.3.0-musl-noiptables.patch
+
+       sed -i \
+               -e '/^CC =/d' \
+               -e "/^LIBDIR/s:=.*:=/$(get_libdir):" \
+               -e "s:-O2:${CFLAGS} ${CPPFLAGS}:" \
+               -e "/^HOSTCC/s:=.*:= $(tc-getBUILD_CC):" \
+               -e "/^WFLAGS/s:-Werror::" \
+               -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
+       echo 'main(){return setns();};' > test.c
+       ${CC} ${CFLAGS} ${LDFLAGS} test.c >&/dev/null && setns=y || setns=n
+       echo 'main(){};' > test.c
+       ${CC} ${CFLAGS} ${LDFLAGS} test.c -lresolv >&/dev/null || sed -i 
'/^LDLIBS/s:-lresolv::' "${S}"/Makefile
+       popd >/dev/null
+
+       cat <<-EOF > Config
+       TC_CONFIG_ATM := $(usex atm y n)
+       TC_CONFIG_XT  := $(usex iptables y n)
+       # We've locked in recent enough kernel headers #549948
+       TC_CONFIG_IPSET := y
+       HAVE_BERKELEY_DB := $(usex berkdb y n)
+       HAVE_MNL      := $(usex minimal n y)
+       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_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
+
+       rm "${ED}"/usr/share/doc/${PF}/*.{sgml,tex} || die #455988
+
+       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
+}

Reply via email to