Subject: Re: is archivers/bzip2/builtin.mk correct/complete?
To: None <pkgsrc-users@NetBSD.org>
From: Klaus Heinz <k.heinz.jul.sechs@onlinehome.de>
List: pkgsrc-users
Date: 07/05/2006 21:14:00
--xXmbgvnjoT4axfJE
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Klaus Heinz wrote:

> For consistency's sake we should either call this 1.0.0 or 1.0.1 for
> both versions. If we choose the former we probably should also change
> BUILDLINK_API_DEPENDS.bzip2 to bzip2>=1.0.0 in buildlink3.mk.

Since bzip2 1.0.0 and 1.0.1 are the same for all practical purposes I
chose for the awk script to call both versions 1.0.1. This lets us keep
buildlink3.mk and any requirements in other packages as they are now.

If nobody objects to the slightly revised patch I will commit this at
the weekend.

ciao
     Klaus

--xXmbgvnjoT4axfJE
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="builtin.mk.diff2"

--- builtin.mk.orig	2006-06-03 16:18:34.000000000 +0200
+++ builtin.mk	2006-07-05 21:07:12.000000000 +0200
@@ -21,6 +21,31 @@
 MAKEVARS+=	IS_BUILTIN.bzip2
 
 ###
+### If there is a built-in implementation, then set BUILTIN_PKG.<pkg> to
+### a package name to represent the built-in package.
+###
+.if !defined(BUILTIN_PKG.bzip2) && \
+    !empty(IS_BUILTIN.bzip2:M[yY][eE][sS])
+BUILTIN_VERSION.bzip2!=							\
+	${AWK} '/Copyright[ 	]+\(C\).*rights[ 	]+reserved/ {	\
+			years=$$3;					\
+		}							\
+		/bzip2\/libbzip2[ 	]+version[ 	]+/ {		\
+			vers=$$3;					\
+			if ( vers == "1.0" ) {				\
+				vers="1.0.1"				\
+				if ( years == "1996-2002" ) vers="1.0.2";\
+				if ( years == "1996-2005" ) vers="1.0.3";\
+			};						\
+			print vers;					\
+		};							\
+	' ${H_BZIP2:Q}
+
+BUILTIN_PKG.bzip2=	bzip2-${BUILTIN_VERSION.bzip2}
+.endif
+MAKEVARS+=    BUILTIN_PKG.bzip2
+
+###
 ### Determine whether we should use the built-in implementation if it
 ### exists, and set USE_BUILTIN.<pkg> appropriate ("yes" or "no").
 ###
@@ -33,14 +58,12 @@
         !empty(IS_BUILTIN.bzip2:M[yY][eE][sS])
 USE_BUILTIN.bzip2=	yes
 .      for _dep_ in ${BUILDLINK_API_DEPENDS.bzip2}
-.        if !empty(USE_BUILTIN.bzip2:M[yY][eE][sS])
 USE_BUILTIN.bzip2!=							\
 	if ${PKG_ADMIN} pmatch ${_dep_:Q} ${BUILTIN_PKG.bzip2:Q}; then	\
 		${ECHO} yes;						\
 	else								\
 		${ECHO} no;						\
 	fi
-.        endif
 .      endfor
 .    endif
 #

--xXmbgvnjoT4axfJE--