Skip to content

Commit

Permalink
(conan-io#15040) mariadb-connector-c: add version 3.1.19/3.3.3
Browse files Browse the repository at this point in the history
* mariadb-connector-c: add version 3.1.19/3.3.3

* add end line

* fix patch_type

* remove man folder

* fix shared build

* remove WX option

* apply patch to 3.1.19
  • Loading branch information
toge authored and StellaSmith committed Feb 2, 2023
1 parent b635b8c commit a54f2f9
Show file tree
Hide file tree
Showing 11 changed files with 332 additions and 11 deletions.
74 changes: 64 additions & 10 deletions recipes/mariadb-connector-c/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,74 @@
sources:
"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"
"3.1.19":
url: "https://downloads.mariadb.com/Connectors/c/connector-c-3.1.19/mariadb-connector-c-3.1.19-src.tar.gz"
sha256: "3cafe6e197a0610e9a77aea4f0733a52e0697e8557998de4c4156c242e1ff405"
"3.1.12":
url: "https://downloads.mariadb.com/Connectors/c/connector-c-3.1.12/mariadb-connector-c-3.1.12-src.tar.gz"
sha256: "2f5ae14708b4813e4ff6857d152c22e6fc0e551c9fa743c1ef81a68e3254fe63"
"3.1.11":
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-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"
- patch_file: "patches/3.1.11-0004-include-mysqld_error-header.patch"
patch_description: "always include mysqld_error.h"
patch_type: "portability"
"3.1.19":
- 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"
- patch_file: "patches/3.1.11-0004-include-mysqld_error-header.patch"
patch_description: "always include mysqld_error.h"
patch_type: "portability"
"3.1.12":
- patch_file: "patches/0001-fix-install-and-static-or-shared.patch"
- patch_file: "patches/0002-msvc-no-override-md-zi.patch"
- patch_file: "patches/0003-include-order-windows-winsock2.patch"
- patch_file: "patches/0004-include-mysqld_error-header.patch"
- patch_file: "patches/0005-fix-cmake-connectorname.patch"
- patch_file: "patches/3.1.11-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-0002-msvc-no-override-md-zi.patch"
patch_description: "honor conan's build type"
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"
- patch_file: "patches/3.1.11-0004-include-mysqld_error-header.patch"
patch_description: "always include mysqld_error.h"
patch_type: "portability"
- patch_file: "patches/3.1.11-0005-fix-cmake-connectorname.patch"
patch_description: "fix wrong function name END()"
patch_type: "bugfix"
patch_source: "https://github.com/mariadb-corporation/mariadb-connector-c/commit/242cab8cbcd91af882233730a83627d3b12ced83"
"3.1.11":
- patch_file: "patches/0001-fix-install-and-static-or-shared.patch"
- patch_file: "patches/0002-msvc-no-override-md-zi.patch"
- patch_file: "patches/0003-include-order-windows-winsock2.patch"
- patch_file: "patches/0004-include-mysqld_error-header.patch"
- patch_file: "patches/0005-fix-cmake-connectorname.patch"
- patch_file: "patches/3.1.11-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-0002-msvc-no-override-md-zi.patch"
patch_description: "honor conan's build type"
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"
- patch_file: "patches/3.1.11-0004-include-mysqld_error-header.patch"
patch_description: "always include mysqld_error.h"
patch_type: "portability"
- patch_file: "patches/3.1.11-0005-fix-cmake-connectorname.patch"
patch_description: "fix wrong function name END()"
patch_type: "bugfix"
patch_source: "https://github.com/mariadb-corporation/mariadb-connector-c/commit/242cab8cbcd91af882233730a83627d3b12ced83"
3 changes: 2 additions & 1 deletion recipes/mariadb-connector-c/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ def package(self):
cmake.install()
rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig"))
rmdir(self, os.path.join(self.package_folder, "symbols"))
rmdir(self, os.path.join(self.package_folder, "man"))
rm(self, "*.pdb", os.path.join(self.package_folder, "lib"))

def package_info(self):
Expand All @@ -134,7 +135,7 @@ def package_info(self):
self.cpp_info.system_libs.append("secur32")

plugin_dir = os.path.join(self.package_folder, "lib", "plugin").replace("\\", "/")
self.output.info("Prepending to MARIADB_PLUGIN_DIR runtime environment variable: {}".format(plugin_dir))
self.output.info(f"Prepending to MARIADB_PLUGIN_DIR runtime environment variable: {plugin_dir}")
self.runenv_info.prepend_path("MARIADB_PLUGIN_DIR", plugin_dir)

# TODO: to remove in conan v2?
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
diff --git a/libmariadb/CMakeLists.txt b/libmariadb/CMakeLists.txt
index f257926..a78329e 100644
--- a/libmariadb/CMakeLists.txt
+++ b/libmariadb/CMakeLists.txt
@@ -379,7 +379,7 @@ ELSE()
ENDIF()


-IF(CMAKE_VERSION VERSION_GREATER 2.8.7)
+IF(FALSE)
# CREATE OBJECT LIBRARY
ADD_LIBRARY(mariadb_obj OBJECT ${LIBMARIADB_SOURCES})
IF(UNIX)
@@ -405,26 +405,28 @@ IF(WIN32)
"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})
-
+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})

SIGN_TARGET(libmariadb)
+ENDIF()

-IF(CMAKE_SIZEOF_VOID_P EQUAL 8 AND MSVC)
+IF(CMAKE_SIZEOF_VOID_P EQUAL 8 AND MSVC AND NOT BUILD_SHARED_LIBS)
SET_TARGET_PROPERTIES(mariadbclient PROPERTIES STATIC_LIBRARY_FLAGS "/machine:x64")
ENDIF()

+IF(BUILD_SHARED_LIBS)
IF(CMAKE_SYSTEM_NAME MATCHES "Linux" OR
CMAKE_SYSTEM_NAME MATCHES "kFreeBSD" OR
CMAKE_SYSTEM_NAME MATCHES "GNU")
@@ -434,10 +436,14 @@ IF(CMAKE_SYSTEM_NAME MATCHES "Linux" OR
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
@@ -457,11 +463,15 @@ IF(WITH_MYSQLCOMPAT)
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}")
@@ -469,20 +479,33 @@ ENDIF()

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)
@@ -491,3 +514,4 @@ IF(MSVC)
CONFIGURATIONS Debug RelWithDebInfo
COMPONENT Development)
ENDIF()
+ENDIF()
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f3b6cbd..f3e8993 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -100,7 +100,7 @@ IF(MSVC)
ADD_DEFINITIONS(-DWIN32_LEAN_AND_MEAN)
IF (MSVC)
# Treat warnings as errors
- SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -WX")
+ # SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -WX")
SET(CONFIG_TYPES "DEBUG" "RELEASE" "RELWITHDEBINFO")
FOREACH(BUILD_TYPE ${CONFIG_TYPES})
FOREACH(COMPILER CXX C)
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
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()


-IF(CMAKE_VERSION VERSION_GREATER 2.8.7)
+IF(FALSE)
# CREATE OBJECT LIBRARY
ADD_LIBRARY(mariadb_obj OBJECT ${LIBMARIADB_SOURCES})
IF(UNIX)
@@ -433,22 +433,24 @@ IF(WIN32)
"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})
-
+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})

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")
@@ -457,11 +459,14 @@ IF(CMAKE_SYSTEM_NAME MATCHES "Linux" OR
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
@@ -481,11 +486,15 @@ IF(WITH_MYSQLCOMPAT)
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}")
@@ -493,20 +502,33 @@ ENDIF()

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)
@@ -515,3 +537,4 @@ IF(MSVC)
CONFIGURATIONS Debug RelWithDebInfo
COMPONENT Development)
ENDIF()
+ENDIF()
4 changes: 4 additions & 0 deletions recipes/mariadb-connector-c/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
versions:
"3.3.3":
folder: all
"3.1.19":
folder: all
"3.1.12":
folder: all
"3.1.11":
Expand Down

0 comments on commit a54f2f9

Please sign in to comment.