commit:     bfd0d5d8b0839284b65841332be32b99e6b84441
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Mon Jul  4 12:24:02 2016 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Mon Jul  4 12:25:00 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bfd0d5d8

net-analyzer/openbsd-netcat: undo Linuxification on Darwin

Package-Manager: portage-2.2.28

 .../openbsd-netcat/openbsd-netcat-1.105-r1.ebuild         | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/net-analyzer/openbsd-netcat/openbsd-netcat-1.105-r1.ebuild 
b/net-analyzer/openbsd-netcat/openbsd-netcat-1.105-r1.ebuild
index c4d9efa..f20c5c3 100644
--- a/net-analyzer/openbsd-netcat/openbsd-netcat-1.105-r1.ebuild
+++ b/net-analyzer/openbsd-netcat/openbsd-netcat-1.105-r1.ebuild
@@ -4,7 +4,7 @@
 
 EAPI=6
 
-inherit toolchain-funcs
+inherit toolchain-funcs flag-o-matic
 
 DESCRIPTION="The OpenBSD network swiss army knife"
 HOMEPAGE="http://www.openbsd.org/cgi-bin/cvsweb/src/usr.bin/nc/";
@@ -12,11 +12,12 @@ 
SRC_URI="http://http.debian.net/debian/pool/main/n/netcat-openbsd/netcat-openbsd
        
http://http.debian.net/debian/pool/main/n/netcat-openbsd/netcat-openbsd_${PV}-7.debian.tar.gz";
 LICENSE="BSD"
 SLOT="0"
+IUSE="elibc_Darwin"
 
 KEYWORDS="~amd64 ~x86 ~amd64-linux ~x64-macos"
 
 DEPEND="virtual/pkgconfig"
-RDEPEND="dev-libs/libbsd
+RDEPEND="!elibc_Darwin? ( dev-libs/libbsd )
        !net-analyzer/netcat
        !net-analyzer/netcat6
 "
@@ -25,6 +26,16 @@ S=${WORKDIR}/netcat-openbsd-${PV}
 
 PATCHES=( "${WORKDIR}/debian/patches" )
 
+src_prepare() {
+       default
+       if [[ ${CHOST} == *-darwin* ]] ; then
+               # Darwin = BSD, so remove libbsd dependency
+               sed -i -e '/#include/s|bsd/||' -e 's/strtonum/strtoimax/' 
*.[ch] || die
+               # Clang defaults to C99, but strtoimax isn't in C99
+               append-flags -DIPTOS_LOWCOST=0x02 -std=c89
+       fi
+}
+
 src_compile() {
        emake CC=$(tc-getCC) CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}" || die
 }

Reply via email to