Subject: is archivers/bzip2/builtin.mk correct/complete?
To: None <pkgsrc-users@NetBSD.org>
From: Klaus Heinz <k.heinz.jun.sechs@onlinehome.de>
List: pkgsrc-users
Date: 06/03/2006 18:24:06
Hi,

while looking at archivers/bzip2/builtin.mk (v1.6) I wondered whether
it is really complete.

The file refers to BUILTIN_PKG.bzip2 but this variable is, in
contrast to the example in bsd.builtin.mk, not defined anywhere I can
see.
Isn't there supposed to be a "made-up" package version for the
builtin bzip library? At least devel/zlib/builtin.mk goes to some length
to do just that.

If it is correct for BUILTIN_PKG.bzip2 not to be defined, the whole
section

.    if defined(BUILTIN_PKG.bzip2) && \
        !empty(IS_BUILTIN.bzip2:M[yY][eE][sS])
...
.    endif

is unnecessary.

On the other hand, if BUILTIN_PKG.bzip2 is only missing, this section
could be simplified thus

@@ -31,16 +31,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
 #

We do not need to set USE_BUILTIN.bzip2 to "yes" or test against this with
".if" because the fact that !empty(IS_BUILTIN.bzip2:M[yY][eE][sS]) is true
implies that !empty(USE_BUILTIN.bzip2:M[yY][eE][sS]) is also true because
of the assignment at line 31.

Since this part is almost a copy of the example in bsd.builtin.mk, I think
the example could be changed in the same way.

ciao
     Klaus

PS: I am looking at how to determine a version number for builtin bzip2.