freebsd-ports/Mk/bsd.database.mk

235 lines
7.2 KiB
Makefile
Raw Normal View History

* Add bsd.database.mk [1] - move out from bsd.port.mk USE_MYSQL and USE_PGSQL. - add support for Berkley DB and SQLite (via USE_BDB and USE_SQLITE knobs). * Espace '+' in make search [2] * Add "makepatch" target to simplify creation of patches during porting [3] * Replace deprecated MACHINE_ARCH with ARCH [4] * Remove support of OpenLDAP 2.1 [5] * Add bsd.tcl.mk [6] It introduces USE_TCL/USE_TCL_BUILD knobs to support various version of tcl (8.0 -> 8.4) * Fix cosmetic bugs in security-check target [7] * Add support for INDEX-7 and above (up to INDEX-9 actually) [8] * Add "package-recursive" to bsd.port.subdir.mk [9] * Remove check for FreeBSD version < 460101 [10] * New category: net-im [11] * Add .desktop file facilities It introduces DESKTOPDIR and DESKTOP_ENTRIES knobs [12] * Add SHA256 support to "*checksum" targets [13] * Fix USE_PYTHON with OPTIONS [14] * Force NO_LINT to MAKE_ENV to avoid library breaks [15] * Fix typo: s/RC_ORDER/USE_RCORDER/g [16] * Add support for PostgreSQL 8.1 [17] * Add bsd.apache.mk USE_APACHE knob enhancements [18] PR: ports/85695 [1], ports/85669 [2], ports/85488 [3], ports/84489 [4], ports/83835 [5], ports/83718 [6], ports/83716 [7], ports/83710 [8], ports/82753 [9], ports/82138 [10], ports/81206 [11], ports/79509 [12], ports/79123 [13], ports/74866 [14], ports/85490 [15], ports/83514 [16], ports/88466 [17] Submitted by: vsevolod [1] [6], Ricardo Alves dos Reis <ricardo_bsd@yahoo.com.br> [2], markm [3] [15], obrien [4], krion [5] [8] , Petr Rehor <prehor@gmail.com> [7], clement [8] [18], jhs@berklix.org [9], edwin [10] [13], pav [11], jylefort [12], mnag [14], leeym [16], girgen [17]
2005-11-08 04:02:51 -05:00
# -*- mode: Makefile; tab-width: 4; -*-
# ex: ts=4
#
# $FreeBSD$
#
.if defined(_POSTMKINCLUDED) && !defined(Database_Post_Include)
Database_Post_Include= bsd.database.mk
Database_Include_MAINTAINER= vsevolod@FreeBSD.org
# This file contains some routines to interact with different databases, such
# as mysql, postgresql and berkley DB. For including this file define macro
# USE_[DATABASE], for example USE_MYSQL. Defining macro like USE_[DATABASE]_VER
# or WANT_[DATABSE]_VER will include this file too.
#
##
# USE_MYSQL - Add MySQL client dependency.
# If no version is given (by the maintainer via the port or
# by the user via defined variable), try to find the
# currently installed version. Fall back to default if
# necessary (MySQL4.1 = 41).
# DEFAULT_MYSQL_VER
# - MySQL default version. Can be overriden within a port.
# Default: 41.
# WANT_MYSQL_VER
# - Maintainer can set an arbitrary version of MySQL by using it.
# BROKEN_WITH_MYSQL
# - This variable can be defined if the ports doesn't support
# one or more version of MySQL.
# MYSQL_VER - Internal variable for MySQL version.
# WITH_MYSQL_VER
# - User defined variable to set MySQL version.
##
# USE_PGSQL - Add PostgreSQL client dependency.
# If no version is given (by the maintainer via the port or
# by the user via defined variable), try to find the
# currently installed version. Fall back to default if
# necessary (PostgreSQL-7.4 = 74).
# DEFAULT_PGSQL_VER
# - PostgreSQL default version. Can be overridden within a port.
# Default: 74.
# WANT_PGSQL_VER
# - Maintainer can set an arbitrary version of PostgreSQL by
# using it.
# BROKEN_WITH_PGSQL
# - This variable can be defined if the ports doesn't support
# one or more versions of PostgreSQL.
##
# USE_BDB - Add Berkley DB library dependency.
# If no version is given (by the maintainer via the port or
# by the user via defined variable), try to find the
# currently installed version. Fall back to default if
# necessary (db41+).
##
# USE_SQLITE - Add dependency on sqlite library. Valid values are:
# 3 and 2. If version is not specified directly then
# sqlite3 is used (if USE_SQLITE= yes).
.if defined(USE_MYSQL)
DEFAULT_MYSQL_VER?= 41
# MySQL client version currently supported.
MYSQL323_LIBVER= 10
MYSQL40_LIBVER= 12
MYSQL41_LIBVER= 14
MYSQL50_LIBVER= 15
# Setting/finding MySQL version we want.
.if exists(${LOCALBASE}/bin/mysql)
_MYSQL_VER!= ${LOCALBASE}/bin/mysql --version | ${SED} -e 's/.*Distrib \([0-9]\)\.\([0-9]*\).*/\1\2/'
.endif
.if defined(WANT_MYSQL_VER)
.if defined(WITH_MYSQL_VER) && ${WITH_MYSQL_VER} != ${WANT_MYSQL_VER}
BROKEN= The port wants mysql${WANT_MYSQL_VER}-client and you try to install mysql${WITH_MYSQL_VER}-client.
.endif
MYSQL_VER= ${WANT_MYSQL_VER}
.elif defined(WITH_MYSQL_VER)
MYSQL_VER= ${WITH_MYSQL_VER}
.else
.if defined(_MYSQL_VER)
MYSQL_VER= ${_MYSQL_VER}
.else
MYSQL_VER= ${DEFAULT_MYSQL_VER}
.endif
.endif # WANT_MYSQL_VER
.if defined(_MYSQL_VER)
.if ${_MYSQL_VER} != ${MYSQL_VER}
BROKEN= MySQL versions mismatch: mysql${_MYSQL_VER}-client is installed and wanted version is mysql${MYSQL_VER}-client
.endif
.endif
# And now we are checking if we can use it
.if defined(MYSQL${MYSQL_VER}_LIBVER)
.if defined(BROKEN_WITH_MYSQL)
. for VER in ${BROKEN_WITH_MYSQL}
. if (${MYSQL_VER} == "${VER}")
IGNORE= Doesn't work with MySQL version : ${MYSQL_VER} (Doesn't support MySQL ${BROKEN_WITH_MYSQL})
* Add bsd.database.mk [1] - move out from bsd.port.mk USE_MYSQL and USE_PGSQL. - add support for Berkley DB and SQLite (via USE_BDB and USE_SQLITE knobs). * Espace '+' in make search [2] * Add "makepatch" target to simplify creation of patches during porting [3] * Replace deprecated MACHINE_ARCH with ARCH [4] * Remove support of OpenLDAP 2.1 [5] * Add bsd.tcl.mk [6] It introduces USE_TCL/USE_TCL_BUILD knobs to support various version of tcl (8.0 -> 8.4) * Fix cosmetic bugs in security-check target [7] * Add support for INDEX-7 and above (up to INDEX-9 actually) [8] * Add "package-recursive" to bsd.port.subdir.mk [9] * Remove check for FreeBSD version < 460101 [10] * New category: net-im [11] * Add .desktop file facilities It introduces DESKTOPDIR and DESKTOP_ENTRIES knobs [12] * Add SHA256 support to "*checksum" targets [13] * Fix USE_PYTHON with OPTIONS [14] * Force NO_LINT to MAKE_ENV to avoid library breaks [15] * Fix typo: s/RC_ORDER/USE_RCORDER/g [16] * Add support for PostgreSQL 8.1 [17] * Add bsd.apache.mk USE_APACHE knob enhancements [18] PR: ports/85695 [1], ports/85669 [2], ports/85488 [3], ports/84489 [4], ports/83835 [5], ports/83718 [6], ports/83716 [7], ports/83710 [8], ports/82753 [9], ports/82138 [10], ports/81206 [11], ports/79509 [12], ports/79123 [13], ports/74866 [14], ports/85490 [15], ports/83514 [16], ports/88466 [17] Submitted by: vsevolod [1] [6], Ricardo Alves dos Reis <ricardo_bsd@yahoo.com.br> [2], markm [3] [15], obrien [4], krion [5] [8] , Petr Rehor <prehor@gmail.com> [7], clement [8] [18], jhs@berklix.org [9], edwin [10] [13], pav [11], jylefort [12], mnag [14], leeym [16], girgen [17]
2005-11-08 04:02:51 -05:00
. endif
. endfor
.endif # BROKEN_WITH_MYSQL
LIB_DEPENDS+= mysqlclient.${MYSQL${MYSQL_VER}_LIBVER}:${PORTSDIR}/databases/mysql${MYSQL_VER}-client
.else
IGNORE= "Unknown MySQL version: ${MYSQL_VER}"
.endif # Check for correct libs
.endif # USE_MYSQL
.if defined(USE_PGSQL)
DEFAULT_PGSQL_VER?= 74
PGSQL73_LIBVER= 3
PGSQL74_LIBVER= 3
PGSQL80_LIBVER= 4
PGSQL81_LIBVER= 4
# Setting/finding PostgreSQL version we want.
.if exists(${LOCALBASE}/bin/pg_config)
_PGSQL_VER!= ${LOCALBASE}/bin/pg_config --version | ${SED} -n 's/PostgreSQL[^0-9]*\([0-9][0-9]*\)\.\([0-9][0-9]*\)[^0-9].*/\1\2/p'
.endif
.if defined(WANT_PGSQL_VER) && defined(_PGSQL_VER) && ${WANT_PGSQL_VER} != ${_PGSQL_VER}
BROKEN= the port wants postgresql${WANT_PGSQL_VER}-client but you have postgresql${_PGSQL_VER}-client installed
.endif
.if defined(_PGSQL_VER)
PGSQL_VER= ${_PGSQL_VER}
.elif defined(WANT_PGSQL_VER)
PGSQL_VER= ${WANT_PGSQL_VER}
.else
PGSQL_VER= ${DEFAULT_PGSQL_VER}
.endif
# And now we are checking if we can use it
.if defined(PGSQL${PGSQL_VER}_LIBVER)
.if defined(BROKEN_WITH_PGSQL)
. for VER in ${BROKEN_WITH_PGSQL}
. if (${PGSQL_VER} == "${VER}")
IGNORE= "Does not work with postgresql${PGSQL_VER}-client PostgresSQL \(${BROKEN_WITH_PGSQL} not supported\)"
. endif
. endfor
.endif # BROKEN_WITH_PGSQL
LIB_DEPENDS+= pq.${PGSQL${PGSQL_VER}_LIBVER}:${PORTSDIR}/databases/postgresql${PGSQL_VER}-client
.else
IGNORE= "Unknown PostgreSQL version: ${PGSQL_VER}"
.endif # Check for correct version
CPPFLAGS+= -I${LOCALBASE}/include
LDFLAGS+= -L${LOCALBASE}/lib
CONFIGURE_ENV+= CPPFLAGS="${CPPFLAGS}" LDFLAGS="${LDFLAGS}"
.endif # USE_PGSQL
.if defined(USE_BDB)
_DB_PORTS= 2 3 40 41 42 43 40+ 41+ 42+ 43+
# Dependence lines for different db versions
db2_DEPENDS= db2.0:${PORTSDIR}/databases/db2
db3_DEPENDS= db3.3:${PORTSDIR}/databases/db3
db40_DEPENDS= db4.0:${PORTSDIR}/databases/db4
db41_DEPENDS= db41.1:${PORTSDIR}/databases/db41
db42_DEPENDS= db-4.2.2:${PORTSDIR}/databases/db42
db43_DEPENDS= db-4.3.0:${PORTSDIR}/databases/db43
# Detect db4 versions by finding some files
db40_FIND= ${PREFIX}/include/db4/db.h
db41_FIND= ${PREFIX}/include/db41/db.h
db42_FIND= ${PREFIX}/include/db42/db.h
db43_FIND= ${PREFIX}/include/db43/db.h
# For specifying 40+ 41+ 42+
_DB_40P= 40 41 42 43
_DB_41P= 41 42 43
_DB_42P= 42 43
_WANT_BDB_VER= ${USE_BDB}
# Assume the default bdb version as 41
.if ${USE_BDB:L} == "yes"
* Add bsd.database.mk [1] - move out from bsd.port.mk USE_MYSQL and USE_PGSQL. - add support for Berkley DB and SQLite (via USE_BDB and USE_SQLITE knobs). * Espace '+' in make search [2] * Add "makepatch" target to simplify creation of patches during porting [3] * Replace deprecated MACHINE_ARCH with ARCH [4] * Remove support of OpenLDAP 2.1 [5] * Add bsd.tcl.mk [6] It introduces USE_TCL/USE_TCL_BUILD knobs to support various version of tcl (8.0 -> 8.4) * Fix cosmetic bugs in security-check target [7] * Add support for INDEX-7 and above (up to INDEX-9 actually) [8] * Add "package-recursive" to bsd.port.subdir.mk [9] * Remove check for FreeBSD version < 460101 [10] * New category: net-im [11] * Add .desktop file facilities It introduces DESKTOPDIR and DESKTOP_ENTRIES knobs [12] * Add SHA256 support to "*checksum" targets [13] * Fix USE_PYTHON with OPTIONS [14] * Force NO_LINT to MAKE_ENV to avoid library breaks [15] * Fix typo: s/RC_ORDER/USE_RCORDER/g [16] * Add support for PostgreSQL 8.1 [17] * Add bsd.apache.mk USE_APACHE knob enhancements [18] PR: ports/85695 [1], ports/85669 [2], ports/85488 [3], ports/84489 [4], ports/83835 [5], ports/83718 [6], ports/83716 [7], ports/83710 [8], ports/82753 [9], ports/82138 [10], ports/81206 [11], ports/79509 [12], ports/79123 [13], ports/74866 [14], ports/85490 [15], ports/83514 [16], ports/88466 [17] Submitted by: vsevolod [1] [6], Ricardo Alves dos Reis <ricardo_bsd@yahoo.com.br> [2], markm [3] [15], obrien [4], krion [5] [8] , Petr Rehor <prehor@gmail.com> [7], clement [8] [18], jhs@berklix.org [9], edwin [10] [13], pav [11], jylefort [12], mnag [14], leeym [16], girgen [17]
2005-11-08 04:02:51 -05:00
_WANT_BDB_VER= 41+
.endif
# Detect bdb version
_FOUND= no
.for bdb in ${_DB_PORTS}
.if ${_WANT_BDB_VER} == "${bdb}" && ${_FOUND} == "no"
_MATCHED_DB_VER:= ${bdb:S/+//}
. if ${_MATCHED_DB_VER} == "${bdb}"
# USE_BDB is exactly specified
LIB_DEPENDS+= ${db${bdb}_DEPENDS}
_FOUND= yes
.else
# USE_BDB is specified as VER+
. for db4 in ${_DB_${_MATCHED_DB_VER}P}
. if exists(${db${db4}_FIND}) && ${_FOUND} == "no"
LIB_DEPENDS+= ${db${db4}_DEPENDS}
_FOUND= yes
. endif
. endfor
. if ${_FOUND} == "no"
# No existing db4 version is detected in system
LIB_DEPENDS+= ${db${_MATCHED_DB_VER}_DEPENDS}
_FOUND= yes
. endif
. endif
.endif
.endfor
# USE_BDB is specified incorrectly, so mark this as IGNORE
* Add bsd.database.mk [1] - move out from bsd.port.mk USE_MYSQL and USE_PGSQL. - add support for Berkley DB and SQLite (via USE_BDB and USE_SQLITE knobs). * Espace '+' in make search [2] * Add "makepatch" target to simplify creation of patches during porting [3] * Replace deprecated MACHINE_ARCH with ARCH [4] * Remove support of OpenLDAP 2.1 [5] * Add bsd.tcl.mk [6] It introduces USE_TCL/USE_TCL_BUILD knobs to support various version of tcl (8.0 -> 8.4) * Fix cosmetic bugs in security-check target [7] * Add support for INDEX-7 and above (up to INDEX-9 actually) [8] * Add "package-recursive" to bsd.port.subdir.mk [9] * Remove check for FreeBSD version < 460101 [10] * New category: net-im [11] * Add .desktop file facilities It introduces DESKTOPDIR and DESKTOP_ENTRIES knobs [12] * Add SHA256 support to "*checksum" targets [13] * Fix USE_PYTHON with OPTIONS [14] * Force NO_LINT to MAKE_ENV to avoid library breaks [15] * Fix typo: s/RC_ORDER/USE_RCORDER/g [16] * Add support for PostgreSQL 8.1 [17] * Add bsd.apache.mk USE_APACHE knob enhancements [18] PR: ports/85695 [1], ports/85669 [2], ports/85488 [3], ports/84489 [4], ports/83835 [5], ports/83718 [6], ports/83716 [7], ports/83710 [8], ports/82753 [9], ports/82138 [10], ports/81206 [11], ports/79509 [12], ports/79123 [13], ports/74866 [14], ports/85490 [15], ports/83514 [16], ports/88466 [17] Submitted by: vsevolod [1] [6], Ricardo Alves dos Reis <ricardo_bsd@yahoo.com.br> [2], markm [3] [15], obrien [4], krion [5] [8] , Petr Rehor <prehor@gmail.com> [7], clement [8] [18], jhs@berklix.org [9], edwin [10] [13], pav [11], jylefort [12], mnag [14], leeym [16], girgen [17]
2005-11-08 04:02:51 -05:00
.if ${_FOUND} == "no"
IGNORE= "Unknown bdb version: ${USE_BDB}"
.endif
.endif # USE_BDB
# Handling sqlite dependency
.if defined(USE_SQLITE)
.if ${USE_SQLITE:L} == "yes"
* Add bsd.database.mk [1] - move out from bsd.port.mk USE_MYSQL and USE_PGSQL. - add support for Berkley DB and SQLite (via USE_BDB and USE_SQLITE knobs). * Espace '+' in make search [2] * Add "makepatch" target to simplify creation of patches during porting [3] * Replace deprecated MACHINE_ARCH with ARCH [4] * Remove support of OpenLDAP 2.1 [5] * Add bsd.tcl.mk [6] It introduces USE_TCL/USE_TCL_BUILD knobs to support various version of tcl (8.0 -> 8.4) * Fix cosmetic bugs in security-check target [7] * Add support for INDEX-7 and above (up to INDEX-9 actually) [8] * Add "package-recursive" to bsd.port.subdir.mk [9] * Remove check for FreeBSD version < 460101 [10] * New category: net-im [11] * Add .desktop file facilities It introduces DESKTOPDIR and DESKTOP_ENTRIES knobs [12] * Add SHA256 support to "*checksum" targets [13] * Fix USE_PYTHON with OPTIONS [14] * Force NO_LINT to MAKE_ENV to avoid library breaks [15] * Fix typo: s/RC_ORDER/USE_RCORDER/g [16] * Add support for PostgreSQL 8.1 [17] * Add bsd.apache.mk USE_APACHE knob enhancements [18] PR: ports/85695 [1], ports/85669 [2], ports/85488 [3], ports/84489 [4], ports/83835 [5], ports/83718 [6], ports/83716 [7], ports/83710 [8], ports/82753 [9], ports/82138 [10], ports/81206 [11], ports/79509 [12], ports/79123 [13], ports/74866 [14], ports/85490 [15], ports/83514 [16], ports/88466 [17] Submitted by: vsevolod [1] [6], Ricardo Alves dos Reis <ricardo_bsd@yahoo.com.br> [2], markm [3] [15], obrien [4], krion [5] [8] , Petr Rehor <prehor@gmail.com> [7], clement [8] [18], jhs@berklix.org [9], edwin [10] [13], pav [11], jylefort [12], mnag [14], leeym [16], girgen [17]
2005-11-08 04:02:51 -05:00
_SQLITE_VER= 3
.else
_SQLITE_VER= ${USE_SQLITE}
.endif
# USE_SQLITE is specified incorrectly, so mark this as IGNORE
.if ${_SQLITE_VER} == "3"
LIB_DEPENDS+= sqlite${_SQLITE_VER}:${PORTSDIR}/databases/sqlite${_SQLITE_VER}
.elif ${_SQLITE_VER} == "2"
LIB_DEPENDS+= sqlite.${_SQLITE_VER}:${PORTSDIR}/databases/sqlite${_SQLITE_VER}
.else
* Add bsd.database.mk [1] - move out from bsd.port.mk USE_MYSQL and USE_PGSQL. - add support for Berkley DB and SQLite (via USE_BDB and USE_SQLITE knobs). * Espace '+' in make search [2] * Add "makepatch" target to simplify creation of patches during porting [3] * Replace deprecated MACHINE_ARCH with ARCH [4] * Remove support of OpenLDAP 2.1 [5] * Add bsd.tcl.mk [6] It introduces USE_TCL/USE_TCL_BUILD knobs to support various version of tcl (8.0 -> 8.4) * Fix cosmetic bugs in security-check target [7] * Add support for INDEX-7 and above (up to INDEX-9 actually) [8] * Add "package-recursive" to bsd.port.subdir.mk [9] * Remove check for FreeBSD version < 460101 [10] * New category: net-im [11] * Add .desktop file facilities It introduces DESKTOPDIR and DESKTOP_ENTRIES knobs [12] * Add SHA256 support to "*checksum" targets [13] * Fix USE_PYTHON with OPTIONS [14] * Force NO_LINT to MAKE_ENV to avoid library breaks [15] * Fix typo: s/RC_ORDER/USE_RCORDER/g [16] * Add support for PostgreSQL 8.1 [17] * Add bsd.apache.mk USE_APACHE knob enhancements [18] PR: ports/85695 [1], ports/85669 [2], ports/85488 [3], ports/84489 [4], ports/83835 [5], ports/83718 [6], ports/83716 [7], ports/83710 [8], ports/82753 [9], ports/82138 [10], ports/81206 [11], ports/79509 [12], ports/79123 [13], ports/74866 [14], ports/85490 [15], ports/83514 [16], ports/88466 [17] Submitted by: vsevolod [1] [6], Ricardo Alves dos Reis <ricardo_bsd@yahoo.com.br> [2], markm [3] [15], obrien [4], krion [5] [8] , Petr Rehor <prehor@gmail.com> [7], clement [8] [18], jhs@berklix.org [9], edwin [10] [13], pav [11], jylefort [12], mnag [14], leeym [16], girgen [17]
2005-11-08 04:02:51 -05:00
IGNORE= "Unknown sqlite version: ${_SQLITE_VER}"
.endif
.endif # defined(USE_SQLITE)
.endif # defined(_POSTMKINCLUDED) && !defined(Database_Post_Include)