aboutsummaryrefslogtreecommitdiff
path: root/net/tcpdump/Makefile
blob: bf0d90caa3ea227769c995fb8a24c731f8dbb3b9 (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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# New ports collection makefile for:	tcpdump
# Date created:		10 December 2003
# Whom:			Bruce M Simpson <bms@FreeBSD.org>
#
# $FreeBSD$
#

PORTNAME=	tcpdump
PORTVERSION=	3.9.7
CATEGORIES=	net ipv6
MASTER_SITES=	http://www.tcpdump.org/release/ \
		http://www.icrew.org/mirror/tcp_dump/tcpdump_3_9/
DISTNAME=	${PORTNAME}-${PORTVERSION}

MAINTAINER=	bms@FreeBSD.org
COMMENT=	Ubiquitous network traffic analysis tool

# TODO: Add strict sanity check that we're compiling against a
# version of libpcap with which this tcpdump release is compatible.
#
.if defined(TCPDUMP_OVERWRITE_BASE) || !defined(WITH_LIBPCAP_BASE)
BUILD_DEPENDS=	${LOCALBASE}/lib/libpcap.a:${PORTSDIR}/net/libpcap
.endif

WRKSRC=		${WRKDIR}/${PORTNAME}-${PORTVERSION}

MAN1=		tcpdump.1

GNU_CONFIGURE=		yes

.if defined(TCPDUMP_OVERWRITE_BASE)
PREFIX=		/usr
PKGNAMESUFFIX=	-overwrite-base
MANPREFIX=	${TARGETDIR}/share
PLIST_SUB+=	NOTBASE="@comment "
PLIST_SUB+=	BASE=""
PKGMESSAGE=	${FILESDIR}/pkg-message-base
.else
PLIST_SUB+=	BASE="@comment "
PLIST_SUB+=	NOTBASE=""
.endif

# Compilation Options
#
# Special options:
# TCPDUMP_OVERWRITE_BASE	Overwrite the base system's tcpdump binary.
#				Implies the use of the libpcap port.
#
# User-definable switches:
# WITHOUT_CRYPTO	Build without IPSEC or TCPMD5 decryption.
# WITHOUT_IPV6		Build without IPV6 support.
# WITH_LIBPCAP_BASE	Use libpcap from the base system instead of ports.
#
# Defaults:	WITHOUT_LIBPCAP_BASE WITH_CRYPTO WITH_IPV6

# The --without-crypto flag needs to be explicitly specified. The
# configure script gets confused if you specify --with-crypto and
# thinks this means you *don't* want crypto.
#
.if defined(WITHOUT_CRYPTO)
CONFIGURE_ARGS+=	--without-crypto
.else
USE_OPENSSL=		defined
.endif

.if !defined(WITHOUT_IPV6)
CONFIGURE_ARGS+=	--enable-ipv6
.endif

# When compiling against the port, it's necessary to force the
# port to look for libpcap in ${LOCALPCAPBASE} first, for both
# the configure and build steps.
#
.if defined(TCPDUMP_OVERWRITE_BASE) || !defined(WITH_LIBPCAP_BASE)
LOCALPCAPBASE=	${LOCALBASE}
CONFIGURE_ENV+=	CFLAGS="-L${LOCALPCAPBASE}/lib"
.else
LOCALPCAPBASE=	/usr
.endif

LOCALPCAPFILES=	include/pcap.h include/pcap-namedb.h include/pcap-bpf.h \
		lib/libpcap.a
WRKPCAPDIR=	${WRKDIR}/libpcap-0.9.7

.include <bsd.port.pre.mk>

# When building tcpdump against a particular pcap version, it expects to
# find a built, untarred source tree in the parent of the work tree.
# Build a symlink farm which points to the installed versions of the
# required files, in order to produce the files it wants without
# requiring that the libpcap distfile be untarred.
#
pre-configure:
	${MKDIR} ${WRKPCAPDIR}
.for i in ${LOCALPCAPFILES}
	${LN} -s ${LOCALPCAPBASE}/$i ${WRKPCAPDIR}
.endfor

.if defined(TCPDUMP_OVERWRITE_BASE)
post-install:
	${CAT} ${PKGMESSAGE}
.endif

.include <bsd.port.post.mk>