commit:     af29dcb2b47e85cdc8972592bfe5d12b4da714b8
Author:     Jeroen Roovers <jer <AT> gentoo <DOT> org>
AuthorDate: Wed Jul 15 06:50:04 2020 +0000
Commit:     Jeroen Roovers <jer <AT> gentoo <DOT> org>
CommitDate: Wed Jul 15 06:50:31 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=af29dcb2

net-analyzer/tracebox: Version 0.4.4

Package-Manager: Portage-2.3.103, Repoman-2.3.23
Closes: https://bugs.gentoo.org/732390
Signed-off-by: Jeroen Roovers <jer <AT> gentoo.org>

 net-analyzer/tracebox/Manifest                     |   1 +
 .../tracebox/files/tracebox-0.4.4-deps.patch       | 156 +++++++++++++++++++++
 net-analyzer/tracebox/metadata.xml                 |  18 ++-
 net-analyzer/tracebox/tracebox-0.4.4.ebuild        |  62 ++++++++
 4 files changed, 230 insertions(+), 7 deletions(-)

diff --git a/net-analyzer/tracebox/Manifest b/net-analyzer/tracebox/Manifest
index 8d01e9c4c25..db071542f40 100644
--- a/net-analyzer/tracebox/Manifest
+++ b/net-analyzer/tracebox/Manifest
@@ -1 +1,2 @@
 DIST tracebox-0.2.tar.gz 27954 BLAKE2B 
57f4e36c727ebbb19161a6b4c887b64fdd362b033e09116f2e602a01737f19f10e6d0378296e70f683a5b8d53a57dae032e67098dd5989bb094daf3a3382a5d5
 SHA512 
15bfaede7e4828c14efbf7395f3d1c681b672b47157c370f4fe92d5d306ccc8e3e061107c3d36a505d732451d67ea146c21c299e6e826205725ab12680ee773e
+DIST tracebox-0.4.4.tar.gz 76828 BLAKE2B 
0c3fbe9ea3fd5a967c85cf7b175900d899885f6c43ca8ffa32ba98256490b5bc23e8f80618208df6ec05f0484e5ce27599528aa5d84e331ac71eca960b6b1fd0
 SHA512 
2113d6ed4543b0c3a9b44bc92c4eb8ab2a860b4409a5eba374b9960ddb4ba299a33c0dea49595c94bc725eda36633d8bb698236d662ea9cc1027070b597c52f6

diff --git a/net-analyzer/tracebox/files/tracebox-0.4.4-deps.patch 
b/net-analyzer/tracebox/files/tracebox-0.4.4-deps.patch
new file mode 100644
index 00000000000..cb47ad0d2ac
--- /dev/null
+++ b/net-analyzer/tracebox/files/tracebox-0.4.4-deps.patch
@@ -0,0 +1,156 @@
+--- a/configure.ac
++++ b/configure.ac
+@@ -14,6 +14,8 @@
+ AC_HEADER_STDC
+ AC_HEADER_ASSERT
+ 
++PKG_PROG_PKG_CONFIG
++
+ AX_CXX_COMPILE_STDCXX_11
+ 
+ # Checks for header files.
+@@ -32,40 +34,13 @@
+ AC_FUNC_FORK
+ AC_CHECK_FUNCS([gettimeofday memset select socket strtol])
+ 
+-AC_ARG_WITH(lua,
+-[  --with-lua=DIR      use lua in DIR],
+-[ case "$withval" in
+-  yes|no)
+-     AC_MSG_RESULT(no)
+-     ;;
+-  *)
+-     AC_MSG_RESULT($withval)
+-     if test -f $withval/lua.h -a -f $withval/liblua.a; then
+-        owd=`pwd`
+-        if cd $withval; then withval=`pwd`; cd $owd; fi
+-        LUA_INCLUDE="-I$withval"
+-        LUA_LIB="-L$withval -llua"
+-        LIBS="$LIBS -lm"
+-     elif test -f $withval/include/lua.h -a -f $withval/lib/liblua.a; then
+-        owd=`pwd`
+-        if cd $withval; then withval=`pwd`; cd $owd; fi
+-        LUA_INCLUDE="-I$withval/include"
+-        LUA_LIB="-L$withval/lib -llua"
+-        LIBS="$LIBS -lm"
+-     else
+-        AC_ERROR("lua.h or liblua.a not found in $withval")
+-     fi
+-     ;;
+-  esac ],
+-    [
+-        AX_PROG_LUA
+-        AX_LUA_HEADERS
+-        AX_LUA_LIBS
+-        if test x"$LUA_LIB" = x; then
+-            AC_MSG_ERROR([Lua library not found. You may try option 
--with-lua-suffix.])
+-        fi
+-    ]
+-)
++PKG_CHECK_MODULES([LUA53], [lua-5.3], [LUA_INCLUDE="${LUA53_CFLAGS}"; 
LUA_LIB="${LUA53_LIBS}"],AC_MSG_WARN([lua 5.3 not found]))
++PKG_CHECK_MODULES([LUA52], [lua-5.2], [LUA_INCLUDE="${LUA52_CFLAGS}"; 
LUA_LIB="${LUA52_LIBS}"],AC_MSG_WARN([lua 5.2 not found]))
++PKG_CHECK_MODULES([LUA51], [lua5.1], [LUA_INCLUDE="${LUA51_CFLAGS}"; 
LUA_LIB="${LUA51_LIBS}"],AC_MSG_WARN([lua 5.1 not found]))
++
++if test -z "$LUA_INCLUDE" -o -z "$LUA_LIB"; then
++     AC_MSG_ERROR([lua 5.3, 5.2 or 5.1 is required])
++fi
+ AC_SUBST(LUA_INCLUDE)
+ AC_SUBST(LUA_LIB)
+ 
+@@ -121,24 +96,12 @@
+ AC_ARG_WITH(json,
+ [  --with-json=DIR      use json-c in DIR],
+ [ case "$withval" in
+-  yes|no)
++  no)
+      AC_MSG_RESULT(no)
+      ;;
+   *)
+      AC_MSG_RESULT($withval)
+-     if test -f $withval/json.h -a -f $withval/libjson-c.a; then
+-        owd=`pwd`
+-        if cd $withval; then withval=`pwd`; cd $owd; fi
+-        JSON_INCLUDE="-I$withval"
+-        JSON_LIB="-L$withval -ljson-c"
+-     elif test -f $withval/include/json-c/json.h -a -f 
$withval/lib/libjson-c.a; then
+-        owd=`pwd`
+-        if cd $withval; then withval=`pwd`; cd $owd; fi
+-        JSON_INCLUDE="-I$withval/include"
+-        JSON_LIB="-L$withval/lib -ljson-c"
+-     else
+-        AC_ERROR("json.h or libjson-c.a not found in $withval")
+-     fi
++     PKG_CHECK_MODULES([JSON], [json-c], [JSON_INCLUDE="${JSON_CFLAGS}"; 
JSON_LIB="${JSON_LIBS}"],AC_MSG_ERROR([json-c was requested but not found]))
+      AC_SUBST(JSON_INCLUDE)
+      AC_SUBST(JSON_LIB)
+      AC_DEFINE([HAVE_JSONC], [1], [Using json-c])
+@@ -153,41 +116,7 @@
+     ]
+ )
+ 
+-AC_MSG_CHECKING(for libpcap)
+-AC_ARG_WITH(libpcap,
+-[  --with-libpcap=DIR      use libpcap in DIR],
+-[ case "$withval" in
+-  yes|no)
+-     AC_MSG_RESULT(no)
+-     ;;
+-  *)
+-     AC_MSG_RESULT($withval)
+-     if test -f $withval/pcap.h -a \
+-         -f $withval/libpcap.a -a \
+-         -d $withval/pcap; then
+-        owd=`pwd`
+-        if cd $withval; then withval=`pwd`; cd $owd; fi
+-        PCAPINC="-I$withval -I$withval/bpf"
+-        PCAPLIB="-L$withval -lpcap"
+-     else
+-        AC_ERROR(pcap.h, net/bpf.h, or libpcap.a not found in $withval)
+-     fi
+-     ;;
+-  esac ],
+-[ if test -f ${prefix}/include/pcap.h; then
+-     PCAPINC="-I${prefix}/include"
+-     PCAPLIB="-L${prefix}/lib -lpcap"
+-  elif test -f /usr/include/pcap/pcap.h; then
+-     PCAPINC="-I/usr/include/pcap"
+-     PCAPLIB="-lpcap"
+-  elif test -f /usr/include/pcap.h; then
+-     PCAPLIB="-lpcap"
+-  else
+-     AC_MSG_RESULT(no)
+-     AC_ERROR(libpcap not found)
+-  fi
+-  AC_MSG_RESULT(yes) ]
+-)
++PKG_CHECK_MODULES([PCAP], [libpcap], [PCAPINC="${PCAP_CFLAGS}"; 
PCAPLIB="${PCAP_LIBS}"],AC_MSG_ERROR([libpcap is required]))
+ AC_SUBST(PCAPINC)
+ AC_SUBST(PCAPLIB)
+ 
+@@ -234,17 +163,7 @@
+     AC_CHECK_LIB([pthread], [pthread_create])
+ ])
+ 
+-# Make sure libcrafter build a static library by adding the --disable-shared
+-# argument to the configure script.
+-ac_configure_args_pre="$ac_configure_args"
+-ac_configure_args_post="$ac_configure_args --disable-shared"
+-ac_configure_args="$ac_configure_args_post"
+-
+-AC_CONFIG_COMMANDS_PRE([ac_configure_args="$ac_configure_args_pre"])
+-AC_CONFIG_COMMANDS_POST([ac_configure_args="$ac_configure_args_post"])
+-AC_CONFIG_SUBDIRS(noinst/libcrafter/libcrafter)
+-
+-ac_configure_args="$ac_configure_args_pre"
++PKG_CHECK_MODULES([crafter], [crafter], [LIBS="$LIBS 
$crafter_LIBS"],AC_MSG_ERROR([libcrafter is required]))
+ 
+ # Enable click submodule
+ AS_IF([test "x$enable_tests" = "xyes"], [
+@@ -254,7 +173,6 @@
+ 
+     AC_CONFIG_COMMANDS_PRE([ac_configure_args="$ac_configure_args_pre"])
+     AC_CONFIG_COMMANDS_POST([ac_configure_args="$ac_configure_args_post"])
+-    AC_CONFIG_SUBDIRS(tests/tools/click)
+ 
+     ac_configure_args="$ac_configure_args_pre"
+ ])

diff --git a/net-analyzer/tracebox/metadata.xml 
b/net-analyzer/tracebox/metadata.xml
index e55d9843a68..1de26c10446 100644
--- a/net-analyzer/tracebox/metadata.xml
+++ b/net-analyzer/tracebox/metadata.xml
@@ -1,11 +1,15 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd";>
 <pkgmetadata>
-       <maintainer type="project">
-               <email>[email protected]</email>
-               <name>Gentoo network monitoring and analysis project</name>
-       </maintainer>
-       <upstream>
-               <remote-id type="github">tracebox/tracebox</remote-id>
-       </upstream>
+<maintainer type="project">
+<email>[email protected]</email>
+<name>Gentoo network monitoring and analysis project</name>
+</maintainer>
+<use>
+<flag name='curl'>Build the curl component for uploading capture files using 
<pkg>net-misc/curl</pkg></flag>
+<flag name='sniffer'>Build the sniffer component using 
<pkg>net-libs/libnetfilter_queue</pkg></flag>
+</use>
+<upstream>
+<remote-id type="github">tracebox/tracebox</remote-id>
+</upstream>
 </pkgmetadata>

diff --git a/net-analyzer/tracebox/tracebox-0.4.4.ebuild 
b/net-analyzer/tracebox/tracebox-0.4.4.ebuild
new file mode 100644
index 00000000000..b7d29b7c46a
--- /dev/null
+++ b/net-analyzer/tracebox/tracebox-0.4.4.ebuild
@@ -0,0 +1,62 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+inherit autotools
+
+DESCRIPTION="A Middlebox Detection Tool"
+HOMEPAGE="http://www.tracebox.org/";
+SRC_URI="https://github.com/${PN}/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="curl sniffer"
+
+RDEPEND="
+       >=net-libs/libcrafter-0.3_p20171019
+       dev-lang/lua:*
+       dev-libs/json-c
+       net-libs/libpcap
+       curl? ( net-misc/curl )
+       sniffer? ( net-libs/libnetfilter_queue )
+"
+DEPEND="
+       ${RDEPEND}
+"
+BDEPEND="
+       virtual/pkgconfig
+"
+RESTRICT="test"
+PATCHES=(
+       "${FILESDIR}"/${PN}-0.4.4-deps.patch
+)
+
+src_prepare() {
+       default
+
+       sed -i -e '/SUBDIRS/s|noinst||g' Makefile.am || die
+       sed -i -e '/DIST_SUBDIRS.*libcrafter/d' noinst/Makefile.am || die
+
+       sed -i \
+               -e '/[[:graph:]]*libcrafter[[:graph:]]*/d' \
+               -e '/dist_bin_SCRIPTS/d' \
+               src/${PN}/Makefile.am \
+               || die
+
+       sed -i \
+               -e 's|"crafter.h"|<crafter.h>|g' \
+               src/${PN}/PacketModification.h \
+               src/${PN}/PartialHeader.h \
+               src/${PN}/script.h \
+               src/${PN}/${PN}.h \
+               || die
+
+       eautoreconf
+}
+
+src_configure() {
+       econf \
+               $(use_enable curl) \
+               $(use_enable sniffer)
+}

Reply via email to