summaryrefslogtreecommitdiff
path: root/net/tcpdump/Makefile
blob: 70548add5aeb0d45fa1b14395ddc8d17c9108012 (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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# New ports collection makefile for:	tcpdump
# Date created:		10 December 2003
# Whom:			Bruce M Simpson <bms@FreeBSD.org>
#
# $FreeBSD$
#

PORTNAME=	tcpdump
PORTVERSION=	3.8.3
PORTREVISION=	2
CATEGORIES=	net
MASTER_SITES=	http://www.tcpdump.org/release/
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)
LIB_DEPENDS=	pcap.2:${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=	${PREFIX}/share
CONFIGURE_ARGS+=--mandir=${MANPREFIX}/man
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.
# WITH_RADIOTAP		Build with support for BSD 802.11 Radiotap headers.
# WITH_TCPMD5		Build with support for TCP-MD5 digest verification.
#
# Defaults:	WITHOUT_LIBPCAP_PORT WITHOUT_RADIOTAP WITHOUT_TCPMD5
#		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 crypto is requested, then apply a patch to fix the detection
# of OpenSSL versions > 0.9.7d. We assume the installed version is
# at least this recent; this may fail on older systems.
#
.if defined(WITHOUT_CRYPTO)
CONFIGURE_ARGS+=	--without-crypto
.else
USE_OPENSSL=		defined
USE_AUTOTOOLS=		autoconf:253
EXTRA_PATCHES+=		${PATCHDIR}/extra-patch-openssl-configure.in
.endif

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

.if defined(WITH_RADIOTAP)
EXTRA_PATCHES+=	${PATCHDIR}/extra-patch-extract.h \
		${PATCHDIR}/extra-patch-ieee802_11_radio.h \
		${PATCHDIR}/extra-patch-print-802_11.c
.endif

.if defined(WITH_TCPMD5)
.if defined(WITHOUT_CRYPTO)
BROKEN=		"The use of WITH_TCPMD5 requires crypto support."
.else
EXTRA_PATCHES+=	${PATCHDIR}/extra-patch-tcpmd5-print-tcp.c \
		${PATCHDIR}/extra-patch-tcpmd5-tcp.h
.endif
.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.8.3

.include <bsd.port.pre.mk>

.if ${OSVERSION} >= 503000 && !defined(TCPDUMP_OVERWRITE_BASE)
IGNORE=		Already in base system
.endif

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