summaryrefslogtreecommitdiff
path: root/databases/gdbm
diff options
context:
space:
mode:
authorsbd <sbd>2011-12-03 08:44:21 +0000
committersbd <sbd>2011-12-03 08:44:21 +0000
commit70d6e4a0afd27c7e6dc566344e989b4bddc89ac4 (patch)
treedf0745ece3ed90f71ae3e75ee88b2f1ccc9a4e21 /databases/gdbm
parent361630a925e809147a286b8affda285030f1c7c6 (diff)
downloadpkgsrc-70d6e4a0afd27c7e6dc566344e989b4bddc89ac4.tar.gz
Add builtin.mk files for databases/gdbm and databases/gdbm_compat
Diffstat (limited to 'databases/gdbm')
-rw-r--r--databases/gdbm/builtin.mk69
1 files changed, 69 insertions, 0 deletions
diff --git a/databases/gdbm/builtin.mk b/databases/gdbm/builtin.mk
new file mode 100644
index 00000000000..2cfccbf5a5b
--- /dev/null
+++ b/databases/gdbm/builtin.mk
@@ -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