maria-developers team mailing list archive
-
maria-developers team
-
Mailing list archive
-
Message #07924
Some patches for the C client library
While I was creating Debian packages for the "MariaDB Client Library for C"
I came across several minor issues that I corrected. I thought I'd post
the patches here in case you might be interested in integrating them; I'd have
no problem with contributing them under the MCA if that's necessary (i.e. if
they're even big enough to require such a thing). Each one has a
fairly complete
description of its purpose at the start.
I've also noticed that mariadb_config --libs prints out something like ...
-l-lz if WITH_EXTERNAL_ZLIB=ON. However, for the Debian packages I instead
patched mariadb_config to remove the indirect dependencies altogether, as
we generally do, so I didn't write a fix for the -l-lz issue. Also, it seems
that if I try to build with WITH_SQLITE=ON then I get a build error, so I
haven't enabled that in the Debian packages.
--
Daniel Schepler
Description: Make the library install path configurable
The upstream sources unconditionally install to
CMAKE_INSTALL_PREFIX/lib/mariadb, whereas we want to install to
/usr/lib/$(DEB_HOST_MULTIARCH). This patch creates a new option
LIB_INSTALL_DIR for the installation directory which debian/rules then sets
accordingly.
Author: Daniel Schepler <schepler@xxxxxxxxxx>
Index: mariadb-client-lgpl-2.0.0/CMakeLists.txt
===================================================================
--- mariadb-client-lgpl-2.0.0.orig/CMakeLists.txt
+++ mariadb-client-lgpl-2.0.0/CMakeLists.txt
@@ -27,6 +27,12 @@ ENDIF()
OPTION(WITH_SQLITE "Enables Sqlite support" OFF)
OPTION(WITH_EXTERNAL_ZLIB "Enables use of external zlib" OFF)
+
+SET(LIB_INSTALL_DIR "lib/mariadb" CACHE
+ "Directory relative to CMAKE_INSTALL_PREFIX in which to install libraries"
+ STRING)
+MARK_AS_ADVANCED(LIB_INSTALL_DIR)
+
###############
IF(WITH_RTC)
Index: mariadb-client-lgpl-2.0.0/libmariadb/CMakeLists.txt
===================================================================
--- mariadb-client-lgpl-2.0.0.orig/libmariadb/CMakeLists.txt
+++ mariadb-client-lgpl-2.0.0/libmariadb/CMakeLists.txt
@@ -210,15 +210,15 @@ ENDIF()
INSTALL(TARGETS
libmariadb mariadbclient
- RUNTIME DESTINATION "lib/mariadb"
- LIBRARY DESTINATION "lib/mariadb"
- ARCHIVE DESTINATION "lib/mariadb")
+ RUNTIME DESTINATION "${LIB_INSTALL_DIR}"
+ LIBRARY DESTINATION "${LIB_INSTALL_DIR}"
+ ARCHIVE DESTINATION "${LIB_INSTALL_DIR}")
IF(NOT WIN32 AND WITH_MYSQLCOMPAT)
INSTALL(FILES "${CMAKE_BINARY_DIR}/libmariadb/libmysql${CMAKE_SHARED_LIBRARY_SUFFIX}"
"${CMAKE_BINARY_DIR}/libmariadb/libmysqlclient${CMAKE_SHARED_LIBRARY_SUFFIX}"
"${CMAKE_BINARY_DIR}/libmariadb/libmysqlclient_r${CMAKE_SHARED_LIBRARY_SUFFIX}"
"${CMAKE_BINARY_DIR}/libmariadb/libmysqlclient${CMAKE_STATIC_LIBRARY_SUFFIX}"
- DESTINATION lib/mariadb)
+ DESTINATION "${LIB_INSTALL_DIR}")
ENDIF()
INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/include/
Index: mariadb-client-lgpl-2.0.0/mariadb_config/mariadb_config.c.in
===================================================================
--- mariadb-client-lgpl-2.0.0.orig/mariadb_config/mariadb_config.c.in
+++ mariadb-client-lgpl-2.0.0/mariadb_config/mariadb_config.c.in
@@ -4,7 +4,7 @@
#include <stdio.h>
#define INCLUDE "-I@CMAKE_INSTALL_PREFIX@/include/mariadb"
-#define LIBS "-L@CMAKE_INSTALL_PREFIX@/lib/mariadb -lmariadb" \
+#define LIBS "-L@CMAKE_INSTALL_PREFIX@/@LIB_INSTALL_DIR@ -lmariadb" \
"@extra_dynamic_LDFLAGS@"
#define CFLAGS INCLUDE "@CMAKE_C_FLAGS@"
#define VERSION "@MYSQL_CLIENT_VERSION@"
Description: Rename static library from libmariadbclient.a to libmariadb.a
The upstream build system creates libmariadb.so.2, but the static library
is libmariadbclient.a -- which incidentally conflicts with the GPL client
library included with MariaDB. This fixes the static library naming to be
consistent. Also, for the purposes of submitting to upstream, on Windows
systems where having the same name would create conflicts between the DLL
stub library and the static library, it renames the static library to
libmariadb_static.lib.
Author: Daniel Schepler <schepler@xxxxxxxxxx>
Index: mariadb-client-lgpl-2.0.0/libmariadb/CMakeLists.txt
===================================================================
--- mariadb-client-lgpl-2.0.0.orig/libmariadb/CMakeLists.txt
+++ mariadb-client-lgpl-2.0.0/libmariadb/CMakeLists.txt
@@ -148,6 +148,13 @@ TARGET_LINK_LIBRARIES(mariadbclient ${CM
IF(OPENSSL_FOUND)
TARGET_LINK_LIBRARIES(mariadbclient ${SSL_LIBRARIES})
ENDIF()
+IF(WIN32)
+ SET_TARGET_PROPERTIES(mariadbclient PROPERTIES
+ OUTPUT_NAME libmariadb_static)
+ELSE()
+ SET_TARGET_PROPERTIES(mariadbclient PROPERTIES
+ OUTPUT_NAME mariadb)
+ENDIF()
ADD_LIBRARY(libmariadb SHARED ${LIBMARIADB_SOURCES})
TARGET_LINK_LIBRARIES(libmariadb ${CMAKE_THREAD_LIBS_INIT} ${CMAKE_DL_LIBS} ${MATH_LIBRARY} ${ICONV_LIBRARIES})
@@ -194,7 +201,7 @@ IF(NOT WIN32 AND WITH_MYSQLCOMPAT)
COMMAND ${CMAKE_COMMAND} ARGS -E remove -f libmysqlclient${CMAKE_SHARED_LIBRARY_SUFFIX}
COMMAND ${CMAKE_COMMAND} ARGS -E create_symlink libmariadb${CMAKE_SHARED_LIBRARY_SUFFIX} libmysqlclient${CMAKE_SHARED_LIBRARY_SUFFIX}
COMMAND ${CMAKE_COMMAND} ARGS -E remove -f libmysqlclient${CMAKE_STATIC_LIBRARY_SUFFIX}
- COMMAND ${CMAKE_COMMAND} ARGS -E create_symlink libmariadbclient${CMAKE_STATIC_LIBRARY_SUFFIX} libmysqlclient${CMAKE_STATIC_LIBRARY_SUFFIX}
+ COMMAND ${CMAKE_COMMAND} ARGS -E create_symlink libmariadb${CMAKE_STATIC_LIBRARY_SUFFIX} libmysqlclient${CMAKE_STATIC_LIBRARY_SUFFIX}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/libmariadb
DEPENDS libmariadb mariadbclient)
Description: Fix mariadb_config --cflags output
Without this patch, the output starts with something like
"-I/usr/include/mariadb-g -O2". This fixes the output to put a space
between the -I parameter and -g.
Author: Daniel Schepler <schepler@xxxxxxxxxx>
--- mariadb-client-lgpl-2.0.0.orig/mariadb_config/mariadb_config.c.in
+++ mariadb-client-lgpl-2.0.0/mariadb_config/mariadb_config.c.in
@@ -6,7 +6,7 @@
#define INCLUDE "-I@CMAKE_INSTALL_PREFIX@/include/mariadb"
#define LIBS "-L@CMAKE_INSTALL_PREFIX@/@LIB_INSTALL_DIR@ -lmariadb" \
"@extra_dynamic_LDFLAGS@"
-#define CFLAGS INCLUDE "@CMAKE_C_FLAGS@"
+#define CFLAGS INCLUDE " @CMAKE_C_FLAGS@"
#define VERSION "@MYSQL_CLIENT_VERSION@"
#define SOCKET "@MYSQL_UNIX_ADDR@"
#define PORT "@MYSQL_PORT@"
Description: Avoid installing build system files into /usr/include
Author: Daniel Schepler <schepler@xxxxxxxxxx>
--- mariadb-client-lgpl-2.0.0.orig/libmariadb/CMakeLists.txt
+++ mariadb-client-lgpl-2.0.0/libmariadb/CMakeLists.txt
@@ -229,7 +229,10 @@ IF(NOT WIN32 AND WITH_MYSQLCOMPAT)
ENDIF()
INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/include/
- DESTINATION include/mariadb)
+ DESTINATION include/mariadb
+ PATTERN "*.h.in" EXCLUDE
+ PATTERN "CMakeLists.txt" EXCLUDE
+ PATTERN "Makefile.am" EXCLUDE)
INSTALL(FILES
${CMAKE_BINARY_DIR}/include/my_config.h
${CMAKE_BINARY_DIR}/include/mysql_version.h
Follow ups