[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - config_host.mk.in configure.ac mysqlc/Extension_mysql-connector-ooo.mk mysqlc/Library_mysqlc.mk mysqlcppconn/Library_mysqlcppconn.mk mysqlc/source

Lionel Elie Mamane lionel at mamane.lu
Tue Oct 22 02:07:34 PDT 2013


 config_host.mk.in                       |    3 ++
 configure.ac                            |   43 +++++++++++++++++++++++++++++---
 mysqlc/Extension_mysql-connector-ooo.mk |    6 ++++
 mysqlc/Library_mysqlc.mk                |    2 +
 mysqlc/source/mysqlc_driver.cxx         |   23 ++++++++++++++++-
 mysqlc/source/mysqlc_driver.hxx         |    4 ++
 mysqlcppconn/Library_mysqlcppconn.mk    |    1 
 7 files changed, 76 insertions(+), 6 deletions(-)

New commits:
commit f4d728ab649f0f743e09a744a63565f1cbdf6e88
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date:   Sat Oct 19 22:57:40 2013 +0200

    fdo#70496 revert to using libmysqlclient
    
    Change-Id: I5b98b5e7840e4f1c6005aee0c1f43ef814ecf77b
    Reviewed-on: https://gerrit.libreoffice.org/6353
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/config_host.mk.in b/config_host.mk.in
index 9268c7b..175bab3 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -322,6 +322,9 @@ export MARIADBC_MICRO=@MARIADBC_MICRO@
 export MARIADBC_MINOR=@MARIADBC_MINOR@
 export MARIADB_CFLAGS=$(gb_SPACE)@MARIADB_CFLAGS@
 export MARIADB_LIBS=$(gb_SPACE)@MARIADB_LIBS@
+export LIBMARIADB=@LIBMARIADB@
+export LIBMARIADB_PATH=@LIBMARIADB_PATH@
+export BUNDLE_MARIADB=@BUNDLE_MARIADB@
 export MD5SUM=@MD5SUM@
 export MDDS_CPPFLAGS=$(gb_SPACE)@MDDS_CPPFLAGS@
 export MERGELIBS=@MERGELIBS@
diff --git a/configure.ac b/configure.ac
index 4084f3a..fc52cb1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1399,6 +1399,11 @@ AC_ARG_WITH(system-mariadb,
          extension.]),,
     [with_system_mariadb="$with_system_libs"])
 
+AC_ARG_ENABLE(bundle-mariadb,
+    AS_HELP_STRING([--enable-bundle-mariadb],
+        [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice extension.])
+)
+
 AC_ARG_WITH(system-mysql-cppconn,
     AS_HELP_STRING([--with-system-mysql-cppconn],
         [Use MySQL C++ Connector libraries already on system.]),,
@@ -7631,11 +7636,12 @@ if test "$ENABLE_MARIADBC" = "YES"; then
     if test "$with_system_mariadb" = "yes"; then
         AC_MSG_RESULT([external])
         SYSTEM_MARIADB=YES
-        AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
+        #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
         if test -z "$MARIADBCONFIG"; then
             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
             if test -z "$MARIADBCONFIG"; then
-                AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL package.])
+                #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL package.])
+                AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
             fi
         fi
         AC_MSG_CHECKING([MariaDB version])
@@ -7648,10 +7654,36 @@ if test "$ENABLE_MARIADBC" = "YES"; then
         fi
         AC_MSG_CHECKING([for MariaDB Client library])
         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
-        MARIADB_LIBS=`$MARIADBCONFIG --libs`
-        AC_MSG_RESULT([includes $MARIADB_CFLAGS, libraries $MARIADB_LIBS])
+        MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
+        AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
+        AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
+        if test "$enable_bundle_mariadb" = "yes"; then
+            AC_MSG_RESULT([yes])
+            BUNDLE_MARIADB=YES
+            LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\+-l/\n/g' | grep -E '(mysqlclient|mariadb)')
+            if test "$_os" = "Darwin"; then
+                LIBMARIADB=${LIBMARIADB}.dylib
+            elif test "$_os" = "WINNT"; then
+                LIBMARIADB=${LIBMARIADB}.dll
+            else
+                LIBMARIADB=${LIBMARIADB}.so
+            fi
+            LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
+            AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
+            if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
+                AC_MSG_RESULT([found.])
+                PathFormat "$LIBMARIADB_PATH"
+                LIBMARIADB_PATH="$formatted_path"
+            else
+                AC_MSG_ERROR([not found.])
+            fi
+        else
+            AC_MSG_RESULT([no])
+            BUNDLE_MARIADB=NO
+        fi
     else
         AC_MSG_RESULT([internal])
+        AC_MSG_ERROR([libmariadb is known to be broken as of 2013-10; use libmysqlclient])
         SYSTEM_MARIADB=NO
         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb/include"
         MARIADB_LIBS="-L${OUTDIR}/lib -lmariadblib"
@@ -7661,6 +7693,9 @@ if test "$ENABLE_MARIADBC" = "YES"; then
     AC_SUBST(SYSTEM_MARIADB)
     AC_SUBST(MARIADB_CFLAGS)
     AC_SUBST(MARIADB_LIBS)
+    AC_SUBST(LIBMARIADB)
+    AC_SUBST(LIBMARIADB_PATH)
+    AC_SUBST(BUNDLE_MARIADB)
 
     AC_LANG_PUSH([C++])
     dnl ===================================================================
diff --git a/mysqlc/Extension_mysql-connector-ooo.mk b/mysqlc/Extension_mysql-connector-ooo.mk
index 810ede5..d949057 100644
--- a/mysqlc/Extension_mysql-connector-ooo.mk
+++ b/mysqlc/Extension_mysql-connector-ooo.mk
@@ -26,4 +26,10 @@ ifeq ($(SYSTEM_MYSQL_CPPCONN),NO)
 $(eval $(call gb_Extension_add_library,mysql-connector-ooo,mysqlcppconn))
 endif
 
+ifeq ($(BUNDLE_MARIADB),YES)
+$(eval $(call gb_Extension_add_files,mysql-connector-ooo,,\
+       $(LIBMARIADB_PATH)/$(LIBMARIADB) \
+))
+endif
+
 # vim: set noet sw=4 ts=4:
diff --git a/mysqlc/Library_mysqlc.mk b/mysqlc/Library_mysqlc.mk
index 72787fc..00c35e3 100644
--- a/mysqlc/Library_mysqlc.mk
+++ b/mysqlc/Library_mysqlc.mk
@@ -42,6 +42,8 @@ $(eval $(call gb_Library_add_defs,mysqlc,\
 	-DMARIADBC_VERSION_MICRO=$(MARIADBC_MICRO) \
 	$(if $(filter NO,$(SYSTEM_MYSQL_CPPCONN)),\
 	-DCPPCONN_LIB=\"$(call gb_Library_get_runtime_filename,mysqlcppconn)\") \
+	$(if $(filter YES,$(BUNDLE_MARIADB)),\
+	-DBUNDLE_MARIADB=\"$(LIBMARIADB)\") \
 ))
 
 $(eval $(call gb_Library_add_exception_objects,mysqlc,\
diff --git a/mysqlc/source/mysqlc_driver.cxx b/mysqlc/source/mysqlc_driver.cxx
index 7a6a326..cbd956f 100644
--- a/mysqlc/source/mysqlc_driver.cxx
+++ b/mysqlc/source/mysqlc_driver.cxx
@@ -143,9 +143,30 @@ void MysqlCDriver::impl_initCppConn_lck_throw()
 #ifdef SYSTEM_MYSQL_CPPCONN
     cppDriver = get_driver_instance();
 #else
+#ifdef BUNDLE_MARIADB
+    if ( !m_bAttemptedLoadCConn )
+    {
+        const OUString sModuleName(BUNDLE_MARIADB);
+        m_hCConnModule = osl_loadModuleRelative( &thisModule, sModuleName.pData, 0 );
+        m_bAttemptedLoadCConn = true;
+    }
+
+    // attempted to load - was it successful?
+    if ( !m_hCConnModule )
+    {
+        OSL_FAIL( "MysqlCDriver::impl_initCppConn_lck_throw: could not load the " BUNDLE_MARIADB " library!");
+        throw SQLException(
+            OUString( "Unable to load the " BUNDLE_MARIADB " library."  ),
+            *this,
+            OUString( "08001"  ),  // "unable to connect"
+            0,
+            Any()
+        );
+    }
+#endif
     if ( !m_bAttemptedLoadCppConn )
     {
-        const OUString sModuleName(CPPCONN_LIB );
+        const OUString sModuleName(CPPCONN_LIB);
         m_hCppConnModule = osl_loadModuleRelative( &thisModule, sModuleName.pData, 0 );
         m_bAttemptedLoadCppConn = true;
     }
diff --git a/mysqlc/source/mysqlc_driver.hxx b/mysqlc/source/mysqlc_driver.hxx
index 0c14e8a..d63ed05 100644
--- a/mysqlc/source/mysqlc_driver.hxx
+++ b/mysqlc/source/mysqlc_driver.hxx
@@ -63,6 +63,10 @@ namespace connectivity
                                             // of all the Connection objects
                                             // for this Driver
 #ifndef SYSTEM_MYSQL_CPPCONN
+#ifdef BUNDLE_MARIADB
+            oslModule       m_hCConnModule;
+            bool            m_bAttemptedLoadCConn;
+#endif
             oslModule       m_hCppConnModule;
             bool            m_bAttemptedLoadCppConn;
 #endif
diff --git a/mysqlcppconn/Library_mysqlcppconn.mk b/mysqlcppconn/Library_mysqlcppconn.mk
index adebc5b..eccc521 100644
--- a/mysqlcppconn/Library_mysqlcppconn.mk
+++ b/mysqlcppconn/Library_mysqlcppconn.mk
@@ -12,7 +12,6 @@ $(eval $(call gb_Library_Library,mysqlcppconn))
 $(eval $(call gb_Library_use_unpacked,mysqlcppconn,mysqlcppconn))
 
 $(eval $(call gb_Library_use_externals,mysqlcppconn, \
-	mysql \
 	boost_headers \
 	mariadb \
 ))


More information about the Libreoffice-commits mailing list