net-analyzer/sngrep: Fix building against sys-libs/musl
authorJeroen Roovers <jer@gentoo.org>
Sun, 29 Mar 2020 12:19:34 +0000 (14:19 +0200)
committerJeroen Roovers <jer@gentoo.org>
Sun, 29 Mar 2020 12:24:04 +0000 (14:24 +0200)
See also:
https://github.com/irontec/sngrep/commit/604f6d0ce2ec42ac494d76c95e68850ea6e7da8f

Package-Manager: Portage-2.3.96, Repoman-2.3.22
Closes: https://bugs.gentoo.org/715256
Signed-off-by: Jeroen Roovers <jer@gentoo.org>
net-analyzer/sngrep/files/sngrep-1.4.6-stdin.patch [new file with mode: 0644]
net-analyzer/sngrep/sngrep-1.4.6-r2.ebuild [new file with mode: 0644]

diff --git a/net-analyzer/sngrep/files/sngrep-1.4.6-stdin.patch b/net-analyzer/sngrep/files/sngrep-1.4.6-stdin.patch
new file mode 100644 (file)
index 0000000..b61025d
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/src/capture.c
++++ b/src/capture.c
+@@ -191,7 +191,7 @@
+     // Reopen tty for ncurses after pcap have used stdin
+     if (!strncmp(infile, "/dev/stdin", 10)) {
+-        if (!(stdin = freopen("/dev/tty", "r", stdin))) {
++        if (!(fstdin = freopen("/dev/tty", "r", stdin))) {
+             fprintf(stderr, "Failed to reopen tty while using stdin for capture.");
+             return 1;
+         }
diff --git a/net-analyzer/sngrep/sngrep-1.4.6-r2.ebuild b/net-analyzer/sngrep/sngrep-1.4.6-r2.ebuild
new file mode 100644 (file)
index 0000000..011fb09
--- /dev/null
@@ -0,0 +1,44 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+inherit autotools
+
+DESCRIPTION="Ncurses SIP Messages flow viewer"
+HOMEPAGE="https://github.com/irontec/sngrep"
+SRC_URI="https://github.com/irontec/sngrep/releases/download/v${PV}/${P}.tar.gz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="eep gnutls ipv6 openssl pcre unicode"
+REQUIRED_USE="
+       gnutls? ( !openssl )
+"
+
+DEPEND="
+       net-libs/libpcap
+       sys-libs/ncurses:0=[unicode?]
+       openssl? ( dev-libs/openssl:0= )
+       gnutls? ( net-libs/gnutls )
+"
+RDEPEND="${DEPEND}"
+PATCHES=(
+       "${FILESDIR}"/${PN}-1.4.5-tinfo.patch
+       "${FILESDIR}"/${PN}-1.4.6-stdin.patch
+)
+
+src_prepare() {
+       default
+       eautoreconf
+}
+
+src_configure() {
+       econf \
+               $(use_enable eep) \
+               $(use_enable ipv6) \
+               $(use_enable unicode) \
+               $(use_with gnutls) \
+               $(use_with openssl) \
+               $(use_with pcre)
+}