ports/55597: [patch] Mk/bsd.port.mk: add MySQL support to core ports mechanisms
Clement Laforet
sheepkiller at cultdeadsheep.org
Thu Aug 14 23:50:22 UTC 2003
>Number: 55597
>Category: ports
>Synopsis: [patch] Mk/bsd.port.mk: add MySQL support to core ports mechanisms
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Thu Aug 14 16:50:20 PDT 2003
>Closed-Date:
>Last-Modified:
>Originator: Clement Laforet
>Release: FreeBSD 5.1-CURRENT i386
>Organization:
cotds.org
>Environment:
System: FreeBSD lucifer.cultdeadsheep.org 5.1-CURRENT FreeBSD 5.1-CURRENT #0: Mon Aug 11 21:29:26 CEST 2003 clement at lucifer.cultdeadsheep.org:/usr/obj/usr/src/sys/LUCIFER i386
>Description:
I maintain ports with MySQL support and I get tired to add/update my MySQL hack.
So I made a patch for bsd.port.mk.
Most of the work is not this patch, but updating ports. I can help :)
This patch should handle 99% of common MySQL dependency uses.
See patch below for more informations.
Thanks to Jeremy Chadwick <freebsd at jdc.parodius.com> and
Oliver Lehmann <oliver at FreeBSD.org> for their pointing/help.
>How-To-Repeat:
N/A.
>Fix:
--- bsd.port.mk.diff begins here ---
Index: bsd.port.mk
===================================================================
RCS file: /WORK/CVS/ports/Mk/bsd.port.mk,v
retrieving revision 1.461
diff -u -r1.461 bsd.port.mk
--- bsd.port.mk 4 Aug 2003 01:17:39 -0000 1.461
+++ bsd.port.mk 14 Aug 2003 23:18:32 -0000
@@ -379,6 +379,23 @@
# Default: not set.
# USE_LINUX_PREFIX - controls the action of PREFIX (see above).
#
+#
+# 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.0 = 40).
+#
+# DEFAULT_MYSQL_VER - MySQL default version. Can be overriden within a port. Default: 40.
+#
+# 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.
+#
# Dependency checking. Use these if your port requires another port
# not in the list above. (Default: empty.)
#
@@ -1412,6 +1429,44 @@
BUILD_DEPENDS+= bison:${PORTSDIR}/devel/bison
.endif
.endif
+
+.if defined(USE_MYSQL)
+DEFAULT_MYSQL_VER?= 40
+
+# MySQL client version currently supported.
+MYSQL323_LIBVER=10
+MYSQL40_LIBVER= 12
+MYSQL41_LIBVER= 14
+
+# Setting/finding MySQL version we want.
+.if defined(WANT_MYSQL_VER)
+MYSQL_VER= ${WANT_MYSQL_VER}
+.elif defined(WITH_MYSQL_VER)
+MYSQL_VER= ${WITH_MYSQL_VER}
+.elif exists(${LOCALBASE}/lib/mysql/libmysqlclient.so.${MYSQL_323_LIBVER})
+MYSQL_VER= 323
+.elif exists(${LOCALBASE}/lib/mysql/libmysqlclient.so.${MYSQL40_LIBVER})
+MYSQL_VER= 40
+.elif exists(${LOCALBASE}/lib/mysql/libmysqlclient.so.${MYSQL41_LIBVER})
+MYSQL_VER= 41
+.else
+MYSQL_VER= ${DEFAULT_MYSQL_VER}
+.endif # WANT_MYSQL
+
+# And now we are checking if we can use it
+.if exists(${PORTSDIR}/databases/mysql${MYSQL_VER}-client)
+.if defined(BROKEN_WITH_MYSQL)
+. for VER in ${BROKEN_WITH_MYSQL}
+. if (${MYSQL_VER} == "${VER}")
+BROKEN= "Doesn't work with MySQL version : ${MYSQL_VER} (Doesn't support MySQL ${BROKEN_WITH_MYSQL})"
+. endif
+. endfor
+.endif # BROKEN_WITH_MYSQL
+LIB_DEPENDS+= mysqlclient.${MYSQL${MYSQL_VER}_LIBVER}:${PORTSDIR}/databases/mysql${MYSQL_VER}-client
+.else
+BROKEN= "unknown MySQL version: ${MYSQL_VER}"
+.endif # Check for correct libs
+.endif # USE_MYSQL
.if ${OSVERSION} >= 500032
PERL_VERSION?= 5.6.1
--- bsd.port.mk.diff ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list