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/"
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
"
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
}