1 # $NetBSD: bdb.buildlink3.mk,v 1.23 2009/03/20 19:25:01 joerg Exp $
3 # This Makefile fragment is meant to be included by packages that
4 # require a Berkeley DB (BDB) implementation and that are not restricted
5 # to a single one. The available BDB implementations are db1
6 # (if builtin) and db[234].
8 # FIXME: This Makefile cannot handle packages that can use only a
9 # subset of { db2 db3 db4 }.
11 # === User-settable variables ===
14 # This value represents the package we use when either a db-1.85
15 # interface isn't required, or a db-1.85 interface is required,
16 # but it's not built-in.
18 # FIXME: Improve the wording of the text above so that one can
21 # Possible: db1 db2 db3 db4 db5
25 # The package we use when a db-1.85 interface is required.
26 # It defaults to "db1" if it's built-in, or to ${BDB_DEFAULT}
29 # === Package-settable variables ===
32 # The list of Berkeley DB implementations that can be used by the
35 # FIXME: If the list does not include db1 and does not include
36 # BDB_DEFAULT, the package will not build at the moment.
38 # === Variables set by this file ===
41 # The name of the selected BDB implementation.
44 # The base directory of the selected BDB implementation. It has
45 # subdirectories include/ and lib/.
48 # Linker flags to link against the BDB library.
50 # Note for when databases/db1 is imported:
51 # (1) Remove the section that conditionally sets the default
52 # value for BDB185_DEFAULT and always set it to be "db1".
53 # (2) Remove the special case for ${BDB_TYPE} == "db1" at the end.
54 # (3) Move mk/db1.builtin.mk to databases/db1/builtin.mk.
56 BDB_BUILDLINK3_MK
:= ${BDB_BUILDLINK3_MK}+
58 .
include "bsd.fast.prefs.mk"
60 .if
!empty
(BDB_BUILDLINK3_MK
:M
+)
63 _USER_VARS.bdb
= BDB_DEFAULT BDB185_DEFAULT
64 _PKG_VARS.bdb
= BDB_ACCEPTED
65 _SYS_VARS.bdb
= BDB_TYPE BDBBASE BDB_LIBS
67 # If the package specified a list of acceptable Berkeley DB packages,
68 # set USE_DB185 to yes if db1 is included, and otherwise no, thus
69 # preferring to use db1. Assume that the package's configure process
70 # should know how to probe for the libraries and headers on its own.
72 . if defined
(BDB_ACCEPTED
) && empty
(BDB_ACCEPTED
:Mdb1
)
78 # _BDB_PKGS is an exhaustive list of all of the Berkeley DB
79 # implementations that may be used with bdb.buildlink3.mk.
81 _BDB_PKGS?
= db1 db2 db3 db4 db5
84 BDB_ACCEPTED?
= ${_BDB_PKGS}
86 # Decide what to use when DB185 is required. If builtin db1 is
87 # present, use it, and if not use DBD_DEFAULT.
89 CHECK_BUILTIN.db1
:= yes
90 .
include "db1.builtin.mk"
91 CHECK_BUILTIN.db1
:= no
92 . if defined
(IS_BUILTIN.db1
) && !empty
(IS_BUILTIN.db1
:M
[yY
][eE
][sS
])
95 BDB185_DEFAULT?
= ${BDB_DEFAULT}
98 _BDB_PKGSRCDIR.db2
= ..
/..
/databases
/db
99 . for _bdb_ in
${_BDB_PKGS}
100 _BDB_PKGSRCDIR.
${_bdb_}?
= ..
/..
/databases
/${_bdb_}
103 _BDB_DEFAULT
= ${BDB_DEFAULT}
104 _BDB185_DEFAULT
= ${BDB185_DEFAULT}
105 _BDB_ACCEPTED
= ${BDB_ACCEPTED}
107 . if
!defined
(_BDB_TYPE
)
108 . if
!empty
(USE_DB185
:M
[yY
][eE
][sS
])
109 _BDB_TYPE
= ${_BDB185_DEFAULT}
111 _BDB_TYPE
= ${_BDB_DEFAULT}
115 # Note that if BDB_ACCEPTED does not contain db1 or BDB_DEFAULT, this
116 # results in BDB_TYPE being none (rather than the most preferred value
117 # in BDB_ACCEPTED, which might or might not be better.)
118 . if
!empty
(_BDB_ACCEPTED
:M
${_BDB_TYPE})
119 BDB_TYPE
= ${_BDB_TYPE}
124 # Define some public variables to refer to package-specific variables.
125 BDBBASE
= ${BUILDLINK_PREFIX.
${BDB_TYPE}}
126 BDB_LIBS
= ${BUILDLINK_LDADD.
${BDB_TYPE}}
128 BUILD_DEFS
+= BDB_DEFAULT BDB185_DEFAULT
129 BUILD_DEFS_EFFECTS
+= BDBBASE BDB_LIBS BDB_TYPE
131 .
endif # BDB_BUILDLINK3_MK
133 .if
${BDB_TYPE} == "none"
135 "[bdb.buildlink3.mk] ${_BDB_TYPE} is not an acceptable Berkeley DB type for ${PKGNAME}."
136 .elif
${BDB_TYPE} == "db1"
137 BUILDLINK_TREE
+= db1
-db1
138 BUILDLINK_BUILTIN_MK.db1
= ..
/..
/mk
/db1.builtin.mk
140 .
include "${_BDB_PKGSRCDIR.${BDB_TYPE}}/buildlink3.mk"