commit:     3dadd237dced7b2750ddcebf7921a1011170e5f0
Author:     Jeroen Roovers <jer <AT> gentoo <DOT> org>
AuthorDate: Mon Aug  8 13:09:23 2016 +0000
Commit:     Jeroen Roovers <jer <AT> gentoo <DOT> org>
CommitDate: Mon Aug  8 13:10:01 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3dadd237

net-libs/libnet: Fix building against sys-libs/musl by Petr Vaněk (bug #590738).

Package-Manager: portage-2.3.0

 net-libs/libnet/files/libnet-1.1.6-_SOURCE.patch | 20 ++++++++++
 net-libs/libnet/files/libnet-1.1.6-musl.patch    | 29 ++++++++++++++
 net-libs/libnet/files/libnet-1.2-_SOURCE.patch   | 20 ++++++++++
 net-libs/libnet/files/libnet-1.2-sizeof.patch    | 11 +++++
 net-libs/libnet/files/libnet-1.2-socklen_t.patch | 11 +++++
 net-libs/libnet/libnet-1.1.6-r1.ebuild           | 51 ++++++++++++++++++++++++
 net-libs/libnet/libnet-1.2_rc3-r1.ebuild         | 51 ++++++++++++++++++++++++
 7 files changed, 193 insertions(+)

diff --git a/net-libs/libnet/files/libnet-1.1.6-_SOURCE.patch 
b/net-libs/libnet/files/libnet-1.1.6-_SOURCE.patch
new file mode 100644
index 0000000..25ddbc7
--- /dev/null
+++ b/net-libs/libnet/files/libnet-1.1.6-_SOURCE.patch
@@ -0,0 +1,20 @@
+--- a/configure.in
++++ b/configure.in
+@@ -157,14 +157,14 @@
+ case "$target_os" in
+ 
+ *linux*)
+-    AC_DEFINE(_BSD_SOURCE, 1,
++    AC_DEFINE(_DEFAULT_SOURCE, 1,
+         [Define as necessary to "unhide" header symbols.])
+-    AC_DEFINE(__BSD_SOURCE, 1,
++    AC_DEFINE(__DEFAULT_SOURCE, 1,
+         [Define as necessary to "unhide" header symbols.])
+     AC_DEFINE(__FAVOR_BSD, 1,
+         [Define if we should favor the BSD APIs when possible in Linux.])
+ 
+-    LIBNET_CONFIG_DEFINES="-D_BSD_SOURCE -D__BSD_SOURCE -D__FAVOR_BSD"
++    LIBNET_CONFIG_DEFINES="-D_DEFAULT_SOURCE -D__DEFAULT_SOURCE -D__FAVOR_BSD"
+     AC_CHECK_HEADERS(net/ethernet.h, \
+         LIBNET_CONFIG_DEFINES="$LIBNET_CONFIG_DEFINES -DHAVE_NET_ETHERNET_H")
+     ;;

diff --git a/net-libs/libnet/files/libnet-1.1.6-musl.patch 
b/net-libs/libnet/files/libnet-1.1.6-musl.patch
new file mode 100644
index 0000000..238fb8a
--- /dev/null
+++ b/net-libs/libnet/files/libnet-1.1.6-musl.patch
@@ -0,0 +1,29 @@
+--- a/src/libnet_link_linux.c
++++ b/src/libnet_link_linux.c
+@@ -30,26 +30,15 @@
+ #include <sys/time.h>
+ 
+ #include <net/if.h>
+-#if (__GLIBC__)
+ #include <netinet/if_ether.h>
+ #include <net/if_arp.h>
+-#else
+-#include <linux/if_arp.h>
+-#include <linux/if_ether.h>
+-#endif
+ 
+ #if (HAVE_PACKET_SOCKET)
+ #ifndef SOL_PACKET
+ #define SOL_PACKET 263
+ #endif  /* SOL_PACKET */
+-#if __GLIBC__ >= 2 && __GLIBC_MINOR >= 1
+ #include <netpacket/packet.h>
+ #include <net/ethernet.h>     /* the L2 protocols */
+-#else
+-#include <asm/types.h>
+-#include <linux/if_packet.h>
+-#include <linux/if_ether.h>   /* The L2 protocols */
+-#endif
+ #endif  /* HAVE_PACKET_SOCKET */
+ 
+ #include "../include/libnet.h"

diff --git a/net-libs/libnet/files/libnet-1.2-_SOURCE.patch 
b/net-libs/libnet/files/libnet-1.2-_SOURCE.patch
new file mode 100644
index 0000000..d9c74f4
--- /dev/null
+++ b/net-libs/libnet/files/libnet-1.2-_SOURCE.patch
@@ -0,0 +1,20 @@
+--- a/configure.ac
++++ b/configure.ac
+@@ -157,14 +157,14 @@
+ case "$target_os" in
+ 
+ *linux*)
+-    AC_DEFINE(_BSD_SOURCE, 1,
++    AC_DEFINE(_DEFAULT_SOURCE, 1,
+         [Define as necessary to "unhide" header symbols.])
+-    AC_DEFINE(__BSD_SOURCE, 1,
++    AC_DEFINE(__DEFAULT_SOURCE, 1,
+         [Define as necessary to "unhide" header symbols.])
+     AC_DEFINE(__FAVOR_BSD, 1,
+         [Define if we should favor the BSD APIs when possible in Linux.])
+ 
+-    LIBNET_CONFIG_DEFINES="-D_BSD_SOURCE -D__BSD_SOURCE -D__FAVOR_BSD"
++    LIBNET_CONFIG_DEFINES="-D_DEFAULT_SOURCE -D__DEFAULT_SOURCE -D__FAVOR_BSD"
+     AC_CHECK_HEADERS(net/ethernet.h, \
+         LIBNET_CONFIG_DEFINES="$LIBNET_CONFIG_DEFINES -DHAVE_NET_ETHERNET_H")
+     ;;

diff --git a/net-libs/libnet/files/libnet-1.2-sizeof.patch 
b/net-libs/libnet/files/libnet-1.2-sizeof.patch
new file mode 100644
index 0000000..e06dbb5
--- /dev/null
+++ b/net-libs/libnet/files/libnet-1.2-sizeof.patch
@@ -0,0 +1,11 @@
+--- a/sample/sebek.c
++++ b/sample/sebek.c
+@@ -167,7 +167,7 @@
+ 
+     if (payload_flag)
+     {
+-      memset(cmd, 0, sizeof(cmd));
++      memset(cmd, 0, sizeof(*cmd));
+       memcpy(cmd, payload, (payload_s < 12 ? payload_s : 12));
+       length = payload_s;
+     }

diff --git a/net-libs/libnet/files/libnet-1.2-socklen_t.patch 
b/net-libs/libnet/files/libnet-1.2-socklen_t.patch
new file mode 100644
index 0000000..bce3670
--- /dev/null
+++ b/net-libs/libnet/files/libnet-1.2-socklen_t.patch
@@ -0,0 +1,11 @@
+--- a/src/libnet_raw.c
++++ b/src/libnet_raw.c
+@@ -77,7 +77,7 @@
+ #else
+       BOOL n;
+ #endif
+-    int len;
++    socklen_t len;
+ 
+ #ifdef SO_SNDBUF
+ 

diff --git a/net-libs/libnet/libnet-1.1.6-r1.ebuild 
b/net-libs/libnet/libnet-1.1.6-r1.ebuild
new file mode 100644
index 0000000..0144fd4
--- /dev/null
+++ b/net-libs/libnet/libnet-1.1.6-r1.ebuild
@@ -0,0 +1,51 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=6
+inherit autotools eutils
+
+DESCRIPTION="library providing an API for commonly used low-level network 
functions"
+HOMEPAGE="http://libnet-dev.sourceforge.net/";
+SRC_URI="mirror://sourceforge/project/${PN}-dev/${P}.tar.gz"
+
+LICENSE="BSD BSD-2 HPND"
+SLOT="1.1"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 
~sh ~sparc ~x86 ~x86-fbsd ~x86-freebsd ~amd64-linux ~arm-linux ~x86-linux 
~ppc-macos ~x64-macos ~x86-macos"
+IUSE="doc static-libs"
+
+DEPEND="sys-devel/autoconf"
+
+DOCS=(
+       README doc/{CHANGELOG,CONTRIB,DESIGN_NOTES,MIGRATION}
+       doc/{PACKET_BUILDING,PORTED,RAWSOCKET_NON_SEQUITUR,TODO}
+)
+PATCHES=(
+       "${FILESDIR}"/${PN}-1.1.6-_SOURCE.patch
+       "${FILESDIR}"/${PN}-1.1.6-musl.patch
+       "${FILESDIR}"/${PN}-1.2-sizeof.patch
+)
+
+src_prepare() {
+       default
+
+       mv configure{.in,.ac} || die
+       eautoreconf
+}
+
+src_configure() {
+       econf $(use_enable static-libs static)
+}
+
+src_install() {
+       default
+
+       if use doc ; then
+               dodoc -r doc/html
+
+               docinto sample
+               dodoc sample/*.[ch]
+       fi
+
+       prune_libtool_files
+}

diff --git a/net-libs/libnet/libnet-1.2_rc3-r1.ebuild 
b/net-libs/libnet/libnet-1.2_rc3-r1.ebuild
new file mode 100644
index 0000000..305d02d
--- /dev/null
+++ b/net-libs/libnet/libnet-1.2_rc3-r1.ebuild
@@ -0,0 +1,51 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=6
+inherit autotools eutils
+
+DESCRIPTION="library providing an API for commonly used low-level network 
functions"
+HOMEPAGE="http://libnet-dev.sourceforge.net/";
+SRC_URI="mirror://sourceforge/project/${PN}-dev/${P/_/-}.tar.gz"
+
+LICENSE="BSD BSD-2 HPND"
+SLOT="1.1"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 
~sh ~sparc ~x86 ~x86-fbsd ~x86-freebsd ~amd64-linux ~arm-linux ~x86-linux 
~ppc-macos ~x64-macos ~x86-macos"
+IUSE="doc static-libs"
+
+DOCS=(
+       README doc/{CHANGELOG,CONTRIB,DESIGN_NOTES,MIGRATION}
+       doc/{PACKET_BUILDING,PORTED,RAWSOCKET_NON_SEQUITUR,TODO}
+)
+
+S=${WORKDIR}/${P/_/-}
+PATCHES=(
+       "${FILESDIR}"/${PN}-1.1.6-musl.patch
+       "${FILESDIR}"/${PN}-1.2-_SOURCE.patch
+       "${FILESDIR}"/${PN}-1.2-rc.patch
+       "${FILESDIR}"/${PN}-1.2-sizeof.patch
+       "${FILESDIR}"/${PN}-1.2-socklen_t.patch
+)
+
+src_prepare() {
+       default
+
+       eautoreconf
+}
+src_configure() {
+       econf $(use_enable static-libs static)
+}
+
+src_install() {
+       default
+
+       if use doc ; then
+               docinto html
+               dodoc -r doc/html/*
+               docinto sample
+               dodoc sample/*.[ch]
+       fi
+
+       prune_libtool_files
+}

Reply via email to