pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: is archivers/bzip2/builtin.mk correct/complete?



Johnny C. Lam wrote:

> When I wrote that file, I left it open how the bzip2 version could be
> determined, even to the point of allowing a knowledgeable user to set
> BUILTIN_PKG.bzip2 directly in /etc/mk.conf.  I wasn't able to find a
> reliable way to determine the bzip2 version number, but please let me
> know if there is one.

I tried to download as many versions of bzip2 as I could find to see
whether the file in question (bzlib.h) provided any means to determine the
version. As far as I can see, there is no really clean way, but I think
the attached patch could be usable.
This awk script can extract the version for

  bzlib.h-0.9.0
  bzlib.h-0.9.0b
  bzlib.h-0.9.0c
  bzlib.h-0.9.5d
  bzlib.h-1.0.0
  bzlib.h-1.0.2
  bzlib.h-1.0.3

For bzip2 1.0.1 the file bzlib.h is exactly the same as for version
1.0.0 and the change log says:

  1.0.1
  ~~~~~
  * Modified dlltest.c so it uses the new BZ2_ naming scheme.
  * Modified makefile-msc to fix minor build probs on Win2k.
  * Updated README.COMPILATION.PROBLEMS.

  There are no functionality changes or bug fixes relative to version
  1.0.0.  This is just a documentation update + a fix for minor Win32
  build problems.  For almost everyone, upgrading from 1.0.0 to 1.0.1 is
  utterly pointless.  Don't bother.

so I find it acceptable that the awk script computes 1.0 for both versions.

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.


The attached patch also includes my proposed simplification for
bzip2/builtin.mk which I think should also be applied to the example in
bsd.builtin.mk.

ciao
     Klaus
Index: builtin.mk
===================================================================
RCS file: /cvsroot/pkgsrc/archivers/bzip2/builtin.mk,v
retrieving revision 1.6
diff -u -r1.6 builtin.mk
--- builtin.mk  6 Apr 2006 06:21:32 -0000       1.6
+++ builtin.mk  3 Jun 2006 20:15:14 -0000
@@ -21,6 +21,30 @@
 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" ) {                          \
+                               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").
 ###
@@ -31,16 +55,13 @@
 USE_BUILTIN.bzip2=     ${IS_BUILTIN.bzip2}
 .    if defined(BUILTIN_PKG.bzip2) && \
         !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
 #


Home | Main Index | Thread Index | Old Index