commit:     b18a0369b3d30d999feb001214862fee90d6bbf9
Author:     Jeroen Roovers <jer <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 31 16:01:04 2020 +0000
Commit:     Jeroen Roovers <jer <AT> gentoo <DOT> org>
CommitDate: Fri Jan 31 16:01:29 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b18a0369

net-analyzer/ipguard: Fix CFLAGS=-fno-common

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

 .../ipguard/files/ipguard-1.04-fno-common.patch    | 98 ++++++++++++++++++++++
 .../ipguard/files/ipguard-1.04-gentoo.patch        | 50 +++++++++++
 .../ipguard/files/ipguard-1.04-init.d.patch        | 36 ++++++++
 .../ipguard/files/ipguard-1.04-runpath.patch       | 11 +++
 net-analyzer/ipguard/ipguard-1.04-r1.ebuild        | 27 ++----
 5 files changed, 201 insertions(+), 21 deletions(-)

diff --git a/net-analyzer/ipguard/files/ipguard-1.04-fno-common.patch 
b/net-analyzer/ipguard/files/ipguard-1.04-fno-common.patch
new file mode 100644
index 00000000000..414a91ec09a
--- /dev/null
+++ b/net-analyzer/ipguard/files/ipguard-1.04-fno-common.patch
@@ -0,0 +1,98 @@
+--- a/ipguard.c
++++ b/ipguard.c
+@@ -29,6 +29,34 @@
+ 
+ #include "ipguard.h"
+ 
++char iface[IFNAMSIZ];
++char ethers_name[PATH_MAX];
++char log_name[PATH_MAX];
++char pid_name[PATH_MAX];
++char fmac[18];
++char pcapf[PCAPFSIZ];
++char suser[MAXLOGNAME];
++int ethers_update;
++int fake_regen;
++int fake_num;
++int fake_time;
++int buffer_num;
++int addr_nosubst;
++int nofirst;
++int grant;
++int read_only;
++int duplex;
++int fixbc;
++int hidden;
++int promisc;
++int debug;
++int verbose;
++
++unsigned int all, good, grat, wgrat, zmac, zip, bad, bmac, bsip, btip,
++    bnew, bgrat, mymac, fake, pfake, nzh, nbe, mis;
++char pfmac[18];
++char s[128+1];
++
+ void usage(char *name) {
+     fprintf(stdout, "%s v%s (c) %s <%s>\n\n", NAME, VERSION, AUTHOR, MAIL);
+     fprintf(stdout, "usage: %s [-h] [-ajgrxziovd]\n", name);
+--- a/ipguard.h
++++ b/ipguard.h
+@@ -68,33 +68,33 @@
+ #define NOTICE          3
+ #define INFO            4
+ 
+-char iface[IFNAMSIZ];
+-char ethers_name[PATH_MAX];
+-char log_name[PATH_MAX];
+-char pid_name[PATH_MAX];
+-char fmac[18];
+-char pcapf[PCAPFSIZ];
+-char suser[MAXLOGNAME];
+-int ethers_update;
+-int fake_regen;
+-int fake_num;
+-int fake_time;
+-int buffer_num;
+-int addr_nosubst;
+-int nofirst;
+-int grant;
+-int read_only;
+-int duplex;
+-int fixbc;
+-int hidden;
+-int promisc;
+-int debug;
+-int verbose;
++extern char iface[IFNAMSIZ];
++extern char ethers_name[PATH_MAX];
++extern char log_name[PATH_MAX];
++extern char pid_name[PATH_MAX];
++extern char fmac[18];
++extern char pcapf[PCAPFSIZ];
++extern char suser[MAXLOGNAME];
++extern int ethers_update;
++extern int fake_regen;
++extern int fake_num;
++extern int fake_time;
++extern int buffer_num;
++extern int addr_nosubst;
++extern int nofirst;
++extern int grant;
++extern int read_only;
++extern int duplex;
++extern int fixbc;
++extern int hidden;
++extern int promisc;
++extern int debug;
++extern int verbose;
+ 
+-unsigned int all, good, grat, wgrat, zmac, zip, bad, bmac, bsip, btip,
++extern unsigned int all, good, grat, wgrat, zmac, zip, bad, bmac, bsip, btip,
+     bnew, bgrat, mymac, fake, pfake, nzh, nbe, mis;
+-char pfmac[18];
+-char s[128+1];
++extern char pfmac[18];
++extern char s[128+1];
+ 
+ /*  ethers.c
+  */

diff --git a/net-analyzer/ipguard/files/ipguard-1.04-gentoo.patch 
b/net-analyzer/ipguard/files/ipguard-1.04-gentoo.patch
new file mode 100644
index 00000000000..7d66038581b
--- /dev/null
+++ b/net-analyzer/ipguard/files/ipguard-1.04-gentoo.patch
@@ -0,0 +1,50 @@
+--- a/Makefile
++++ b/Makefile
+@@ -28,13 +28,13 @@
+ STATIC=
+ CC=gcc
+ 
+-CFLAGS+=-g -Wall -DETHERS='"$(ETHERS)"'
++CFLAGS+=-Wall -DETHERS='"$(ETHERS)"'
+ 
+ OBJS=ethers.o ipguard.o packet.o system.o
+ 
+ .c.o:
+       @echo Compiling $*.c
+-      @$(CC) -c $(CFLAGS) $(INCLUDES) $(DEFINES) $<
++      $(CC) -c $(CFLAGS) $(INCLUDES) $(DEFINES) $<
+ 
+ all:  start $(NAME)
+ 
+@@ -47,7 +47,7 @@
+ 
+ $(NAME): $(OBJS)
+       @echo Linking $@
+-      @$(CC) -o $@ $(OBJS) $(LIBS) $(STATIC)
++      $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) $(STATIC)
+ 
+ clean:
+       @echo Cleaning OBJS
+@@ -58,16 +58,16 @@
+       @rm -f $(NAME)
+ 
+ install: all
+-      mkdir -p -m 755 $(PREFIX)/sbin
+-      install -s -m 755 $(NAME) $(PREFIX)/sbin/$(NAME)
+-      mkdir -p -m 755 $(PREFIX)/man/man8
+-      install -m 644 doc/$(NAME).8 $(PREFIX)/man/man8/$(NAME).8
++      mkdir -p -m 755 ${D}$(PREFIX)/sbin
++      install -m 755 $(NAME) ${D}$(PREFIX)/sbin/$(NAME)
++      mkdir -p -m 755 ${D}$(PREFIX)/share/man/man8
++      install -m 644 doc/$(NAME).8 ${D}$(PREFIX)/share/man/man8/$(NAME).8
+ 
+ uninstall: deinstall
+ 
+ deinstall:
+-      rm -f $(PREFIX)/man/man8/$(NAME).8
+-      rm -f $(PREFIX)/sbin/$(NAME)
++      rm -f ${D}$(PREFIX)/share/man/man8/$(NAME).8
++      rm -f ${D}$(PREFIX)/sbin/$(NAME)
+ 
+ ethers.o: ipguard.h
+ ipguard.o: ipguard.h

diff --git a/net-analyzer/ipguard/files/ipguard-1.04-init.d.patch 
b/net-analyzer/ipguard/files/ipguard-1.04-init.d.patch
new file mode 100644
index 00000000000..447d818bf96
--- /dev/null
+++ b/net-analyzer/ipguard/files/ipguard-1.04-init.d.patch
@@ -0,0 +1,36 @@
+--- a/doc/ipguard.gentoo
++++ b/doc/ipguard.gentoo
+@@ -1,7 +1,7 @@
+ #! /sbin/runscript
+ ##  $Id: ipguard.gentoo,v 1.5 2010/07/12 03:46:52 sead Exp $
+ 
+-opts="reload"
++extra_commands="reload"
+ 
+ depend() {
+       use net
+@@ -9,20 +9,20 @@
+ 
+ start() {
+       ebegin "Starting ipguard"
+-      start-stop-daemon --start --quiet --pidfile /var/run/ipguard.pid \
+-              --exec /usr/sbin/ipguard -- -u 300 -xz
++      start-stop-daemon --start --quiet --pidfile /run/ipguard.pid \
++              --exec /usr/sbin/ipguard -- ${OPTS} ${IFACE}
+       eend $?
+ }
+ 
+ stop() {
+       ebegin "Stopping ipguard"
+-      start-stop-daemon --stop --quiet --pidfile /var/run/ipguard.pid
++      start-stop-daemon --stop --quiet --pidfile /run/ipguard.pid
+       eend $?
+ }
+ 
+ reload() {
+        ebegin "Reloading ipguard"
+-       start-stop-daemon --stop --quiet --pidfile /var/run/ipguard.pid \
++       start-stop-daemon --stop --quiet --pidfile /run/ipguard.pid \
+               --signal HUP
+        eend $?
+ }

diff --git a/net-analyzer/ipguard/files/ipguard-1.04-runpath.patch 
b/net-analyzer/ipguard/files/ipguard-1.04-runpath.patch
new file mode 100644
index 00000000000..930f2cc84fd
--- /dev/null
+++ b/net-analyzer/ipguard/files/ipguard-1.04-runpath.patch
@@ -0,0 +1,11 @@
+--- a/ipguard.h
++++ b/ipguard.h
+@@ -53,7 +53,7 @@
+ 
+ #define ETHERSFILE      ETHERS
+ #define LOGNAME         "/var/log/ipguard"
+-#define PIDNAME         "/var/run/ipguard"
++#define PIDNAME         "/run/ipguard"
+ #define FAKEMAC         "de:ad:xx:xx:xx:xx"
+ #define PCAPFSIZ        128
+ 

diff --git a/net-analyzer/ipguard/ipguard-1.04-r1.ebuild 
b/net-analyzer/ipguard/ipguard-1.04-r1.ebuild
index a30baf79b5e..73efd0b6872 100644
--- a/net-analyzer/ipguard/ipguard-1.04-r1.ebuild
+++ b/net-analyzer/ipguard/ipguard-1.04-r1.ebuild
@@ -19,27 +19,12 @@ DEPEND="
 RDEPEND="
        ${DEPEND}
 "
-
-src_prepare() {
-       default
-
-       sed -i \
-               -e 's|-g ||g' \
-               -e 's|  @$(CC)| $(CC)|g' \
-               -e 's| -s | |g' \
-               -e 's| -o | $(CFLAGS) $(LDFLAGS)&|g' \
-               -e 's|$(PREFIX)|${D}&|g' \
-               -e 's|/man/|/share&|g' \
-               Makefile || die
-       sed -i \
-               -e 's|opts=|extra_commands=|g' \
-               -e 's|/var/run/|/run/|g' \
-               -e 's|-u 300 -xz|${OPTS} ${IFACE}|g' \
-               doc/${PN}.gentoo || die
-       sed -i \
-               -e 's|/var/run/|/run/|g' \
-               doc/${PN}.8 ${PN}.h || die
-}
+PATCHES=(
+       "${FILESDIR}"/${P}-gentoo.patch
+       "${FILESDIR}"/${P}-init.d.patch
+       "${FILESDIR}"/${P}-runpath.patch
+       "${FILESDIR}"/${P}-fno-common.patch
+)
 
 src_compile() {
        emake \

Reply via email to