commit:     25646dfc75b15c2bcc9c80ab3aba7a6bab5eec68
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Feb  3 16:49:23 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Feb  3 16:51:39 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=25646dfc

net-analyzer/ntopng: add 5.4

Signed-off-by: Sam James <sam <AT> gentoo.org>

 net-analyzer/ntopng/Manifest                       |  1 +
 .../ntopng/files/ntopng-5.4-ndpi-linking.patch     | 49 +++++++++++
 net-analyzer/ntopng/ntopng-5.4.ebuild              | 97 ++++++++++++++++++++++
 3 files changed, 147 insertions(+)

diff --git a/net-analyzer/ntopng/Manifest b/net-analyzer/ntopng/Manifest
index 7a0c02596f71..7ff71e335ae9 100644
--- a/net-analyzer/ntopng/Manifest
+++ b/net-analyzer/ntopng/Manifest
@@ -1 +1,2 @@
 DIST ntopng-5.2.1.tar.gz 60280025 BLAKE2B 
e7885a1ec9e5d37ee06def83a83c62f41acf87d939d18c33c8d114fe0bed0c973a6146f26fd92343aa7c7e7484970c3e95c33fe76468fe382809daddeed6541b
 SHA512 
01cdf21deac61a3b11e7d0e6b662c911123241332e812bb676cb8c5c003fe1d50a4c61231f9c327d467e89dd1345fc1bdbab5d2599fe04b04a8fe12654c01bdd
+DIST ntopng-5.4.tar.gz 42662921 BLAKE2B 
67a44291671821a94ed0a849467e85030e57fff07b49e61c299f3c09efcad1a7dac5b835f4fc51a2554f7e7d7ae60ae0bd135adba7afa71e505a40d4e9243462
 SHA512 
3a7d84f64127779780c580c198dfc90bc0a4957e9fb68493babb5381d9127451c506a06d134a488d869840e2b10e7d87a09ec590fd3a5d782e426cab640632cb

diff --git a/net-analyzer/ntopng/files/ntopng-5.4-ndpi-linking.patch 
b/net-analyzer/ntopng/files/ntopng-5.4-ndpi-linking.patch
new file mode 100644
index 000000000000..8a50b7cb1a10
--- /dev/null
+++ b/net-analyzer/ntopng/files/ntopng-5.4-ndpi-linking.patch
@@ -0,0 +1,49 @@
+--- a/configure.ac.in
++++ b/configure.ac.in
+@@ -231,31 +231,8 @@ NDPI_LIB=
+ NDPI_LIB_DEP=
+ 
+ AC_MSG_CHECKING(for nDPI source)
+-      if test -d "./nDPI" ; then :
+-         NDPI_HOME=./nDPI
+-      elif test -d "../nDPI" ; then :
+-         NDPI_HOME=../nDPI
+-      elif test -d "$HOME/nDPI" ; then :
+-         NDPI_HOME=$HOME/nDPI
+-      fi
+-
+-      if test ! -z "$NDPI_HOME" ; then :
+-         AC_MSG_RESULT(found in $NDPI_HOME)
+-         NDPI_LIB=$NDPI_HOME/src/lib/libndpi.a
+-         AC_MSG_CHECKING(for $NDPI_LIB)
+-         if test -r $NDPI_LIB ; then :
+-            AC_MSG_RESULT(found $NDPI_LIB)
+-         else
+-            AC_MSG_RESULT(not found $NDPI_LIB: compiling)
+-            cd $NDPI_HOME; ./autogen.sh; ${MAKE}; cd -
+-         fi
+-         NDPI_INC="-I$NDPI_HOME/src/include 
-I$NDPI_HOME/src/lib/third_party/include"
+-         NDPI_LIB=$NDPI_HOME/src/lib/libndpi.a
+-         NDPI_LIB_DEP=$NDPI_LIB
+-      else
+-         AC_MSG_RESULT(not found)
+-      fi
+-
++      NDPI_LIB="-lndpi"
++      NDPI_LIB_DEP=$NDPI_LIB
+ 
+ if test ! -z "$NDPI_CUST_INC" ; then :
+   NDPI_INC=$NDPI_CUST_INC
+diff --git a/configure.ac.in b/configure.ac.in
+index ed906b1..3e70bec 100644
+--- a/configure.ac.in
++++ b/configure.ac.in
+@@ -242,7 +242,7 @@ if test ! -z "$NDPI_CUST_LIB" ; then :
+   NDPI_LIB=$NDPI_CUST_LIB
+ fi
+ 
+-if test -z "$NDPI_INC" || test -z "$NDPI_LIB" ; then :
++if test -z "$NDPI_LIB" ; then :
+   echo "Could not find nDPI"
+   echo "Please do cd ..; git clone https://github.com/ntop/nDPI.git; cd nDPI; 
./autogen.sh; ${MAKE}; cd ../ntopng"
+   echo "and try again"

diff --git a/net-analyzer/ntopng/ntopng-5.4.ebuild 
b/net-analyzer/ntopng/ntopng-5.4.ebuild
new file mode 100644
index 000000000000..57a01e79f4ab
--- /dev/null
+++ b/net-analyzer/ntopng/ntopng-5.4.ebuild
@@ -0,0 +1,97 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit autotools toolchain-funcs
+
+DESCRIPTION="Network traffic analyzer with web interface"
+HOMEPAGE="https://www.ntop.org/";
+SRC_URI="https://github.com/ntop/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+
+DEPEND="dev-db/mysql-connector-c:=
+       dev-db/sqlite:3
+       dev-libs/hiredis:=
+       dev-libs/json-c:=
+       dev-libs/libmaxminddb
+       dev-libs/libsodium:=
+       dev-libs/openssl:=
+       net-analyzer/rrdtool
+       net-libs/libpcap
+       >=net-libs/nDPI-4.6:=
+       <net-libs/nDPI-4.8:=
+       >=net-libs/zeromq-3:=
+       net-misc/curl
+       sys-libs/libcap
+       sys-libs/zlib"
+RDEPEND="${DEPEND}
+       acct-user/ntopng
+       acct-group/ntopng
+       dev-db/redis"
+BDEPEND="virtual/pkgconfig"
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-5.2.1-mysqltool.patch
+       "${FILESDIR}"/${PN}-5.4-ndpi-linking.patch
+)
+
+src_prepare() {
+       default
+
+       # Follows upstream's autogen.sh
+       sed \
+               -e "s/@VERSION@/${PV}.$(date +%y%m%d)/g" \
+               -e "s/@SHORT_VERSION@/${PV}/g" \
+               -e "s/@GIT_DATE@/$(date)/g" \
+               -e "s/@GIT_RELEASE@/${PV}.$(date +%y%m%d)/g" \
+               -e "s/@GIT_BRANCH@//g" < "${S}/configure.ac.in" \
+               > "${S}/configure.ac" || die
+
+       eautoreconf
+}
+
+src_configure() {
+       tc-export PKG_CONFIG
+
+       # configure.ac.in at least has some bashisms(?) which get lost(?)
+       # in conversion to configure.ac (like [ -> nothing?) so just force
+       # bash for now. It's still not quite right but at least upstream will be
+       # testing with it. TODO: fix this!
+       CONFIG_SHELL="${BROOT}/bin/bash" econf 
--with-ndpi-includes="${ESYSROOT}"/usr/include/ndpi
+}
+
+src_compile() {
+       emake \
+               CC="$(tc-getCC)" \
+               MYCFLAGS="${CFLAGS}" \
+               MYLDFLAGS="${LDFLAGS}"
+}
+
+src_install() {
+       SHARE_NTOPNG_DIR="${EPREFIX}/usr/share/${PN}"
+       insinto "${SHARE_NTOPNG_DIR}"
+       doins -r httpdocs
+       doins -r scripts
+
+       insinto "${SHARE_NTOPNG_DIR}/third-party"
+       doins -r third-party/i18n.lua-master
+       doins -r third-party/lua-resty-template-master
+
+       exeinto /usr/bin
+       doexe "${PN}"
+       doman "${PN}.8"
+
+       newinitd "${FILESDIR}"/ntopng.init.d ntopng
+       newconfd "${FILESDIR}"/ntopng.conf.d ntopng
+
+       keepdir /var/lib/ntopng
+       fowners ntopng /var/lib/ntopng
+}
+
+pkg_postinst() {
+       elog "ntopng default credentials are user='admin' password='admin'"
+}

Reply via email to