1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-22 00:35:15 +00:00

- Support STAGEDIR

- Add LICENSE
- Fix build for amd64
This commit is contained in:
Sofian Brabez 2014-05-30 14:08:43 +00:00
parent 18ff234473
commit c113e1c847
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=355842
5 changed files with 60 additions and 46 deletions

View File

@ -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 <bsd.port.pre.mk>
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 <bsd.port.options.mk>
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 <bsd.port.post.mk>
.include <bsd.port.mk>

View File

@ -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

View File

@ -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'

View File

@ -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;

View File

@ -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%%