Skip to content

Commit

Permalink
(#21910) mariadb-connector-c: add v3.3.8
Browse files Browse the repository at this point in the history
* mariadb-connector-c: add v3.3.8

* mariadb-connector-c: fix "warnings as errors" handling

* mariadb-connector-c: restore the fix-install-and-static-or-shared patch
  • Loading branch information
valgur authored Aug 1, 2024
1 parent 8882a5b commit 78cf76d
Show file tree
Hide file tree
Showing 7 changed files with 139 additions and 45 deletions.
19 changes: 10 additions & 9 deletions recipes/mariadb-connector-c/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
sources:
"3.3.8":
url: "https://downloads.mariadb.com/Connectors/c/connector-c-3.3.8/mariadb-connector-c-3.3.8-src.tar.gz"
sha256: "f9f076b4aa9fb22cc94b24f82c80f9ef063805ecd6533a2eb5d5060cf93833e8"
"3.3.3":
url: "https://downloads.mariadb.com/Connectors/c/connector-c-3.3.3/mariadb-connector-c-3.3.3-src.tar.gz"
sha256: "d77630e2376fe08185b5354621c877b0a203a6b186a0694574d37b764aeb2874"
Expand All @@ -12,16 +15,17 @@ sources:
url: "https://downloads.mariadb.com/Connectors/c/connector-c-3.1.11/mariadb-connector-c-3.1.11-src.tar.gz"
sha256: "3e6f6c399493fe90efdc21a3fe70c30434b7480e8195642a959f1dd7a0fa5b0f"
patches:
"3.3.3":
- patch_file: "patches/3.3.3-0002-find-package-zstd.patch"
patch_description: "Use ZSTD cmake file from Conan"
"3.3.8":
- patch_file: "patches/3.3.8-0001-fix-install-and-static-or-shared.patch"
patch_description: "fix install path, separate static/shared build"
patch_type: "conan"
- patch_file: "patches/3.1.11-0004-include-mysqld_error-header.patch"
patch_description: "always include mysqld_error.h"
patch_type: "portability"
"3.3.3":
- patch_file: "patches/3.3.3-0001-fix-install-and-static-or-shared.patch"
patch_description: "fix install path, separate static/shared build"
patch_type: "conan"
- patch_file: "patches/3.1.19-0002-remove-wx-flag.patch"
patch_description: "remove WX flags in MSVC"
patch_type: "conan"
- patch_file: "patches/3.1.11-0003-include-order-windows-winsock2.patch"
patch_description: "fix include order for windows winsock2"
patch_type: "portability"
Expand All @@ -32,9 +36,6 @@ patches:
- patch_file: "patches/3.1.19-0001-fix-install-and-static-or-shared.patch"
patch_description: "fix install path, separate static/shared build"
patch_type: "conan"
- patch_file: "patches/3.1.19-0002-remove-wx-flag.patch"
patch_description: "remove WX flags in MSVC"
patch_type: "conan"
- patch_file: "patches/3.1.11-0003-include-order-windows-winsock2.patch"
patch_description: "fix include order for windows winsock2"
patch_type: "portability"
Expand Down
11 changes: 10 additions & 1 deletion recipes/mariadb-connector-c/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ def generate(self):
tc.variables["INSTALL_BINDIR"] = "bin"
tc.variables["INSTALL_LIBDIR"] = "lib"
tc.variables["INSTALL_PLUGINDIR"] = os.path.join("lib", "plugin").replace("\\", "/")
tc.variables["ZLIB_LIBRARY"] = "ZLIB::ZLIB"
# To install relocatable shared libs on Macos
tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW"
tc.generate()
Expand All @@ -104,7 +105,7 @@ def _patch_sources(self):
apply_conandata_patches(self)

root_cmake = os.path.join(self.source_folder, "CMakeLists.txt")
replace_in_file(self, root_cmake, "${ZLIB_LIBRARY}", "${ZLIB_LIBRARIES}")
libmariadb_cmake = os.path.join(self.source_folder, "libmariadb", "CMakeLists.txt")
replace_in_file(self,
root_cmake,
"SET(SSL_LIBRARIES ${OPENSSL_SSL_LIBRARY} ${OPENSSL_CRYPTO_LIBRARY})",
Expand All @@ -113,6 +114,14 @@ def _patch_sources(self):
replace_in_file(self, root_cmake, "${CURL_LIBRARIES}", "CURL::libcurl")
plugins_io_cmake = os.path.join(self.source_folder, "plugins", "io", "CMakeLists.txt")
replace_in_file(self, plugins_io_cmake, "${CURL_LIBRARIES}", "CURL::libcurl")
if Version(self.version) >= "3.3.6":
replace_in_file(self, root_cmake, "${WARNING_AS_ERROR}", "")
elif Version(self.version) >= "3.1.18":
replace_in_file(self, root_cmake, " -WX", "")
if Version(self.version) >= "3.3":
replace_in_file(self, root_cmake,
"INCLUDE(${CC_SOURCE_DIR}/cmake/FindZStd.cmake)",
"find_package(ZSTD REQUIRED CONFIG)")

def build(self):
self._patch_sources()
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,6 @@ diff --git a/libmariadb/CMakeLists.txt b/libmariadb/CMakeLists.txt
index 070fdc9..77584e6 100644
--- a/libmariadb/CMakeLists.txt
+++ b/libmariadb/CMakeLists.txt
@@ -288,7 +288,7 @@ SET(MARIADB_NONBLOCK_SYMBOLS

# handle static plugins
SET(LIBMARIADB_SOURCES ${LIBMARIADB_SOURCES} ${LIBMARIADB_PLUGIN_SOURCES})
-SET(SYSTEM_LIBS ${SYSTEM_LIBS} ${LIBMARIADB_PLUGIN_LIBS} ${ZSTD_LIBRARY} ${ZLIB_LIBRARY})
+SET(SYSTEM_LIBS ${SYSTEM_LIBS} ${LIBMARIADB_PLUGIN_LIBS} ${ZSTD_LIBRARY} ZLIB::ZLIB)
MESSAGE(STATUS "SYSTEM_LIBS: ${SYSTEM_LIBS}")
INCLUDE_DIRECTORIES(${LIBMARIADB_PLUGIN_INCLUDES})
ADD_DEFINITIONS(${LIBMARIADB_PLUGIN_DEFS})
@@ -404,7 +404,7 @@ ELSE()
ENDIF()

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
--- libmariadb/CMakeLists.txt
+++ libmariadb/CMakeLists.txt
@@ -414,7 +414,7 @@
ENDIF()


-IF(CMAKE_VERSION VERSION_GREATER 2.8.7)
+IF(FALSE)
# CREATE OBJECT LIBRARY
ADD_LIBRARY(mariadb_obj OBJECT ${LIBMARIADB_SOURCES})
IF(UNIX)
@@ -443,21 +443,24 @@
"FILE_DESCRIPTION:Dynamic lib for client/server communication")
ENDIF()

+IF(NOT BUILD_SHARED_LIBS)
ADD_LIBRARY(mariadbclient STATIC ${MARIADB_OBJECTS} ${EMPTY_FILE})
TARGET_LINK_LIBRARIES(mariadbclient ${SYSTEM_LIBS} ${CRYPTO_LIBS})
-
+ELSE()
IF(UNIX)
ADD_LIBRARY(libmariadb SHARED ${libmariadb_RC} ${MARIADB_OBJECTS} ${EMPTY_FILE})
SET_TARGET_PROPERTIES(libmariadb PROPERTIES COMPILE_FLAGS "${CMAKE_SHARED_LIBRARY_C_FLAGS}")
ELSE()
- ADD_LIBRARY(libmariadb SHARED ${libmariadb_RC} ${MARIADB_OBJECTS} mariadbclient.def)
+ ADD_LIBRARY(libmariadb SHARED ${libmariadb_RC} ${MARIADB_OBJECTS} ${EMPTY_FILE} mariadbclient.def)
SET_TARGET_PROPERTIES(libmariadb PROPERTIES LINKER_LANGUAGE C)
ENDIF()

TARGET_LINK_LIBRARIES(libmariadb LINK_PRIVATE ${SYSTEM_LIBS} ${CRYPTO_LIBS})

SIGN_TARGET(libmariadb)
-
+ENDIF()
+
+IF(BUILD_SHARED_LIBS)
IF(CMAKE_SYSTEM_NAME MATCHES "Linux" OR
CMAKE_SYSTEM_NAME MATCHES "kFreeBSD" OR
CMAKE_SYSTEM_NAME MATCHES "GNU")
@@ -466,11 +469,14 @@
ENDIF()
SET_TARGET_PROPERTIES(libmariadb PROPERTIES LINK_FLAGS "${CC_BINARY_DIR}/libmariadb/mariadbclient.def")
ENDIF()
-
+ELSE()
SET_TARGET_PROPERTIES(mariadbclient PROPERTIES IMPORTED_INTERFACE_LINK_LIBRARIES "${SYSTEM_LIBS}")
+ENDIF()
+IF(BUILD_SHARED_LIBS)
SET_TARGET_PROPERTIES(libmariadb PROPERTIES IMPORTED_INTERFACE_LINK_LIBRARIES "${SYSTEM_LIBS}")

SET_TARGET_PROPERTIES(libmariadb PROPERTIES PREFIX "")
+ENDIF()

#
# Installation
@@ -490,11 +496,15 @@
ENDIF()
ENDIF()

+IF(NOT BUILD_SHARED_LIBS)
create_symlink(libmariadb${CMAKE_STATIC_LIBRARY_SUFFIX} mariadbclient ${INSTALL_LIBDIR})
-
+ENDIF()
+
+IF(BUILD_SHARED_LIBS)
SET_TARGET_PROPERTIES(libmariadb PROPERTIES VERSION
${CPACK_PACKAGE_VERSION_MAJOR}
SOVERSION ${CPACK_PACKAGE_VERSION_MAJOR})
+ELSE()

IF(NOT WIN32)
SET_TARGET_PROPERTIES(mariadbclient PROPERTIES OUTPUT_NAME "${LIBMARIADB_STATIC_NAME}")
@@ -502,20 +512,33 @@

INSTALL(TARGETS mariadbclient
COMPONENT Development
- DESTINATION ${INSTALL_LIBDIR})
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
+ENDIF()
+
+IF(BUILD_SHARED_LIBS)
IF(WIN32)
INSTALL(TARGETS libmariadb
COMPONENT SharedLibraries
- DESTINATION ${INSTALL_LIBDIR})
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
ELSE()
# in cmake 3.12+ we can use
#INSTALL(TARGETS libmariadb LIBRARY DESTINATION ${INSTALL_LIBDIR}
# COMPONENT SharedLibraries NAMELINK_COMPONENT Development)
# but as long as we build on CentOS 7 with its cmake 2.8.12.2 we have to use
-INSTALL(TARGETS libmariadb LIBRARY DESTINATION ${INSTALL_LIBDIR}
- COMPONENT SharedLibraries NAMELINK_SKIP)
-INSTALL(TARGETS libmariadb LIBRARY DESTINATION ${INSTALL_LIBDIR}
- COMPONENT Development NAMELINK_ONLY)
+INSTALL(TARGETS libmariadb LIBRARY
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ COMPONENT SharedLibraries)
+INSTALL(TARGETS libmariadb LIBRARY
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ COMPONENT Development)
ENDIF()

IF(MSVC)
@@ -524,3 +547,4 @@
CONFIGURATIONS Debug RelWithDebInfo
COMPONENT Development)
ENDIF()
+ENDIF()
2 changes: 2 additions & 0 deletions recipes/mariadb-connector-c/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
versions:
"3.3.8":
folder: all
"3.3.3":
folder: all
"3.1.19":
Expand Down

0 comments on commit 78cf76d

Please sign in to comment.