2004-11-15 18:54:49 +01:00
|
|
|
# $NetBSD: bdb.buildlink3.mk,v 1.12 2004/11/15 17:54:49 jlam Exp $
|
2004-03-10 19:06:06 +01:00
|
|
|
#
|
|
|
|
# This Makefile fragment is meant to be included by packages that
|
2004-05-26 22:26:29 +02:00
|
|
|
# require a Berkeley DB implementation. bdb.buildlink3.mk will:
|
2004-03-10 19:06:06 +01:00
|
|
|
#
|
|
|
|
# * set BDBBASE to the base directory of the Berkeley DB files;
|
2004-11-15 18:54:49 +01:00
|
|
|
# * set BDB_LIBS to the library option needed to link against
|
|
|
|
# the Berkeley DB library;
|
2004-03-10 19:06:06 +01:00
|
|
|
# * set BDB_TYPE to the Berkeley DB implementation used.
|
|
|
|
#
|
|
|
|
# There are two variables that can be used to tweak the selection of
|
|
|
|
# the Berkeley DB implementation:
|
|
|
|
#
|
|
|
|
# BDB_DEFAULT is a user-settable variable whose value is the default
|
|
|
|
# Berkeley DB implementation to use.
|
|
|
|
#
|
|
|
|
# BDB_ACCEPTED is a package-settable list of Berkeley DB implementations
|
|
|
|
# that may be used by the package.
|
|
|
|
|
|
|
|
BDB_BUILDLINK3_MK:= ${BDB_BUILDLINK3_MK}+
|
|
|
|
|
|
|
|
.include "../../mk/bsd.prefs.mk"
|
|
|
|
|
2004-03-18 10:12:08 +01:00
|
|
|
.if !empty(BDB_BUILDLINK3_MK:M+)
|
2004-11-15 18:54:49 +01:00
|
|
|
|
|
|
|
# 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
|
|
|
|
|
2004-03-10 19:06:06 +01:00
|
|
|
BDB_DEFAULT?= # empty
|
|
|
|
BDB_ACCEPTED?= ${_BDB_PKGS}
|
|
|
|
|
2004-11-15 18:54:49 +01:00
|
|
|
# _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.
|
2004-03-10 19:06:06 +01:00
|
|
|
#
|
2004-11-15 18:54:49 +01:00
|
|
|
. 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
|
2004-03-10 19:06:06 +01:00
|
|
|
|
|
|
|
_BDB_PKGBASE.db2= db
|
2004-04-26 11:39:38 +02:00
|
|
|
_BDB_PKGSRCDIR.db2= ../../databases/db
|
2004-03-10 19:06:06 +01:00
|
|
|
. for _bdb_ in ${_BDB_PKGS}
|
2004-04-26 11:39:38 +02:00
|
|
|
_BDB_PKGBASE.${_bdb_}?= ${_bdb_}
|
|
|
|
_BDB_PKGSRCDIR.${_bdb_}?= ../../databases/${_bdb_}
|
2004-03-10 19:06:06 +01:00
|
|
|
. endfor
|
|
|
|
|
|
|
|
_BDB_DEFAULT= ${BDB_DEFAULT}
|
|
|
|
_BDB_ACCEPTED= ${BDB_ACCEPTED}
|
|
|
|
|
|
|
|
# Mark the acceptable Berkeley DB packages and check which, if any, are
|
|
|
|
# already installed.
|
|
|
|
#
|
2004-11-15 18:54:49 +01:00
|
|
|
. for _bdb_ in ${_BDB_ACCEPTED}
|
2004-03-10 19:06:06 +01:00
|
|
|
_BDB_OK.${_bdb_}= yes
|
|
|
|
. if !defined(_BDB_INSTALLED.${_bdb_})
|
|
|
|
_BDB_INSTALLED.${_bdb_}!= \
|
2004-03-11 09:33:52 +01:00
|
|
|
if ${PKG_INFO} -qe ${_BDB_PKGBASE.${_bdb_}}; then \
|
2004-03-10 19:06:06 +01:00
|
|
|
${ECHO} "yes"; \
|
|
|
|
else \
|
|
|
|
${ECHO} "no"; \
|
|
|
|
fi
|
|
|
|
MAKEFLAGS+= _BDB_INSTALLED.${_bdb_}=${_BDB_INSTALLED.${_bdb_}}
|
|
|
|
. endif
|
|
|
|
. endfor
|
|
|
|
|
2004-11-15 18:54:49 +01:00
|
|
|
. 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
|
2004-03-10 19:06:06 +01:00
|
|
|
. endif
|
|
|
|
|
2004-03-18 10:12:08 +01:00
|
|
|
. if !defined(_BDB_TYPE)
|
2004-03-10 19:06:06 +01:00
|
|
|
#
|
|
|
|
# Prefer the default one if it's accepted,...
|
|
|
|
#
|
|
|
|
. if !empty(_BDB_DEFAULT) && \
|
|
|
|
defined(_BDB_OK.${_BDB_DEFAULT}) && \
|
|
|
|
!empty(_BDB_OK.${_BDB_DEFAULT}:M[yY][eE][sS])
|
2004-03-18 10:12:08 +01:00
|
|
|
_BDB_TYPE= ${_BDB_DEFAULT}
|
2004-03-10 19:06:06 +01:00
|
|
|
. endif
|
|
|
|
#
|
|
|
|
# ...otherwise, use one of the installed Berkeley DB packages,...
|
|
|
|
#
|
|
|
|
. for _bdb_ in ${_BDB_ACCEPTED}
|
|
|
|
. if !empty(_BDB_INSTALLED.${_bdb_}:M[yY][eE][sS])
|
2004-03-18 10:12:08 +01:00
|
|
|
_BDB_TYPE?= ${_bdb_}
|
2004-03-10 19:06:06 +01:00
|
|
|
. endif
|
|
|
|
. endfor
|
|
|
|
#
|
|
|
|
# ...otherwise, just use the first accepted Berkeley DB package.
|
|
|
|
#
|
2004-11-15 18:54:49 +01:00
|
|
|
. for _bdb_ in ${_BDB_ACCEPTED}
|
2004-05-30 12:40:02 +02:00
|
|
|
_BDB_TYPE?= ${_bdb_}
|
|
|
|
. endfor
|
2004-03-18 10:12:08 +01:00
|
|
|
_BDB_TYPE?= none
|
|
|
|
MAKEFLAGS+= _BDB_TYPE=${_BDB_TYPE}
|
2004-03-10 19:06:06 +01:00
|
|
|
. endif
|
|
|
|
|
2004-03-18 10:12:08 +01:00
|
|
|
BDB_TYPE= ${_BDB_TYPE}
|
2004-03-10 19:06:06 +01:00
|
|
|
BUILD_DEFS+= BDB_TYPE
|
2004-04-15 13:11:57 +02:00
|
|
|
BUILD_DEFS+= BDBBASE
|
2004-03-10 19:06:06 +01:00
|
|
|
|
2004-11-15 18:54:49 +01:00
|
|
|
# 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}}}
|
|
|
|
|
2004-03-18 10:12:08 +01:00
|
|
|
.endif # BDB_BUILDLINK3_MK
|
|
|
|
|
|
|
|
.if ${BDB_TYPE} == "none"
|
2004-03-10 19:06:06 +01:00
|
|
|
PKG_FAIL_REASON= "No acceptable Berkeley DB implementation found."
|
2004-11-15 18:54:49 +01:00
|
|
|
.elif ${BDB_TYPE} == "db1"
|
|
|
|
BUILDLINK_PACKAGES:= ${BUILDLINK_PACKAGES:Ndb1}
|
|
|
|
BUILDLINK_PACKAGES+= db1
|
|
|
|
BUILDLINK_BUILTIN_MK.db1= ../../mk/db1.builtin.mk
|
2004-03-18 10:12:08 +01:00
|
|
|
.else
|
2004-11-15 18:54:49 +01:00
|
|
|
. include "${_BDB_PKGSRCDIR.${BDB_TYPE}}/buildlink3.mk"
|
2004-03-18 10:12:08 +01:00
|
|
|
.endif
|