Add builtin.mk files for databases/gdbm and databases/gdbm_compat

This commit is contained in:
sbd 2011-12-03 08:44:21 +00:00
parent b9800ec3aa
commit dece2900e9
2 changed files with 128 additions and 0 deletions

69
databases/gdbm/builtin.mk Normal file
View file

@ -0,0 +1,69 @@
# $NetBSD: builtin.mk,v 1.1 2011/12/03 08:44:21 sbd Exp $
BUILTIN_PKG:= gdbm
BUILTIN_FIND_FILES_VAR= GDBM_H
BUILTIN_FIND_FILES.GDBM_H= /usr/include/gdbm.h
.include "../../mk/buildlink3/bsd.builtin.mk"
###
### Determine if there is a built-in implementation of the package and
### set IS_BUILTIN.<pkg> appropriately ("yes" or "no").
###
.if !defined(IS_BUILTIN.gdbm)
IS_BUILTIN.gdbm= no
. if empty(GDBM_H:M__nonexistent__)
IS_BUILTIN.gdbm= yes
. endif
.endif
MAKEVARS+= IS_BUILTIN.gdbm
###
### 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.gdbm) && \
!empty(IS_BUILTIN.gdbm:M[yY][eE][sS])
BUILTIN_PKG.gdbm!= \
${AWK} '/\#define[ ]*GDBM_VERSION_MAJOR/{major=$$3} \
/\#define[ ]*GDBM_VERSION_MINOR/{minor=$$3} \
/\#define[ ]*GDBM_VERSION_PATCH/{patch=$$3} \
/\#define[ ]*GDBM_OPT_ILLEGAL/{illegal=$$3} \
END { \
if(major != "" && minor != "" && patch !="") \
printf("gdbm-%d.%d.%d", major, minor, patch); \
else if ( illegal == "20" ) \
print "gdbm-1.8.3"; \
else \
print "gdbm-1.0" \
} \
' ${GDBM_H:Q}
.endif
MAKEVARS+= BUILTIN_PKG.gdbm
###
### Determine whether we should use the built-in implementation if it
### exists, and set USE_BUILTIN.<pkg> appropriate ("yes" or "no").
###
.if !defined(USE_BUILTIN.gdbm)
. if ${PREFER.gdbm} == "pkgsrc"
USE_BUILTIN.gdbm= no
. else
USE_BUILTIN.gdbm= ${IS_BUILTIN.gdbm}
. if defined(BUILTIN_PKG.gdbm) && \
!empty(IS_BUILTIN.gdbm:M[yY][eE][sS])
USE_BUILTIN.gdbm= yes
. for _dep_ in ${BUILDLINK_API_DEPENDS.gdbm}
. if !empty(USE_BUILTIN.gdbm:M[yY][eE][sS])
USE_BUILTIN.gdbm!= \
if ${PKG_ADMIN} pmatch ${_dep_:Q} ${BUILTIN_PKG.gdbm:Q}; then \
${ECHO} "yes"; \
else \
${ECHO} "no"; \
fi
. endif
. endfor
. endif
. endif
.endif
MAKEVARS+= USE_BUILTIN.gdbm

View file

@ -0,0 +1,59 @@
# $NetBSD: builtin.mk,v 1.1 2011/12/03 08:44:21 sbd Exp $
BUILTIN_PKG:= gdbm_compat
BUILTIN_FIND_FILES_VAR= NDBM_H
BUILTIN_FIND_FILES.NDBM_H= /usr/include/ndbm.h
BUILTIN_FIND_GREP.NDBM_H= This file is part of GDBM
.include "../../mk/buildlink3/bsd.builtin.mk"
###
### Determine if there is a built-in implementation of the package and
### set IS_BUILTIN.<pkg> appropriately ("yes" or "no").
###
.if !defined(IS_BUILTIN.gdbm_compat)
IS_BUILTIN.gdbm_compat= no
. if empty(NDBM_H:M__nonexistent__)
IS_BUILTIN.gdbm_compat= yes
. endif
.endif
MAKEVARS+= IS_BUILTIN.gdbm_compat
###
### 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.gdbm_compat) && \
!empty(IS_BUILTIN.gdbm_compat:M[yY][eE][sS])
.include "../../databases/gdbm/builtin.mk"
BUILTIN_PKG.gdbm_compat:= ${BUILTIN_PKG.gdbm:S/gdbm-/gdbm_compat-/}
.endif
MAKEVARS+= BUILTIN_PKG.gdbm_compat
###
### Determine whether we should use the built-in implementation if it
### exists, and set USE_BUILTIN.<pkg> appropriate ("yes" or "no").
###
### Don't use builtin gdbm_compat unless also using builtin gdbm.
.if !defined(USE_BUILTIN.gdbm_compat)
. if ${USE_BUILTIN.gdbm} == "no" || ${PREFER.gdbm_compat} == "pkgsrc"
USE_BUILTIN.gdbm_compat= no
. else
USE_BUILTIN.gdbm_compat= ${IS_BUILTIN.gdbm_compat}
. if defined(BUILTIN_PKG.gdbm_compat) && \
!empty(IS_BUILTIN.gdbm_compat:M[yY][eE][sS])
USE_BUILTIN.gdbm_compat= yes
. for _dep_ in ${BUILDLINK_API_DEPENDS.gdbm_compat}
. if !empty(USE_BUILTIN.gdbm_compat:M[yY][eE][sS])
USE_BUILTIN.gdbm_compat!= \
if ${PKG_ADMIN} pmatch ${_dep_:Q} ${BUILTIN_PKG.gdbm_compat:Q}; then \
${ECHO} "yes"; \
else \
${ECHO} "no"; \
fi
. endif
. endfor
. endif
. endif
.endif
MAKEVARS+= USE_BUILTIN.gdbm_compat