mysql, mariadb, ... => WANT_MYSQL_PROV ?
geoffroy desvernay
dgeo at centrale-marseille.fr
Tue Sep 4 08:59:20 UTC 2012
Hi all,
To help people that use mariadb *and* permit different mariadb versions
in the ports tree, I propose this patch to bsd.database.mk with
MYSQL_PROV, _MYSQL_PROV, WANT_MYSQL_PROV and DEFAULT_MYSQL_PROV that
defaults to mysql to keep current behaviour.
This way, one can define MYSQL_PROV in make.conf to use mariadb, and we
may rename mariadb-* as mariadb53-*, allowing to create mariadb55-* port
at first.
For the moment, only the 'magic' MYSQL_VER=53 can install mariadb,
because the is no mysql53-*, but this is not the same for 5.5...
Any thoughts ?
--
*geoffroy desvernay*
C.R.I - Administration systèmes et réseaux
Ecole Centrale de Marseille
-------------- next part --------------
--- bsd.database.mk.orig 2012-06-19 01:23:17.000000000 +0200
+++ bsd.database.mk 2012-09-03 20:02:34.000000000 +0200
@@ -34,6 +34,13 @@
# - User defined variable to set MySQL version.
# MYSQL_VER
# - Detected MySQL version.
+# DEFAULT_MYSQL_PROV
+# - default mysql provider
+# If none, use installed one. If none, use mysql port
+# WANT_MYSQL_PROV
+# - Maintainer may use that to match a specific provider
+# MYSQL_PROV
+# - Provider for mysql* programs (eg: mariadb)
##
# USE_PGSQL - Add PostgreSQL client dependency. Components can be depended
# on using USE_PGSQL= component[:target]. For the full list
@@ -104,6 +111,7 @@
.if defined(USE_MYSQL)
DEFAULT_MYSQL_VER?= 55
+DEFAULT_MYSQL_PROV?= mysql
# MySQL client version currently supported.
MYSQL41_LIBVER= 14
MYSQL50_LIBVER= 15
@@ -114,11 +122,27 @@
# 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/'
+_MYSQL_PROV!= ${LOCALBASE}/bin/mysql --version | ${SED} -e 's/.*Distrib [0-9]\.[0-9]*.*-\([A-Za-z]*\),.*/\1/' | tr A-Z a-z
.endif
+.if defined(WANT_MYSQL_PROV)
+.if defined(WITH_MYSQL_PROV) && ${WITH_MYSQL_PROV} != ${WANT_MYSQL_PROV}
+IGNORE= cannot install: the port wants mysql${WANT_MYSQL_PROV}-client and you try to install mysql${WITH_MYSQL_PROV}-client
+.endif
+MYSQL_PROV= ${WANT_MYSQL_PROV}
+.elif defined(WITH_MYSQL_PROV)
+MYSQL_PROV= ${WITH_MYSQL_PROV}
+.else
+.if defined(_MYSQL_PROV)
+MYSQL_PROV= ${_MYSQL_PROV}
+.else
+MYSQL_PROV= ${DEFAULT_MYSQL_PROV}
+.endif
+.endif # WANT_MYSQL_PROV
+
.if defined(WANT_MYSQL_VER)
.if defined(WITH_MYSQL_VER) && ${WITH_MYSQL_VER} != ${WANT_MYSQL_VER}
-IGNORE= cannot install: the port wants mysql${WANT_MYSQL_VER}-client and you try to install mysql${WITH_MYSQL_VER}-client
+IGNORE= cannot install: the port wants mysql${WANT_MYSQL_VER}-client and you try to install ${MYSQL_PROV}${WITH_MYSQL_VER}-client
.endif
MYSQL_VER= ${WANT_MYSQL_VER}
.elif defined(WITH_MYSQL_VER)
@@ -131,13 +155,19 @@
.endif
.endif # WANT_MYSQL_VER
+.if defined(_MYSQL_PROV)
+.if ${_MYSQL_PROV} != ${MYSQL_PROV}
+IGNORE= cannot install: MySQL provider mismatch: ${_MYSQL_PROV}${_MYSQL_VER}-client is installed and wanted provider is ${MYSQL_PROV}
+.endif
+.endif
+
.if defined(_MYSQL_VER)
.if ${_MYSQL_VER} != ${MYSQL_VER}
IGNORE= cannot install: MySQL versions mismatch: mysql${_MYSQL_VER}-client is installed and wanted version is mysql${MYSQL_VER}-client
.endif
.endif
-.if (${MYSQL_VER} == "53")
+.if (${MYSQL_PROV} == "mariadb" || ${MYSQL_VER} == "53")
_MYSQL_CLIENT= databases/mariadb-client
_MYSQL_SERVER= databases/mariadb-server
.else
More information about the freebsd-ports
mailing list