summaryrefslogtreecommitdiff
path: root/net-analyzer/netsniff-ng/netsniff-ng-0.6.9.ebuild
blob: 51a0c4acc9791bc6870fec67e35beaefe5af3461 (plain)
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
# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit toolchain-funcs

DESCRIPTION="high performance network sniffer for packet inspection"
HOMEPAGE="http://netsniff-ng.org/"
if [[ "${PV}" == *9999 ]] ; then
	inherit git-r3
	EGIT_REPO_URI="https://github.com/borkmann/${PN}.git"
else
	SRC_URI="http://pub.${PN}.org/${PN}/${P}.tar.xz"
	KEYWORDS="~amd64"
fi

LICENSE="GPL-2"
SLOT="0"
IUSE="debug geoip zlib"

RDEPEND="
	dev-libs/libcli:=
	dev-libs/libnl:3
	dev-libs/userspace-rcu:=
	net-libs/libnet:1.1
	net-libs/libnetfilter_conntrack
	net-libs/libpcap
	dev-libs/libsodium:=
	sys-libs/ncurses:0=
	geoip? ( dev-libs/geoip )
	zlib? ( virtual/zlib:= )
"
DEPEND="${RDEPEND}"
BDEPEND="
	app-alternatives/lex
	sys-devel/bison
	virtual/pkgconfig
"

PATCHES=(
	"${FILESDIR}/netsniff-ng-0.6.9-gcc-15.patch"
)

src_prepare() {
	default

	# force mausezahn to respect CFLAGS
	sed -e '/CFLAGS/s:=:+=:' -i Extra || die
	sed -e 's/ -O2//' -i mausezahn/Makefile || die

	# do not compress man pages by default
	sed \
		-e '/gzip/s@\$(Q).*$@$(Q)cp $(1).8 $(1)/$(1).8@' \
		-e 's@\.8\.gz@.8@' \
		-i Template || die
}

src_configure() {
	local myconfargs=(
		--prefix="${EPREFIX}/usr"
		--sysconfdir="${EPREFIX}/etc"
		$(usex debug --enable-debug '')
		$(usex geoip '' --disable-geoip)
		$(usex zlib '' --disable-zlib)
	)
	# not an autoconf generated configure
	./configure "${myconfargs[@]}" || die
}

src_compile() {
	emake CC="$(tc-getCC)" LD="$(tc-getCC)" CCACHE="" Q=
}

src_install() {
	emake PREFIX="${ED}/usr" ETCDIR="${ED}/etc" install

	dodoc AUTHORS README REPORTING-BUGS
}