commit:     7c666e87b06399c7091fdd2919c6b55d0f74d8dc
Author:     Jeroen Roovers <jer <AT> gentoo <DOT> org>
AuthorDate: Thu Aug 20 09:06:39 2020 +0000
Commit:     Jeroen Roovers <jer <AT> gentoo <DOT> org>
CommitDate: Thu Aug 20 09:34:24 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7c666e87

net-analyzer/sancp: Fix building with clang

Package-Manager: Portage-3.0.4, Repoman-3.0.1
Closes: https://bugs.gentoo.org/show_bug.cgi?id=731204
Signed-off-by: Jeroen Roovers <jer <AT> gentoo.org>

 .../sancp/files/sancp-1.6.1-compiler.patch         |  4 +-
 net-analyzer/sancp/files/sancp-1.6.1-extern.patch  | 18 ++++++
 net-analyzer/sancp/sancp-1.6.1-r5.ebuild           | 73 ++++++++++++++++++++++
 3 files changed, 93 insertions(+), 2 deletions(-)

diff --git a/net-analyzer/sancp/files/sancp-1.6.1-compiler.patch 
b/net-analyzer/sancp/files/sancp-1.6.1-compiler.patch
index d7816cbdd5d..5b4391d79dd 100644
--- a/net-analyzer/sancp/files/sancp-1.6.1-compiler.patch
+++ b/net-analyzer/sancp/files/sancp-1.6.1-compiler.patch
@@ -1,5 +1,5 @@
---- a/Makefile 2004-01-19 23:04:56.000000000 +0100
-+++ b/Makefile 2010-09-15 02:02:26.000000000 +0200
+--- a/Makefile
++++ b/Makefile
 @@ -1,26 +1,26 @@
  
  # !!! Uncomment this CFLAGS for a small binary !!!

diff --git a/net-analyzer/sancp/files/sancp-1.6.1-extern.patch 
b/net-analyzer/sancp/files/sancp-1.6.1-extern.patch
new file mode 100644
index 00000000000..c046f1eb497
--- /dev/null
+++ b/net-analyzer/sancp/files/sancp-1.6.1-extern.patch
@@ -0,0 +1,18 @@
+--- a/sancp.cc
++++ b/sancp.cc
+@@ -54,7 +54,6 @@
+  *************/
+ 
+ int main(int argc, char *argv[]) {
+-      extern struct gvars gVars;
+       int cKey;
+       pid_t pid=0;
+ 
+@@ -274,7 +273,6 @@
+ 
+ extern "C" void ProcessMyPacket(char *user, struct pcap_pkthdr * pkthdr, 
u_char * pkt)
+ {
+-      extern struct gvars gVars;
+       CBuffer *buffer;
+       struct cnx *new_cnx=0;
+         gVars.timeptr.tv_sec=pkthdr->ts.tv_sec;

diff --git a/net-analyzer/sancp/sancp-1.6.1-r5.ebuild 
b/net-analyzer/sancp/sancp-1.6.1-r5.ebuild
new file mode 100644
index 00000000000..543e814ff1d
--- /dev/null
+++ b/net-analyzer/sancp/sancp-1.6.1-r5.ebuild
@@ -0,0 +1,73 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+inherit toolchain-funcs user
+
+DESCRIPTION="collect network traffic statistics and store them in pcap format"
+HOMEPAGE="https://sourceforge.net/projects/sancp/";
+SRC_URI="
+       http://www.metre.net/files/${P}.tar.gz
+       http://sancp.sourceforge.net/${PN}-1.6.1.fix200511.a.patch
+       http://sancp.sourceforge.net/${PN}-1.6.1.fix200511.b.patch
+       http://sancp.sourceforge.net/${PN}-1.6.1.fix200601.c.patch
+       http://sancp.sourceforge.net/${PN}-1.6.1.fix200606.d.patch
+"
+
+LICENSE="QPL GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="sguil"
+
+RDEPEND="net-libs/libpcap"
+DEPEND="${RDEPEND}"
+
+pkg_setup() {
+       enewgroup sancp
+       enewuser sancp -1 -1 /dev/null sancp
+}
+PATCHES=(
+       "${FILESDIR}"/${PN}-1.6.1-compiler.patch
+       "${FILESDIR}"/${PN}-1.6.1-gcc6.patch
+       "${FILESDIR}"/${PN}-1.6.1-extern.patch
+)
+
+src_prepare() {
+       eapply "${DISTDIR}"/${PN}-1.6.1.fix200511.a.patch
+       eapply "${DISTDIR}"/${PN}-1.6.1.fix200511.b.patch
+       # bug 138337
+       eapply "${DISTDIR}"/${PN}-1.6.1.fix200601.c.patch
+       eapply "${DISTDIR}"/${PN}-1.6.1.fix200606.d.patch
+       default
+}
+
+src_compile() {
+       tc-export CC CXX
+       emake CFLAGS="${CXXFLAGS}"
+}
+
+src_install() {
+       keepdir /var/log/sancp/
+       dodoc docs/CHANGES docs/fields.LIST docs/README docs/SETUP \
+               "${FILESDIR}"/sguil_sancp.conf etc/sancp/sancp.conf
+
+       insinto /etc/sancp
+       if use sguil ; then
+               newins "${FILESDIR}"/sguil_sancp.conf sancp.conf
+       else
+               doins etc/sancp/sancp.conf
+       fi
+
+       dobin sancp
+
+       newinitd "${FILESDIR}"/sancp.rc1 sancp
+       newconfd "${FILESDIR}"/sancp.confd sancp
+       if use sguil ; then
+               sed -i -e /^SANCP_OPTS/s:'sancp':"sguil":g \
+                       -e s:'-d $LOGDIR/today':"-d 
/var/lib/sguil/$(hostname)/sancp": \
+                       "${D}/etc/conf.d/sancp"
+       fi
+
+       fowners sancp:sancp /var/log/sancp
+       fperms 0770 /var/log/sancp
+}

Reply via email to