summaryrefslogtreecommitdiff
path: root/mk/mysql.buildlink3.mk
diff options
context:
space:
mode:
authorxtraeme <xtraeme@pkgsrc.org>2004-10-28 11:28:27 +0000
committerxtraeme <xtraeme@pkgsrc.org>2004-10-28 11:28:27 +0000
commit3c76f3a70bc245791c811ba8b3bbdb4b2310a9a4 (patch)
tree25fb25afe9462729687f220140f129c5f057548f /mk/mysql.buildlink3.mk
parenta3fd77f689d9d551e0253512bef20287c4d598f8 (diff)
downloadpkgsrc-3c76f3a70bc245791c811ba8b3bbdb4b2310a9a4.tar.gz
mysql.bl3.mk suggested by Jaromir Dolecek (jdolecek@):
Default mysql package if there isn't any installed is mysql-4.1.7 (databases/mysql4-client) You can choose a mysql package via MYSQL_VERSION_DEFAULT, it will accept the following values: MYSQL_VERSION_DEFAULT=41 # <- mysql-4.1.7 MYSQL_VERSION_DEFAULT=40 # <- mysql-4.0.21 MYSQL_VERSION_DEFAULT=30 # <- mysql-3.5.x
Diffstat (limited to 'mk/mysql.buildlink3.mk')
-rw-r--r--mk/mysql.buildlink3.mk81
1 files changed, 81 insertions, 0 deletions
diff --git a/mk/mysql.buildlink3.mk b/mk/mysql.buildlink3.mk
new file mode 100644
index 00000000000..36507426532
--- /dev/null
+++ b/mk/mysql.buildlink3.mk
@@ -0,0 +1,81 @@
+# $NetBSD: mysql.buildlink3.mk,v 1.1 2004/10/28 11:28:27 xtraeme Exp $
+
+.if !defined(MYSQL_VERSION_MK)
+MYSQL_VERSION_MK= # defined
+
+.include "../../mk/bsd.prefs.mk"
+
+MYSQL_VERSION_DEFAULT?= 41
+MYSQL_VERSIONS_ACCEPTED?= 41 40 30
+
+# transform the list into individual variables
+.for mv in ${MYSQL_VERSIONS_ACCEPTED}
+_MYSQL_VERSION_${mv}_OK= yes
+.endfor
+
+# check what is installed
+.if exists(${LOCALBASE}/lib/mysql/libmysqlclient.so.14)
+_MYSQL_VERSION_41_INSTALLED= yes
+.endif
+
+.if exists(${LOCALBASE}/lib/mysql/libmysqlclient.so.12)
+_MYSQL_VERSION_40_INSTALLED= yes
+.endif
+
+.if exists(${LOCALBASE}/lib/mysql/libmysqlclient.so.10)
+_MYSQL_VERSION_30_INSTALLED= yes
+.endif
+
+# if a version is explicitely required, take it
+.if defined(MYSQL_VERSION_REQD)
+_MYSQL_VERSION= ${MYSQL_VERSION_REQD}
+.endif
+# if the default is already installed, it is first choice
+.if !defined(_MYSQL_VERSION)
+. if defined(_MYSQL_VERSION_${MYSQL_VERSION_DEFAULT}_OK)
+. if defined(_MYSQL_VERSION_${MYSQL_VERSION_DEFAULT}_INSTALLED)
+_MYSQL_VERSION= ${MYSQL_VERSION_DEFAULT}
+. endif
+. endif
+.endif
+# prefer an already installed version, in order of "accepted"
+.if !defined(_MYSQL_VERSION)
+. for mv in ${MYSQL_VERSIONS_ACCEPTED}
+. if defined(_MYSQL_VERSION_${mv}_INSTALLED)
+_MYSQL_VERSION?= ${mv}
+. else
+# keep information as last resort - see below
+_MYSQL_VERSION_FIRSTACCEPTED?= ${mv}
+. endif
+. endfor
+.endif
+# if the default is OK for the addon pkg, take this
+.if !defined(_MYSQL_VERSION)
+. if defined(_MYSQL_VERSION_${MYSQL_VERSION_DEFAULT}_OK)
+_MYSQL_VERSION= ${MYSQL_VERSION_DEFAULT}
+. endif
+.endif
+# take the first one accepted by the package
+.if !defined(_MYSQL_VERSION)
+_MYSQL_VERSION= ${_MYSQL_VERSION_FIRSTACCEPTED}
+.endif
+
+#
+# set variables for the version we decided to use:
+#
+.if ${_MYSQL_VERSION} == "41"
+MYSQL_PKGSRCDIR= ../../databases/mysql4-client
+.elif ${_MYSQL_VERSION} == "40"
+MYSQL_PKGSRCDIR= ../../databases/mysql-client
+.elif ${_MYSQL_VERSION} == "30"
+MYSQL_PKGSRCDIR= ../../databases/mysql3-client
+.else
+# force an error
+PKG_SKIP_REASON+= "${_MYSQL_VERSION} is not a valid mysql package."
+.endif
+
+.if (defined(USE_BUILDLINK3) && empty(USE_BUILDLINK3:M[nN][oO]))
+. include "${MYSQL_PKGSRCDIR}/buildlink3.mk"
+.endif
+
+.endif # MYSQL_VERSION_MK