patches to make argus 3.0 RC 21 compile under NetBSD pkgsrc

Christoph Badura bad at bsd.de
Mon Aug 7 17:06:35 EDT 2006


Hi,

I took a go at packaging the Argus 3.0 release candidates under the 
NetBSD pkgsrc system.  I came across a couple of issues.  The enclosed
patches are what I need to make it compile on NetBSD/i386 3.0 with the
system make(1).  I tried pkgsrc gmake, too, and hit basically the same
issues wrt. the Makefiles.

The issues I came across are:

argus/Makefile is missing an "all" target.
Empty lines are troublesome in Makefile recipes.
Don't install libcommon.a from both Argus server and client packages.
Don't create directories where nothing is installed in.
Create $exec_prefix/argus/archive.
Can't link conftest.o against -lwrap because of undefined allow_severity,
deny_severity. Add WRAPLIB variable similar to COMPATLIB where applicaple.
Can't have -lwrap as prerequisite because it can't be made by make(1).
Don't use $(INSTALL) to copy scripts to @INSTALL_BIN@ because it requires
privileges.

cheers,
-- christoph badura
-------------- next part --------------
Makefile.in:
Works better with an "all" target.
Don't install libcommon.a from both Argus server and clients. Introduce
an INSTDIRS variable for directories where "make install" is done in.
Don't create directories where nothing is installed in.
Do create $exec_prefix/argus/archive, though.

argus/Makefile.in:
Add WRAPLIB variable similar to COMPATLIB. Add $WRAPLIB to $LIB.

configure.in:
Add -lwrap to LIBS makes following conftest.c unlinkable because of
undefined allow_severity/deny_severity.  Use V_WRAPDEP instead.

configure:
Same as configure.in 

--- Makefile.in.orig	2006-07-21 04:47:45.000000000 +0200
+++ Makefile.in
@@ -41,6 +41,7 @@ docdir = @datadir@/doc/argus-3.0
 SHELL = /bin/sh
 
 DIRS = ./common ./argus
+INSTDIRS = ./argus
 
 DISTFILES = COPYING ChangeLog INSTALL MANIFEST Makefile.in \
 	    CREDITS README VERSION bin common argus doc include \
@@ -51,6 +52,10 @@ DISTFILES = COPYING ChangeLog INSTALL MA
 
 .PHONY: install installdirs
 
+all: $(DIRS)
+
+.PHONY: all
+
 $(DIRS): force
 	@-for d in $(DIRS); \
 	do \
@@ -58,35 +63,24 @@ $(DIRS): force
 			$(MAKE) $(MFLAGS) ;\
 			echo "### Done with" `pwd`);\
 	done
-.PHONY: all
-
 
 install:  force
 	${MAKE} installdirs
 	[ -d $(DESTDIR)@prefix@ ] || \
 		(mkdir -p $(DESTDIR)@prefix@; chmod 755 $(DESTDIR)@prefix@)
-
-	[ -d $(DESTDIR)@sbindir@ ] || \
-		(mkdir -p $(DESTDIR)@sbindir@; chmod 755 $(DESTDIR)@sbindir@)
-
 	[ -d $(DESTDIR)@bindir@ ] || \
 		(mkdir -p $(DESTDIR)@bindir@; chmod 755 $(DESTDIR)@bindir@)
-
 	[ -d $(DESTDIR)$(exec_prefix)/argus ] || \
 		(mkdir -p $(DESTDIR)$(exec_prefix)/argus; chmod 755 $(DESTDIR)$(exec_prefix)/argus)
-
 	[ -d $(DESTDIR)$(exec_prefix)/argus/archive ] || \
 		(mkdir -p $(DESTDIR)$(exec_prefix)/argus/archive; chmod 755 $(DESTDIR)$(exec_prefix)/argus/archive)
-
-	@-for d in $(DIRS); \
+	@-for d in $(INSTDIRS); \
 	do \
 		(cd $$d; echo "### Make install in" `pwd`;    \
 			$(MAKE) $(MFLAGS) install;    \
 			echo "### Done with" `pwd`);            \
 	done
-
 	$(INSTALL) -m 0755 $(srcdir)/bin/argusbug $(DESTDIR)@bindir@/argusbug
-
 	[ -d $(DESTDIR)@mandir@ ] || \
 		(mkdir -p $(DESTDIR)@mandir@; chmod 755 $(DESTDIR)@mandir@)
 	[ -d $(DESTDIR)@mandir@/man5 ] || \
@@ -100,24 +94,19 @@ install-doc:  force
 	${MAKE} installdirs
 	[ -d $(DESTDIR)@prefix@ ] || \
 		(mkdir -p $(DESTDIR)@prefix@; chmod 755 $(DESTDIR)@prefix@)
-
 	[ -d $(DESTDIR)$(docdir) ] || \
 		(mkdir -p $(DESTDIR)$(docdir); chmod 755 $(DESTDIR)$(docdir))
-
+	$(INSTALL) -m 0644 $(srcdir)/doc/CHANGES $(DESTDIR)$(docdir)
 	$(INSTALL) -m 0644 $(srcdir)/doc/FAQ $(DESTDIR)$(docdir)
 	$(INSTALL) -m 0644 $(srcdir)/doc/HOW-TO $(DESTDIR)$(docdir)
-
 	$(INSTALL) -m 0644 $(srcdir)/README $(DESTDIR)$(docdir)
 	$(INSTALL) -m 0644 $(srcdir)/COPYING $(DESTDIR)$(docdir)
 
-
 uninstall:
 	rm -f $(DESTDIR)@mandir@/man5/argus.5
 	rm -f $(DESTDIR)@mandir@/man5/argus.conf.5
 	rm -f $(DESTDIR)@mandir@/man8/argus.8
-
 	rm -rf $(DESTDIR)$(docdir)
-
 	@for i in  $(DIRS) ; do \
 		if [ -d $$i ] ; then \
 		cd $$i; \
@@ -127,7 +116,8 @@ uninstall:
 	done
 
 installdirs:
-	${srcdir}/config/mkinstalldirs $(bindir) $(infodir)
+	${srcdir}/config/mkinstalldirs $(bindir) $(mandir) $(docdir) \
+		$(exec_prefix)/argus/archive
 
 Makefile: Makefile.in config.status
 	$(SHELL) config.status
$NetBSD$

--- argus/Makefile.in.orig	2006-07-17 20:13:44.000000000 +0200
+++ argus/Makefile.in
@@ -33,6 +33,7 @@ srcdir = @srcdir@
 VPATH = @srcdir@
 
 COMPATLIB = @COMPATLIB@
+WRAPLIB = @V_WRAPDEP@
 
 #
 # You shouldn't need to edit anything below.
@@ -77,7 +78,7 @@ PROG =	@INSTALL_BIN@/argus
 
 OBJ =	$(SRC:.c=.o)
 
-LIB = @LIBS@ $(COMPATLIB) ../lib/argus_common.a -lm
+LIB = @LIBS@ $(COMPATLIB) ${WRAPLIB} ../lib/argus_common.a -lm
 
 HDR =	pcap.h pcap-int.h pcap-namedb.h pcap-nit.h pcap-pf.h \
 	ethertype.h gencode.h gnuc.h
@@ -98,7 +99,6 @@ all: $(PROG)
 install: force
 	[ -d $(DESTDIR)$(SBINDIR) ] || \
 		(mkdir -p $(DESTDIR)$(SBINDIR); chmod 755 $(DESTDIR)$(SBINDIR))
-
 	$(INSTALL) $(srcdir)/../bin/argus $(DESTDIR)$(SBINDIR)/argus
 
 uninstall: force
$NetBSD$

--- configure.in.orig	2006-07-17 15:27:55.000000000 +0200
+++ configure.in
@@ -292,13 +292,12 @@ if test ! -z "$V_WRAPDEP"; then
       ln -s ../$V_WRAPDEP lib
       V_WRAPDEP="../lib/libwrap.a"
       AC_DEFINE(HAVE_TCP_WRAPPER)
-      LIBS="$LIBS $V_WRAPDEP"
    else
       if test $V_WRAPDEP = "-lwrap" ; then
          AC_DEFINE(HAVE_TCP_WRAPPER)
          case "$target_os" in
          linux*)
-            LIBS="-lnsl $LIBS" ;;
+            V_WRAPDEP="-lnsl $V_WRAPDEP" ;;
          esac
            fi
    fi
$NetBSD$

--- configure.orig	2006-07-17 15:28:08.000000000 +0200
+++ configure
@@ -8232,8 +8232,8 @@ sed 's/^/| /' conftest.$ac_ext >&5
 
 ac_cv_qosient_wrapper=no
 fi
+LIBS="$ac_save_LIBS"
 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-         LIBS="$ac_save_LIBS"
 fi
 
       echo "$as_me:$LINENO: result: $ac_cv_qosient_wrapper" >&5
@@ -8244,7 +8244,6 @@ echo "$as_me: WARNING: tcp_wrapper not f
       else
          libwrap="-lwrap"
          V_WRAPDEP=$libwrap
-         LIBS="$libwrap $LIBS"
          if test -r /usr/local/include/tcpd.h; then
             V_INCLS="-I/usr/local/include $V_INCLS"
          fi
@@ -8279,7 +8278,6 @@ if test ! -z "$V_WRAPDEP"; then
 #define HAVE_TCP_WRAPPER 1
 _ACEOF
 
-      LIBS="$LIBS $V_WRAPDEP"
    else
       if test $V_WRAPDEP = "-lwrap" ; then
          cat >>confdefs.h <<\_ACEOF
@@ -8288,7 +8286,7 @@ _ACEOF
 
          case "$target_os" in
          linux*)
-            LIBS="-lnsl $LIBS" ;;
+            V_WRAPDEP="-lnsl $V_WRAPDEP" ;;
          esac
            fi
    fi
-------------- next part --------------
Makfile.in:
Don't create directories into which nothing is installed.
Empty lines are troublesome in Makefile recipes.

clients/Makefile.in:
Empty lines are troublesome in Makefile recipes.

common/Makefile.in:
Don't create directories into which nothing is installed.
Empty lines are troublesome in Makefile recipes.

configure.in:
Add -lwrap to LIBS makes following conftest.c unlinkable because of
undefined allow_severity/deny_severity.  Use V_WRAPDEP instead.

configure:
Same as configure.in.

radium/Makefile.in:
Can't have -lwrap as prerequisite.  Factor out @LIBS@ and @V_WRAPDEP@ to
LIBS variable.
Empty lines are troublesome in Makefile recipesCan't have -lwrap as prerequisite.  Factor out @LIBS@ and @V_WRAPDEP@ to
LIBS variable.
Empty lines are troublesome in Makefile recipes.

ragraph/Makefile.in:
Don't use $(INSTALL) to copy script to @INSTALL_BIN@: it requires privileges.
Empty lines are troublesome in Makefile recipes.

ratop/Makefile.in
Empty lines are troublesome in Makefile recipes.

$NetBSD$

--- Makefile.in.orig	2006-06-22 19:59:14.000000000 +0200
+++ Makefile.in
@@ -67,22 +67,10 @@ install:  force
 	make installdirs
 	[ -d $(DESTDIR)@prefix@ ] || \
 		(mkdir -p $(DESTDIR)@prefix@; chmod 755 $(DESTDIR)@prefix@)
-
-	[ -d $(DESTDIR)@sbindir@ ] || \
-		(mkdir -p $(DESTDIR)@sbindir@; chmod 755 $(DESTDIR)@sbindir@)
-
 	[ -d $(DESTDIR)@bindir@ ] || \
 		(mkdir -p $(DESTDIR)@bindir@; chmod 755 $(DESTDIR)@bindir@)
-
 	[ -d $(DESTDIR)$(exec_prefix)/argus ] || \
 		(mkdir -p $(DESTDIR)$(exec_prefix)/argus; chmod 755 $(DESTDIR)$(exec_prefix)/argus)
-
-	[ -d $(DESTDIR)$(exec_prefix)/argus/lib ] || \
-		(mkdir -p $(DESTDIR)$(exec_prefix)/argus/lib; chmod 755 $(DESTDIR)$(exec_prefix)/argus/lib)
-
-	[ -d $(DESTDIR)$(exec_prefix)/argus/archive ] || \
-		(mkdir -p $(DESTDIR)$(exec_prefix)/argus/archive; chmod 755 $(DESTDIR)$(exec_prefix)/argus/archive)
-
 	@for i in  $(DIRS) ; do \
 		if [ -d $$i ] ; then \
 		echo "making in $$i"; \
@@ -91,11 +79,8 @@ install:  force
 		cd ..; \
 		fi; \
 	done
-
 	$(INSTALL) -m 0644 $(srcdir)/support/Config/rarc $(DESTDIR)$(prefix)/argus
-
 	$(INSTALL) -m 0755 $(srcdir)/bin/argusbug $(DESTDIR)@bindir@/argusbug
-
 	[ -d $(DESTDIR)@mandir@ ] || \
 		(mkdir -p $(DESTDIR)@mandir@; chmod 755 $(DESTDIR)@mandir@)
 	[ -d $(DESTDIR)@mandir@/man1 ] || \
@@ -131,20 +116,15 @@ install-doc:
 	make installdirs
 	[ -d $(DESTDIR)@prefix@ ] || \
 		(mkdir -p $(DESTDIR)@prefix@; chmod 755 $(DESTDIR)@prefix@)
-
 	[ -d $(DESTDIR)$(docdir) ] || \
 		(mkdir -p $(DESTDIR)$(docdir); chmod 755 $(DESTDIR)$(docdir))
-
 	[ -d $(DESTDIR)$(docdir)/html ] || \
 		(mkdir -p $(DESTDIR)$(docdir)/html; chmod 755 $(DESTDIR)$(docdir)/html)
-
 	[ -d $(DESTDIR)$(docdir)/html/man ] || \
 		(mkdir -p $(DESTDIR)$(docdir)/html/man; chmod 755 $(DESTDIR)$(docdir)/html/man)
-
 	$(INSTALL) -m 0644 $(srcdir)/doc/FAQ $(DESTDIR)$(docdir)
 	$(INSTALL) -m 0644 $(srcdir)/doc/HOW-TO $(DESTDIR)$(docdir)
 	$(INSTALL) -m 0644 $(srcdir)/doc/html/man/*.html $(DESTDIR)$(docdir)/html/man
-
 	$(INSTALL) -m 0644 $(srcdir)/README $(DESTDIR)$(docdir)
 	$(INSTALL) -m 0644 $(srcdir)/COPYING $(DESTDIR)$(docdir)
 
@@ -157,7 +137,6 @@ uninstall:
 	rm -f $(DESTDIR)@bindir@/ragraph
 	rm -f $(DESTDIR)@bindir@/ratop
 	rm -f $(DESTDIR)@bindir@/ratemplate
-
 	rm -f $(DESTDIR)@mandir@/man1/ra.1
 	rm -f $(DESTDIR)@mandir@/man1/racount.1
 	rm -f $(DESTDIR)@mandir@/man1/ragraph.1
@@ -166,7 +145,6 @@ uninstall:
 	rm -f $(DESTDIR)@mandir@/man1/rabins.1
 	rm -f $(DESTDIR)@mandir@/man1/racluster.1
 	rm -f $(DESTDIR)@mandir@/man5/rarc.5
-
 	rm -rf $(DESTDIR)$(docdir)
 	rm -f $(DESTDIR)$(prefix)/argus/COPYING
 	rm -f $(DESTDIR)$(prefix)/argus/README
$NetBSD$

--- clients/Makefile.in.orig	2006-06-14 02:08:05.000000000 +0200
+++ clients/Makefile.in
@@ -114,7 +114,6 @@ CLEANFILES = $(OBJ) $(PROGS)
 install: force all
 	[ -d $(DESTDIR)$(BINDIR) ] || \
 		(mkdir -p $(DESTDIR)$(BINDIR); chmod 755 $(DESTDIR)$(BINDIR))
-
 	$(INSTALL) $(srcdir)/../bin/ra* $(DESTDIR)$(BINDIR)
 
 clean:
$NetBSD$

--- common/Makefile.in.orig	2006-06-22 19:28:34.000000000 +0200
+++ common/Makefile.in
@@ -131,14 +131,10 @@ version.c: $(srcdir)/../VERSION
 	sed -e 's/.*/char version[] = "&";/' $(srcdir)/../VERSION > $@
 
 install: force all
-	[ -d $(LIBDEST) ] || \
-		(mkdir -p $(LIBDEST); chmod 755 $(LIBDEST))
 	[ -d $(DESTDIR)$(LIBDEST) ] || \
 		(mkdir -p $(DESTDIR)$(LIBDEST); chmod 755 $(DESTDIR)$(LIBDEST))
-
 	$(INSTALL) $(srcdir)/../lib/argus_common.a $(DESTDIR)$(LIBDEST)/argus_common.a
 	$(INSTALL) $(srcdir)/../lib/argus_parse.a  $(DESTDIR)$(LIBDEST)/argus_parse.a
-
 	$(RANLIB) $(DESTDIR)$(LIBDEST)/argus_common.a
 	$(RANLIB) $(DESTDIR)$(LIBDEST)/argus_parse.a
 
$NetBSD$

--- configure.in.orig	2006-07-17 15:29:48.000000000 +0200
+++ configure.in
@@ -162,13 +162,12 @@ if test ! -z "$V_WRAPDEP"; then
 		ln -s ../$V_WRAPDEP lib
 		V_WRAPDEP="../lib/libwrap.a"
 		AC_DEFINE(HAVE_TCP_WRAPPER)
-		LIBS="$LIBS $V_WRAPDEP"
 	else
 		if test $V_WRAPDEP = "-lwrap" ; then
 			AC_DEFINE(HAVE_TCP_WRAPPER)
 			case "$target_os" in
 			linux*)
-				LIBS="-lnsl $LIBS" ;;
+				V_WRAPDEP="-lnsl $V_WRAPDEP" ;;
 			esac
         	fi
 	fi
@@ -278,6 +277,7 @@ AC_SUBST(V_LEX)
 AC_SUBST(LIBS)
 AC_SUBST(COMPATLIB)
 AC_SUBST(CURSESLIB)
+AC_SUBST(V_WRAPDEP)
 AC_SUBST(INSTALL_LIB)
 AC_SUBST(INSTALL_BIN)
 
$NetBSD$

--- configure.orig	2006-07-17 15:29:56.000000000 +0200
+++ configure
@@ -6622,8 +6622,8 @@ sed 's/^/| /' conftest.$ac_ext >&5
 
 ac_cv_qosient_wrapper=no
 fi
+LIBS="$ac_save_LIBS"
 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-         LIBS="$ac_save_LIBS"
 fi
 
       echo "$as_me:$LINENO: result: $ac_cv_qosient_wrapper" >&5
@@ -6634,7 +6634,6 @@ echo "$as_me: WARNING: tcp_wrapper not f
       else
          libwrap="-lwrap"
          V_WRAPDEP=$libwrap
-         LIBS="$libwrap $LIBS"
          if test -r /usr/local/include/tcpd.h; then
             V_INCLS="-I/usr/local/include $V_INCLS"
          fi
@@ -6669,7 +6668,6 @@ if test ! -z "$V_WRAPDEP"; then
 #define HAVE_TCP_WRAPPER 1
 _ACEOF
 
-		LIBS="$LIBS $V_WRAPDEP"
 	else
 		if test $V_WRAPDEP = "-lwrap" ; then
 			cat >>confdefs.h <<\_ACEOF
@@ -6678,7 +6676,7 @@ _ACEOF
 
 			case "$target_os" in
 			linux*)
-				LIBS="-lnsl $LIBS" ;;
+				V_WRAPDEP="-lnsl $V_WRAPDEP" ;;
 			esac
         	fi
 	fi
@@ -8315,6 +8313,7 @@ s, at V_CCOPT@,$V_CCOPT,;t t
 s, at V_INCLS@,$V_INCLS,;t t
 s, at COMPATLIB@,$COMPATLIB,;t t
 s, at CURSESLIB@,$CURSESLIB,;t t
+s, at V_WRAPDEP@,$V_WRAPDEP,;t t
 s, at INSTALL_LIB@,$INSTALL_LIB,;t t
 s, at INSTALL_BIN@,$INSTALL_BIN,;t t
 s, at INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t
$NetBSD$

--- radium/Makefile.in.orig	2006-06-14 01:55:49.000000000 +0200
+++ radium/Makefile.in
@@ -69,7 +69,8 @@ YACC = @V_YACC@
 	@rm -f $@
 	$(CC) $(CFLAGS) -c $(srcdir)/$*.c
 
-LIB = @INSTALL_LIB@/argus_parse.a @INSTALL_LIB@/argus_common.a @INSTALL_LIB@/argus_client.a @LIBS@
+LIB = @INSTALL_LIB@/argus_parse.a @INSTALL_LIB@/argus_common.a @INSTALL_LIB@/argus_client.a
+LIBS = @LIBS@ @V_WRAPDEP@
 
 SRC = radium.c
 
@@ -78,7 +79,7 @@ PROGS = radium
 all: $(PROGS)
 
 radium: radium.o $(LIB)
-	$(CC) $(CCOPT) -o $@ radium.o $(LIB) $(COMPATLIB)
+	$(CC) $(CCOPT) -o $@ radium.o $(LIB) $(LIBS) $(COMPATLIB)
 
 # We would like to say "OBJ = $(SRC:.c=.o)" but Ultrix's make cannot
 # hack the extra indirection
@@ -90,7 +91,6 @@ CLEANFILES = $(OBJ) $(PROGS)
 install: force all
 	[ -d $(DESTDIR)$(SBINDIR) ] || \
 		(mkdir -p $(DESTDIR)$(SBINDIR); chmod 755 $(DESTDIR)$(SBINDIR))
-
 	$(INSTALL) radium $(DESTDIR)$(SBINDIR)
 
 clean:
$NetBSD$

--- ragraph/Makefile.in.orig	2006-06-14 01:58:36.000000000 +0200
+++ ragraph/Makefile.in
@@ -72,7 +72,8 @@ PROGS = @INSTALL_BIN@/ragraph
 all: $(PROGS)
 
 @INSTALL_BIN@/ragraph: ragraph.pl
-	$(INSTALL) ragraph.pl $@
+	cp ragraph.pl $@
+	chmod +x $@
 
 # We would like to say "OBJ = $(SRC:.c=.o)" but Ultrix's make cannot
 # hack the extra indirection
@@ -83,7 +84,6 @@ CLEANFILES = $(PROGS)
 install: force all
 	[ -d $(DESTDIR)$(BINDIR) ] || \
 		(mkdir -p $(DESTDIR)$(BINDIR); chmod 755 $(DESTDIR)$(BINDIR))
-
 	$(INSTALL) @INSTALL_BIN@/ragraph $(DESTDIR)$(BINDIR)
 
 clean:
$NetBSD$

--- ratop/Makefile.in.orig	2006-07-15 00:00:42.000000000 +0200
+++ ratop/Makefile.in
@@ -92,7 +92,6 @@ CLEANFILES = $(OBJ) $(PROGS)
 install: force all
 	[ -d $(DESTDIR)$(BINDIR) ] || \
 		(mkdir -p $(DESTDIR)$(BINDIR); chmod 755 $(DESTDIR)$(BINDIR))
-
 	$(INSTALL) @INSTALL_BIN@/ratop $(DESTDIR)$(BINDIR)
 
 clean:


More information about the argus mailing list