aboutsummaryrefslogtreecommitdiffstats
path: root/net/py-pcap/Makefile
blob: a567f4e5d3c054a32801826c7cda2e5f0cf1a9f2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# New ports collection makefile for:    py-pcap
# Date created:     24 Nov 2001
# Whom:         Hye-Shik Chang <perky@fallin.lv>
#
# $FreeBSD$
#

PORTNAME=   pcap
PORTVERSION=    0.2
CATEGORIES= net python
MASTER_SITES=   ${MASTER_SITE_SOURCEFORGE}
MASTER_SITE_SUBDIR= pylibpcap
PKGNAMEPREFIX=  ${PYTHON_PKGNAMEPREFIX}
DISTNAME=   pylibpcap-${PORTVERSION}
DIST_SUBDIR=    python

MAINTAINER= perky@fallin.lv

BUILD_DEPENDS=  ${SWIG_CMD}:${PORTSDIR}/devel/SWIG

EXAMPLESDIR=    ${PREFIX}/share/examples/${PKGNAMEPREFIX}${PORTNAME}
PLIST_SUB=  PYTHON_SITELIBDIR=${PYTHON_SITELIBDIR:S|^${LOCALBASE}/||g}
SWIG_CMD?=  ${LOCALBASE}/bin/swig
WRKSRC=     ${WRKDIR}/pylibpcap
USE_PYTHON= yes

post-patch:
    ${SED} -e 's|^\(PYTHON_INCLUDES=\).*|\1-I${PYTHON_INCLUDEDIR}|g' \
        -e 's|^\(SWIG=\).*|\1${SWIG_CMD}|g' \
        ${WRKSRC}/Makefile > ${WRKSRC}/Makefile.temp && \
        ${MV} -f ${WRKSRC}/Makefile.temp ${WRKSRC}/Makefile
    ${SED} -e 's|pcap/pcap\.h|pcap.h|g' \
        ${WRKSRC}/pypcap.h > ${WRKSRC}/pypcap.h.temp && \
        ${MV} -f ${WRKSRC}/pypcap.h.temp ${WRKSRC}/pypcap.h

post-build:
    ${PYTHON_CMD} ${PYTHON_LIBDIR}/compileall.py ${WRKSRC}
    ${PYTHON_CMD} -O ${PYTHON_LIBDIR}/compileall.py ${WRKSRC}

do-install:
.for f in pcapcmodule.so pcap.py pcap.pyc pcap.pyo
    ${INSTALL_DATA} ${WRKSRC}/$f ${PYTHON_SITELIBDIR}
.endfor
.if !defined(NOPORTDOCS)
    @${MKDIR} ${EXAMPLESDIR}
    ${INSTALL_SCRIPT} ${WRKSRC}/sniff.py ${EXAMPLESDIR}
.endif

.include <bsd.port.mk>