diff options
author | jlam <jlam> | 2004-11-15 17:54:49 +0000 |
---|---|---|
committer | jlam <jlam> | 2004-11-15 17:54:49 +0000 |
commit | 6732657e9b700bd4b49c74d66bb7fb40f46d3947 (patch) | |
tree | 5579b0ab6b1d842e66a7d3075d37a9f9564a124e /mk | |
parent | 6bfb6f0a57769be79c33ec7a1a13d7b34fc16865 (diff) | |
download | pkgsrc-6732657e9b700bd4b49c74d66bb7fb40f46d3947.tar.gz |
Rework the Berkeley DB detection in buildlink3:
* Add a db1.builtin.mk file that detects whether DB-1.85 functionality
exists in the base system, and remove the distinction between
"native" and the other Berkeley DB packages -- we now refer to
db[1234]. This paves the way for any future databases/db1 package.
* USE_DB185 shouldn't need to be set by any packages -- its correct
value is now automatically determined by bdb.buildlink3.mk depending
on whether we explicitly request db1 or not. By default, if you
include bdb.buildlink3.mk, you want DB-1.85 functionality and
USE_DB185 defaults to "yes", but if you explicitly remove db1 from
the list of acceptable DBs, then USE_DB185 defaults to "no".
* Set BDB_LIBS to the library options needed to link against the DB
library when bdb.buildlink3.mk is included.
* We only add the DB library to the linker command automatically if
we want DB-1.85 functionality; otherwise assume that the package
configure process can figure out how to probe for the correct
headers and libraries.
Edit package Makefiles to nuke redundant settings of USE_DB185.
Diffstat (limited to 'mk')
-rw-r--r-- | mk/bdb.buildlink3.mk | 106 | ||||
-rw-r--r-- | mk/db1.builtin.mk | 72 |
2 files changed, 120 insertions, 58 deletions
diff --git a/mk/bdb.buildlink3.mk b/mk/bdb.buildlink3.mk index b34eddc00f6..c85710d9330 100644 --- a/mk/bdb.buildlink3.mk +++ b/mk/bdb.buildlink3.mk @@ -1,9 +1,11 @@ -# $NetBSD: bdb.buildlink3.mk,v 1.11 2004/07/10 03:05:46 grant Exp $ +# $NetBSD: bdb.buildlink3.mk,v 1.12 2004/11/15 17:54:49 jlam Exp $ # # This Makefile fragment is meant to be included by packages that # require a Berkeley DB implementation. bdb.buildlink3.mk will: # # * set BDBBASE to the base directory of the Berkeley DB files; +# * set BDB_LIBS to the library option needed to link against +# the Berkeley DB library; # * set BDB_TYPE to the Berkeley DB implementation used. # # There are two variables that can be used to tweak the selection of @@ -20,13 +22,38 @@ BDB_BUILDLINK3_MK:= ${BDB_BUILDLINK3_MK}+ .include "../../mk/bsd.prefs.mk" .if !empty(BDB_BUILDLINK3_MK:M+) + +# If we've specified a list of acceptable Berkeley DB packages and it +# doesn't include db1, then don't set USE_DB185 to yes. The package's +# configure process should know how to probe for the libraries and +# headers on its own. +# +. if defined(BDB_ACCEPTED) && empty(BDB_ACCEPTED:Mdb1) +USE_DB185?= no +. else +USE_DB185?= yes +. endif + BDB_DEFAULT?= # empty BDB_ACCEPTED?= ${_BDB_PKGS} -# This is an exhaustive list of all of the Berkeley DB implementations -# that may be used with bdb.buildlink3.mk, in order of precedence. +# _BDB_PKGS is an exhaustive list of all of the Berkeley DB +# implementations that may be used with bdb.buildlink3.mk, in order +# of precedence. # -_BDB_PKGS?= native db4 db3 db2 +. if !empty(USE_DB185:M[yY][eE][sS]) +CHECK_BUILTIN.db1:= yes +. include "../../mk/db1.builtin.mk" +CHECK_BUILTIN.db1:= no +. if defined(IS_BUILTIN.db1) && !empty(IS_BUILTIN.db1:M[yY][eE][sS]) +# Prefer the builtin db1 support if we requested it +_BDB_PKGS?= db1 db4 db3 db2 +. else +_BDB_PKGS?= db4 db3 db2 db1 +. endif +. else +_BDB_PKGS?= db4 db3 db2 +. endif _BDB_PKGBASE.db2= db _BDB_PKGSRCDIR.db2= ../../databases/db @@ -41,7 +68,7 @@ _BDB_ACCEPTED= ${BDB_ACCEPTED} # Mark the acceptable Berkeley DB packages and check which, if any, are # already installed. # -. for _bdb_ in ${_BDB_ACCEPTED:Nnative} +. for _bdb_ in ${_BDB_ACCEPTED} _BDB_OK.${_bdb_}= yes . if !defined(_BDB_INSTALLED.${_bdb_}) _BDB_INSTALLED.${_bdb_}!= \ @@ -54,40 +81,12 @@ MAKEFLAGS+= _BDB_INSTALLED.${_bdb_}=${_BDB_INSTALLED.${_bdb_}} . endif . endfor -USE_DB185?= yes -_BDB_CPPFLAGS?= # empty -_BDB_LIBS?= # empty -_BDB_LDFLAGS?= # empty -_BDB_OK.native?= no -_BDB_INSTALLED.native?= no -. if exists(/usr/include/db.h) -_BDB_OK.native!= \ - if ${GREP} -q "^\#define.*HASHVERSION.*2$$" /usr/include/db.h; then \ - ${ECHO} "yes"; \ - else \ - ${ECHO} "no"; \ - fi -. if !empty(_BDB_OK.native:M[yY][eE][sS]) -_BDB_INSTALLED.native= yes -_BDB_INCDIRS= include -_BDB_TRANSFORM= # empty -_BDB_LIBS+= # empty -. endif -. endif -. if !empty(_BDB_OK.native:M[nN][oO]) && exists(/usr/include/db1/db.h) -_BDB_OK.native= yes -_BDB_INSTALLED.native= yes -_BDB_INCDIRS= include/db1 -_BDB_TRANSFORM= l:db:db1 -_BDB_LIBS+= -ldb1 -_BDB_CPPFLAGS+= -I/usr/${_BDB_INCDIRS} -. endif -. if !empty(USE_DB185:M[nN][oO]) -_BDB_OK.native= no -_BDB_INSTALLED.native= no -_BDB_INCDIRS= # empty -_BDB_TRANSFORM= # empty -_BDB_LIBS+= # empty +. if defined(USE_BUILTIN.db1) +_BDB_OK.db1= ${USE_BUILTIN.db1} +_BDB_INSTALLED.db1= ${USE_BUILTIN.db1} +. else +_BDB_OK.db1= no +_BDB_INSTALLED.db1= no . endif . if !defined(_BDB_TYPE) @@ -110,7 +109,7 @@ _BDB_TYPE?= ${_bdb_} # # ...otherwise, just use the first accepted Berkeley DB package. # -. for _bdb_ in ${_BDB_ACCEPTED:Nnative} +. for _bdb_ in ${_BDB_ACCEPTED} _BDB_TYPE?= ${_bdb_} . endfor _BDB_TYPE?= none @@ -121,27 +120,18 @@ BDB_TYPE= ${_BDB_TYPE} BUILD_DEFS+= BDB_TYPE BUILD_DEFS+= BDBBASE +# Define some public variables to refer to package-specific variables. +BDBBASE= ${BUILDLINK_PREFIX.${_BDB_PKGBASE.${BDB_TYPE}}} +BDB_LIBS= ${BUILDLINK_LDADD.${_BDB_PKGBASE.${BDB_TYPE}}} + .endif # BDB_BUILDLINK3_MK .if ${BDB_TYPE} == "none" PKG_FAIL_REASON= "No acceptable Berkeley DB implementation found." +.elif ${BDB_TYPE} == "db1" +BUILDLINK_PACKAGES:= ${BUILDLINK_PACKAGES:Ndb1} +BUILDLINK_PACKAGES+= db1 +BUILDLINK_BUILTIN_MK.db1= ../../mk/db1.builtin.mk .else -. if ${BDB_TYPE} == "native" -IS_BUILTIN.db-native= yes -USE_BUILTIN.db-native= yes -BUILDLINK_PACKAGES:= ${BUILDLINK_PACKAGES:Ndb-native} -BUILDLINK_PACKAGES+= db-native -BUILDLINK_INCDIRS.db-native?= ${_BDB_INCDIRS} -BUILDLINK_TRANSFORM?= ${_BDB_TRANSFORM} -BDBBASE= ${BUILDLINK_PREFIX.db-native} -BUILDLINK_CPPFLAGS.bdb+= ${_BDB_CPPFLAGS} -BUILDLINK_LDFLAGS.bdb+= ${_BDB_LDFLAGS} -BUILDLINK_LIBS.bdb+= ${_BDB_LIBS} -. else -BDBBASE= ${BUILDLINK_PREFIX.${_BDB_PKGBASE.${BDB_TYPE}}} -. include "${_BDB_PKGSRCDIR.${BDB_TYPE}}/buildlink3.mk" -BUILDLINK_CPPFLAGS.bdb+= ${BUILDLINK_CPPFLAGS.${BDB_TYPE}} -BUILDLINK_LDFLAGS.bdb+= ${BUILDLINK_LDFLAGS.${BDB_TYPE}} -BUILDLINK_LIBS.bdb+= ${BUILDLINK_LIBS.${BDB_TYPE}} -. endif +. include "${_BDB_PKGSRCDIR.${BDB_TYPE}}/buildlink3.mk" .endif diff --git a/mk/db1.builtin.mk b/mk/db1.builtin.mk new file mode 100644 index 00000000000..dee2f8cf3cd --- /dev/null +++ b/mk/db1.builtin.mk @@ -0,0 +1,72 @@ +# $NetBSD: db1.builtin.mk,v 1.1 2004/11/15 17:54:49 jlam Exp $ + +.for _lib_ in db db1 +. if !defined(_BLNK_LIB_FOUND.${_lib_}) +_BLNK_LIB_FOUND.${_lib_}!= \ + if ${TEST} `${ECHO} /usr/lib/lib${_lib_}.*` = "/usr/lib/lib${_lib_}.*"; then \ + ${ECHO} "no"; \ + elif ${TEST} `${ECHO} /lib/lib${_lib_}.*` = "/lib/lib${_lib_}.*"; then \ + ${ECHO} "no"; \ + else \ + ${ECHO} "yes"; \ + fi +BUILDLINK_VARS+= _BLNK_LIB_FOUND.${_lib_} +. endif +.endfor +.undef _lib_ + +.if !defined(IS_BUILTIN.db1) +IS_BUILTIN.db1= no +# +# The builtin Berkeley database library must support hash version 2 or +# else it doesn't support db-1.85 databases. +# +_BLNK_NATIVE_DB1_OK= no +. for _inc_ in /usr/include/db.h /usr/include/db1/db.h +. if exists(${_inc_}) +_BLNK_NATIVE_DB1_OK.${_inc_}!= \ + if ${GREP} -q "^\#define.*HASHVERSION.*2$$" ${_inc_}; then \ + ${ECHO} "yes"; \ + else \ + ${ECHO} "no"; \ + fi +. endif +_BLNK_NATIVE_DB1_OK+= ${_BLNK_NATIVE_DB1_OK.${_inc_}} +. endfor +. undef _inc_ +. if !empty(_BLNK_NATIVE_DB1_OK:M[yY][eE][sS]) +IS_BUILTIN.db1= yes +. endif +BUILDLINK_VARS+= IS_BUILTIN.db1 +.endif # IS_BUILTIN.db1 + +.if !defined(USE_BUILTIN.db1) +USE_BUILTIN.db1?= ${IS_BUILTIN.db1} +_INCOMPAT_DB1?= # empty +. for _pattern_ in ${_INCOMPAT_DB1} ${INCOMPAT_DB1} +. if !empty(MACHINE_PLATFORM:M${_pattern_}) +USE_BUILTIN.db1= no +. endif +. endfor +. undef _pattern_ +BUILDLINK_VARS+= USE_BUILTIN.db1 +.endif # USE_BUILTIN.db1 + +CHECK_BUILTIN.db1?= no +.if !empty(CHECK_BUILTIN.db1:M[nN][oO]) +. if !empty(USE_BUILTIN.db1:M[yY][eE][sS]) +BUILDLINK_PREFIX.db1= /usr +. if exists(/usr/include/db.h) +BUILDLINK_INCDIRS.db1= include +. elif exists(/usr/include/db1/db.h) +BUILDLINK_INCDIRS.db1= include/db1 +. endif +. if !empty(_BLNK_LIB_FOUND.db:M[yY][eE][sS]) +BUILDLINK_LIBS.db1= -ldb +. endif +. if !empty(_BLNK_LIB_FOUND.db1:M[yY][eE][sS]) +BUILDLINK_LIBS.db1= -ldb1 +BUILDLINK_TRANSFORM+= l:db:db1 +. endif +. endif # USE_BUILTIN.db1 == yes +.endif # CHECK_BUILTIN.db1 |