diff --git a/net/py-libnet/Makefile b/net/py-libnet/Makefile index 0273d691bbb1..bc424a94abe1 100644 --- a/net/py-libnet/Makefile +++ b/net/py-libnet/Makefile @@ -5,55 +5,40 @@ PORTNAME= libnet PORTVERSION= 1.1 PORTREVISION= 1 CATEGORIES= net python -MASTER_SITES= SF/py${PORTNAME}/py${PORTNAME}/py${PORTNAME}-${PORTVERSION} PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} -DISTNAME= pylibnet-${PORTVERSION} MAINTAINER= sbz@FreeBSD.org COMMENT= Python module for the libnet packet construction library -BUILD_DEPENDS= ${LOCALBASE}/bin/swig1.3:${PORTSDIR}/devel/swig13 \ - ${LIBNET_CONFIG}:${PORTSDIR}/net/libnet10 +LICENSE= GPLv3 + +LIB_DEPENDS= libnet.so:${PORTSDIR}/net/libnet USE_PYTHON= yes -WRKSRC= ${WRKDIR}/${DISTNAME}/src -WRKEXAMPLE= ${WRKDIR}/${DISTNAME}/samples +USE_PYTHON_PREFIX= yes +USE_PYDISTUTILS= yes -MAKE_ARGS= SWIG=${LOCALBASE}/bin/swig1.3 \ - LIBNET_INCLUDES=-I${LOCALBASE}/include \ - PYTHON_INCLUDES=-I${PYTHON_INCLUDEDIR} \ - CFLAGS="${CFLAGS} `${LIBNET_CONFIG} --defines` `${LIBNET_CONFIG} --cflags` -fPIC" \ - LIBNET_LIB="`${LIBNET_CONFIG} --libs`" \ - CC=${CC} +USE_GITHUB= yes +GH_ACCOUNT= allfro +GH_PROJECT= pylibnet +GH_TAGNAME= ${GH_COMMIT} +GH_COMMIT= b2fa552 -LIBNET_CONFIG?= ${LOCALBASE}/bin/libnet10-config - -EXAMPLESFILES= test-libnet-icmp-echo-req.py test-libnet-tcp-syn.py test-libnet-arp-req.py EXAMPLESDIR= ${PREFIX}/share/examples/py-${PORTNAME} -NO_STAGE= yes -.include +OPTIONS_DEFINE= EXAMPLES +OSVER= uname -r -.if ${ARCH} == "amd64" -BROKEN= Does not compile on amd64 (tries to link non-PIC libnet.a into PIC shared library) -.endif - -post-patch: - ${REINPLACE_CMD} -e 's,^const ,%constant ,' ${WRKSRC}/constants.i - -post-build: - ${PYTHON_CMD} -m compileall ${WRKSRC} - ${PYTHON_CMD} -O -m compileall ${WRKSRC} +.include do-install: -.for f in libnet.py libnet.pyc libnet.pyo _libnet.so - ${INSTALL_DATA} ${WRKSRC}/${f} ${PYTHON_SITELIBDIR} -.endfor -.if !defined(NOPORTEXAMPLES) - ${MKDIR} ${EXAMPLESDIR} -.for f in ${EXAMPLESFILES} - ${INSTALL_DATA} ${WRKEXAMPLE}/${f} ${EXAMPLESDIR} -.endfor + ${MKDIR} ${STAGEDIR}${PYTHON_SITELIBDIR} + ${INSTALL_DATA} \ + ${WRKSRC}/build/lib.${OPSYS:tl}-$$(${OSVER})-${ARCH}-${PYTHON_VER}/${PORTNAME}.so \ + ${STAGEDIR}${PYTHON_SITELIBDIR} +.if ${PORT_OPTIONS:MEXAMPLES} + ${MKDIR} ${STAGEDIR}${EXAMPLESDIR} + (cd ${WRKSRC}/examples && ${COPYTREE_SHARE} . ${STAGEDIR}${EXAMPLESDIR}) .endif -.include +.include diff --git a/net/py-libnet/distinfo b/net/py-libnet/distinfo index ccf59267aea8..b47bbd13fb6a 100644 --- a/net/py-libnet/distinfo +++ b/net/py-libnet/distinfo @@ -1,2 +1,2 @@ -SHA256 (pylibnet-1.1.tar.gz) = 8675e50cd8b3aaf111044e69a1428994d902af619a1770e040caa279ef5b5a77 -SIZE (pylibnet-1.1.tar.gz) = 16957 +SHA256 (libnet-1.1.tar.gz) = c15d52f3782b92e799b6cc24d4999a0ee276afe5f9e8d596f08c59debdabc1d2 +SIZE (libnet-1.1.tar.gz) = 73785 diff --git a/net/py-libnet/files/patch-setup.py b/net/py-libnet/files/patch-setup.py new file mode 100644 index 000000000000..e4d8d0fc4963 --- /dev/null +++ b/net/py-libnet/files/patch-setup.py @@ -0,0 +1,13 @@ +--- ./setup.py.orig 2011-08-02 17:53:25.000000000 +0200 ++++ ./setup.py 2014-05-30 12:55:01.000000000 +0200 +@@ -5,8 +5,8 @@ + import os + import sys + +-include_dir = None +-lib_dir = None ++include_dir = '/usr/local/include/libnet11/' ++lib_dir = '/usr/local/lib/libnet11' + + + package_version = '3.0-beta-rc1' diff --git a/net/py-libnet/files/patch-src__builders.c b/net/py-libnet/files/patch-src__builders.c new file mode 100644 index 000000000000..4b49fd685f3d --- /dev/null +++ b/net/py-libnet/files/patch-src__builders.c @@ -0,0 +1,15 @@ +--- ./src/builders.c.orig 2014-05-30 12:55:10.000000000 +0200 ++++ ./src/builders.c 2014-05-30 13:00:15.000000000 +0200 +@@ -722,9 +722,9 @@ + u_int16_t sum = 0; + u_int16_t id = PYLIBNET_RANDOM_U16; + u_int16_t seq = PYLIBNET_RANDOM_U16; +- n_time otime = PYLIBNET_RANDOM_U32; +- n_time rtime = PYLIBNET_RANDOM_U32; +- n_time ttime = PYLIBNET_RANDOM_U32; ++ u_int32_t otime = PYLIBNET_RANDOM_U32; ++ u_int32_t rtime = PYLIBNET_RANDOM_U32; ++ u_int32_t ttime = PYLIBNET_RANDOM_U32; + u_int8_t *payload = NULL; + u_int32_t payload_s = 0; + libnet_ptag_t ptag = 0; diff --git a/net/py-libnet/pkg-plist b/net/py-libnet/pkg-plist index cbe9b2b5077f..58e69920fd48 100644 --- a/net/py-libnet/pkg-plist +++ b/net/py-libnet/pkg-plist @@ -1,8 +1,9 @@ -%%PYTHON_SITELIBDIR%%/_libnet.so -%%PYTHON_SITELIBDIR%%/libnet.py -%%PYTHON_SITELIBDIR%%/libnet.pyc -%%PYTHON_SITELIBDIR%%/libnet.pyo -%%PORTEXAMPLES%%%%EXAMPLESDIR%%/test-libnet-arp-req.py -%%PORTEXAMPLES%%%%EXAMPLESDIR%%/test-libnet-icmp-echo-req.py -%%PORTEXAMPLES%%%%EXAMPLESDIR%%/test-libnet-tcp-syn.py -%%PORTEXAMPLES%%@dirrm %%EXAMPLESDIR%% +%%PYTHON_SITELIBDIR%%/libnet.so +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/README +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/dnsv4.py +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/icmp4echo.py +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/lnsh/dnsv4.libnet +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/lnsh/tcpsyn.libnet +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/lnsh/tcpxmas.libnet +%%PORTEXAMPLES%%@dirrmtry %%EXAMPLESDIR%%/lnsh +%%PORTEXAMPLES%%@dirrmtry %%EXAMPLESDIR%%