aboutsummaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorRong-En Fan <rafan@FreeBSD.org>2008-05-01 13:49:40 +0000
committerRong-En Fan <rafan@FreeBSD.org>2008-05-01 13:49:40 +0000
commitba2f8cc95082b7da41366c54e9daa44715e518c9 (patch)
treed4ea78ec836e9c038ce465cb17c365fdfb87195c /net
parent782d64f5f513c55ded04af0755b94208fbe8ba63 (diff)
downloadports-ba2f8cc95082b7da41366c54e9daa44715e518c9.tar.gz
ports-ba2f8cc95082b7da41366c54e9daa44715e518c9.zip
Notes
Diffstat (limited to 'net')
-rw-r--r--net/py-libnet/Makefile17
-rw-r--r--net/py-libnet/files/patch-libnet.i66
2 files changed, 77 insertions, 6 deletions
diff --git a/net/py-libnet/Makefile b/net/py-libnet/Makefile
index b482f9ebeeda..f3767288b724 100644
--- a/net/py-libnet/Makefile
+++ b/net/py-libnet/Makefile
@@ -8,7 +8,7 @@
PORTNAME= libnet
PORTVERSION= 1.0
-PORTREVISION= 3
+PORTREVISION= 4
CATEGORIES= net python
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
MASTER_SITE_SUBDIR= pylibnet
@@ -18,13 +18,13 @@ DISTNAME= pylibnet-${PORTVERSION}
MAINTAINER= ports@FreeBSD.org
COMMENT= Python module for the libnet packet construction library
-BUILD_DEPENDS= ${LOCALBASE}/bin/swig1.1:${PORTSDIR}/devel/swig11 \
+BUILD_DEPENDS= ${LOCALBASE}/bin/swig1.3:${PORTSDIR}/devel/swig13 \
${LIBNET_CONFIG}:${PORTSDIR}/net/libnet10
USE_PYTHON= yes
WRKSRC= ${WRKDIR}/${DISTNAME}/src
-MAKE_ARGS= SWIG=${LOCALBASE}/bin/swig1.1 \
+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" \
@@ -32,18 +32,23 @@ MAKE_ARGS= SWIG=${LOCALBASE}/bin/swig1.1 \
CC=${CC}
PLIST_FILES= lib/%%PYTHON_VERSION%%/site-packages/libnet.py \
- lib/%%PYTHON_VERSION%%/site-packages/libnetcmodule.so
+ lib/%%PYTHON_VERSION%%/site-packages/_libnetc.so
LIBNET_CONFIG?= ${LOCALBASE}/bin/libnet10-config
.include <bsd.port.pre.mk>
.if ${ARCH} == "amd64"
-BROKEN= "Does not compile on amd64 (tries to link non-PIC libnet.a into PIC shared library)"
+BROKEN= Does not compile on amd64 (tries to link non-PIC libnet.a into PIC shared library)
.endif
+post-patch:
+ ${REINPLACE_CMD} -e 's,libnetcmodule.so,_libnetc.so,g' ${WRKSRC}/Makefile
+ ${REINPLACE_CMD} -e 's,^const ,%constant ,' ${WRKSRC}/constants.i
+ ${REINPLACE_CMD} -e '/^[^#]/s,libnet,_libnet,' ${WRKSRC}/libnet.py
+
do-install:
-.for file in libnet.py libnetcmodule.so
+.for file in libnet.py _libnetc.so
${INSTALL_DATA} ${WRKSRC}/${file} ${PYTHON_SITELIBDIR}
.endfor
diff --git a/net/py-libnet/files/patch-libnet.i b/net/py-libnet/files/patch-libnet.i
new file mode 100644
index 000000000000..f84200981f1a
--- /dev/null
+++ b/net/py-libnet/files/patch-libnet.i
@@ -0,0 +1,66 @@
+--- ./libnet.i.orig 2008-05-01 18:08:06.000000000 +0800
++++ ./libnet.i 2008-05-01 18:08:30.000000000 +0800
+@@ -41,7 +41,7 @@
+
+ %}
+
+-%except (python) {
++%exception {
+ int err;
+ clear_exception();
+ PyErr_Clear();
+@@ -58,41 +58,41 @@
+
+ /* typemaps */
+
+-%typemap(python, in) u_char *{
+- if (!($target=PyString_AsString($source))) {
++%typemap(in) u_char *{
++ if (!($1=PyString_AsString($input))) {
+ PyErr_SetString(PyExc_TypeError,"expected a string");
+ return NULL;
+ }
+ }
+
+-%typemap(python, out) u_char *{
+- $target=PyString_FromString($source);
++%typemap(out) u_char *{
++ $result=PyString_FromString($1);
+ }
+
+-%typemap(python, in) u_long {
+- $target=PyLong_AsUnsignedLong($source);
++%typemap(in) u_long {
++ $1=PyLong_AsUnsignedLong($input);
+ }
+
+-%typemap(python, out) u_long {
+- $target=PyLong_FromUnsignedLong($source);
++%typemap(out) u_long {
++ $result=PyLong_FromUnsignedLong($1);
+ }
+
+
+ /* let functions return raw python objects */
+-%typemap(python, out) PyObject * {
+- $target = $source;
++%typemap(out) PyObject * {
++ $result = $1;
+ }
+
+ /* let functions take raw python objects */
+-%typemap(python, in) PyObject * {
+- $target = $source;
++%typemap(in) PyObject * {
++ $1 = $input;
+ }
+
+ typedef struct {
+ struct libnet_link_int *link;
+ int fd;
+ char *device;
+- %addmethods {
++ %extend {
+ interface();
+ ~interface();
+ void open_link(char *device);