Subject: pkg/14782: www/webalizer (2.01-06) won't build on NetBSD < 1.4 (or < 1.3I)
To: None <gnats-bugs@gnats.netbsd.org>
From: Greg A. Woods <woods@weird.com>
List: netbsd-bugs
Date: 11/29/2001 21:58:23
>Number:         14782
>Category:       pkg
>Synopsis:       www/webalizer (2.01-06) won't build on NetBSD < 1.4 (or < 1.3I)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Nov 29 18:59:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Greg A. Woods
>Release:        pkgsrc-current 2001/11/28
>Organization:
Planix, Inc.; Toronto, Ontario; Canada
>Environment:
System: NetBSD-1.3.3
>Description:

	I find myself occasionally still having to build new packages on
	old NetBSD systems, such as 1.3.3.

	The new www/webalizer needs the new zlib-1.1.3 (at least when it
	is built with --enable-dns).  That version of zlib isn't
	available native in NetBSD prior to 1.4 (or 1.3I for that matter).

	Note this fix could also be done by making webalizer depend on
	devel/zlib and by making that package also work on NetBSD
	(i.e. remove the ONLY_FOR_PLATFORM it now sets, etc., and figure
	out a scheme for depending on a package that is only needed on
	some platforms).  The fix I supply below seemed much easier for
	the time being....  :-)

	Note this patch does not make it possible for www/webalizer to
	build on SunOS, since to do so would probably also require
	depending on devel/zlib!  ;-)

>How-To-Repeat:

	try to build www/webalizer on NetBSD-1.3.3 or older

>Fix:

	apply the following patch to pgksrc/www/webalizer:

Index: Makefile
===================================================================
RCS file: /cvs/master/m-NetBSD/main/pkgsrc/www/webalizer/Makefile,v
retrieving revision 1.14
diff -c -u -r1.14 Makefile
--- Makefile	5 May 2001 12:12:14 -0000	1.14
+++ Makefile	30 Nov 2001 02:31:02 -0000
@@ -13,16 +13,43 @@
 HOMEPAGE=	http://www.mrunix.net/webalizer/
 COMMENT=	Web server log file analysis program
 
+# According to <sys/param.h>:
+#
+# *      #define __NetBSD_Version__ MMmmrrpp00
+# *
+# *      M = major version
+# *      m = minor version
+# *      r = release ["",A-Z but numeric]
+# *      p = patchlevel
+# 
+# Note that __NetBSD_Version__ is only in 1.3.3 and -current >= 1.3C
+#
+NETBSD_VERSION!= grep __NetBSD_Version__ /usr/include/sys/param.h | \
+			awk 'BEGIN{v=0} $$1 == "\#define" {v=$$3} END{print v}'
+
 DEPENDS+=	gd-1.*:../../graphics/gd
 DEPENDS+=	freetype-lib>=1.3.1:../../graphics/freetype-lib
 
+BUILD_DEPENDS+=	autoconf>=2.13:../../devel/autoconf
+
 WRKSRC=		${WRKDIR}/webalizer-2.01-06
 
 USE_X11=	yes
 USE_XPM=	yes
-GNU_CONFIGURE=  yes
-CONFIGURE_ARGS=	--with-gd=${LOCALBASE}/include \
-		--enable-dns
+GNU_CONFIGURE=	yes
+GNU_MAKE=	yes
+
+CONFIGURE_ARGS+=	--with-gd=${LOCALBASE}/include
+
+# the '--enable-dns' feature requires a zlib with gzrewind(), for
+# example version 1.1.3., which was introduced just prior to 1.3I
+#
+.if ${NETBSD_VERSION} >= 103090000
+CONFIGURE_ARGS+=	--enable-dns
+.endif
+
+pre-configure:
+	cd ${WRKSRC}; ${LOCALBASE}/bin/autoreconf --force
 
 post-patch:
 	@for f in webalizer.1; do \
Index: patches/patch-aa
===================================================================
RCS file: patches/patch-aa
diff -N patches/patch-aa
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-aa	29 Nov 2001 04:04:15 -0000
@@ -0,0 +1,11 @@
+--- configure.in.orig	Fri Oct  6 03:51:49 2000
++++ configure.in	Wed Nov 28 23:00:21 2001
+@@ -106,7 +106,7 @@
+ AC_CHECK_LIB(z, main,LIBZ="yes",LIBZ="no")
+ if test "$LIBZ" = "no"; then
+   AC_MSG_ERROR(z library not found... please install zlib.)
+-else
++elif test "$USE_DNS" = "yes"; then
+  AC_CHECK_LIB(z, gzrewind,LIBS="-lz ${LIBS}",LIBZ="no")
+   if test "$LIBZ" = "no"; then
+    AC_MSG_ERROR(Old version of zlib found, please upgrade!)
>Release-Note:
>Audit-Trail:
>Unformatted: