[libmariadb] Update, major refresh (#41175)

This commit is contained in:
Kai Pastor 2024-10-01 00:15:24 +02:00 committed by GitHub
parent 511d74f695
commit d062724539
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
20 changed files with 316 additions and 295 deletions

View File

@ -0,0 +1,27 @@
diff --git a/libmariadb/CMakeLists.txt b/libmariadb/CMakeLists.txt
index bbad89a..71662d3 100644
--- a/libmariadb/CMakeLists.txt
+++ b/libmariadb/CMakeLists.txt
@@ -547,3 +547,22 @@ IF(0)
CONFIGURATIONS Debug RelWithDebInfo
COMPONENT Development)
ENDIF()
+
+set_target_properties(mariadbclient PROPERTIES EXPORT_NAME libmariadb)
+
+install(EXPORT unofficial-libmariadb-targets
+ NAMESPACE unofficial::
+ DESTINATION share/unofficial-libmariadb
+)
+
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/unofficial-libmariadb-config.cmake.in" [[
+if(NOT "@BUILD_SHARED_LIBS@")
+ include(CMakeFindDependencyMacro)
+ if("@WITH_ZSTD@")
+ find_dependency(zstd CONFIG)
+ endif()
+endif()
+include("${CMAKE_CURRENT_LIST_DIR}/unofficial-libmariadb-targets.cmake")
+]])
+configure_file("${CMAKE_CURRENT_BINARY_DIR}/unofficial-libmariadb-config.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/unofficial-libmariadb-config.cmake" @ONLY)
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/unofficial-libmariadb-config.cmake" DESTINATION share/unofficial-libmariadb)

View File

@ -0,0 +1,13 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8994119..9ccfacb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -113,8 +113,6 @@ IF(MSVC)
ENDIF()
ENDIF()
STRING(REPLACE "/Zi" "/Z7" COMPILER_FLAGS ${COMPILER_FLAGS})
- MESSAGE (STATUS "CMAKE_${COMPILER}_FLAGS_${BUILD_TYPE}= ${COMPILER_FLAGS}")
- SET(CMAKE_${COMPILER}_FLAGS_${BUILD_TYPE} ${COMPILER_FLAGS})
ENDIF()
ENDFOREACH()
ENDFOREACH()

View File

@ -0,0 +1,110 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9ccfacb..4e28b38 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -219,7 +219,12 @@ INCLUDE(${CC_SOURCE_DIR}/cmake/SearchLibrary.cmake)
# Compression plugins: ZSTD, ZLIB
-INCLUDE(${CC_SOURCE_DIR}/cmake/FindZStd.cmake)
+if(WITH_ZSTD)
+ find_package(ZSTD NAMES zstd REQUIRED)
+ set(ZSTD_LIBRARIES zstd::libzstd)
+else()
+ set(ZSTD_FOUND 0)
+endif()
IF(WITH_EXTERNAL_ZLIB)
IF(NOT ZLIB_FOUND)
@@ -250,7 +255,7 @@ IF(UNIX)
SEARCH_LIBRARY(LIBNSL gethostbyname_r "nsl_r;nsl")
SEARCH_LIBRARY(LIBSOCKET setsockopt socket)
FIND_PACKAGE(Threads)
- SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${LIBNSL} ${LIBBIND} ${LIBICONV} ${ZLIB_LIBRARY}
+ SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${LIBNSL} ${LIBBIND} ${LIBICONV} ${ZLIB_LIBRARIES}
${LIBSOCKET} ${CMAKE_DL_LIBS} ${LIBM} ${LIBPTHREAD})
SET(SYSTEM_LIBS ${SYSTEM_LIBS} ${LIBNSL} ${LIBBIND} ${LIBICONV}
${LIBSOCKET} ${CMAKE_DL_LIBS} ${LIBM} ${LIBPTHREAD})
@@ -307,7 +312,7 @@ IF(NOT WITH_SSL STREQUAL "OFF")
ADD_DEFINITIONS(-DHAVE_OPENSSL -DHAVE_TLS)
SET(SSL_SOURCES "${CC_SOURCE_DIR}/libmariadb/secure/openssl.c"
"${CC_SOURCE_DIR}/libmariadb/secure/openssl_crypt.c")
- SET(SSL_LIBRARIES ${OPENSSL_SSL_LIBRARY} ${OPENSSL_CRYPTO_LIBRARY})
+ SET(SSL_LIBRARIES ${OPENSSL_LIBRARIES})
IF(WIN32 AND EXISTS ${OPENSSL_INCLUDE_DIR}/openssl/applink.c)
SET(HAVE_OPENSSL_APPLINK_C 1)
ENDIF()
@@ -371,7 +376,12 @@ ENDIF()
IF(WITH_ICONV)
IF(NOT WIN32)
- INCLUDE(${CC_SOURCE_DIR}/cmake/FindIconv.cmake)
+ find_package(Iconv REQUIRED)
+ include_directories(${Iconv_INCLUDE_DIRS})
+ set(ICONV_LIBRARIES "${Iconv_LIBRARIES}")
+ if(NOT Iconv_IS_BUILT_IN)
+ set(ICONV_EXTERNAL 1)
+ endif()
ENDIF()
ENDIF()
@@ -431,7 +441,7 @@ ENDIF()
INCLUDE(${CC_SOURCE_DIR}/plugins/CMakeLists.txt)
ADD_SUBDIRECTORY(include)
ADD_SUBDIRECTORY(libmariadb)
-IF((NOT WIN32) OR CYGWIN)
+IF(1)
ADD_SUBDIRECTORY(mariadb_config)
ENDIF()
diff --git a/libmariadb/CMakeLists.txt b/libmariadb/CMakeLists.txt
index 852be8d..61ad0a6 100644
--- a/libmariadb/CMakeLists.txt
+++ b/libmariadb/CMakeLists.txt
@@ -293,7 +293,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_LIBRARIES} ${ZLIB_LIBRARIES})
MESSAGE(STATUS "SYSTEM_LIBS: ${SYSTEM_LIBS}")
INCLUDE_DIRECTORIES(${LIBMARIADB_PLUGIN_INCLUDES})
ADD_DEFINITIONS(${LIBMARIADB_PLUGIN_DEFS})
diff --git a/mariadb_config/CMakeLists.txt b/mariadb_config/CMakeLists.txt
index 4cb0ba9..c15838a 100644
--- a/mariadb_config/CMakeLists.txt
+++ b/mariadb_config/CMakeLists.txt
@@ -30,6 +30,22 @@ IF(${rllength} GREATER 0)
LIST(REMOVE_DUPLICATES SYSTEM_LIBS)
ENDIF()
+set(REQUIRES_PRIVATE "" CACHE STRING "")
+list(REMOVE_ITEM SYSTEM_LIBS ${ZLIB_LIBRARIES})
+string(APPEND REQUIRES_PRIVATE " zlib")
+if(LIBM)
+ list(REMOVE_ITEM SYSTEM_LIBS ${LIBM})
+ list(APPEND SYSTEM_LIBS "m")
+endif()
+if(WITH_SSL STREQUAL "OPENSSL")
+ list(REMOVE_ITEM SYSTEM_LIBS ${SSL_LIBRARIES})
+ string(APPEND REQUIRES_PRIVATE " openssl")
+endif()
+if(WITH_ZSTD)
+ list(REMOVE_ITEM SYSTEM_LIBS ${ZSTD_LIBRARIES})
+ string(APPEND REQUIRES_PRIVATE " libzstd")
+endif()
+
FOREACH (LIB_NAME ${SYSTEM_LIBS})
GET_LIB_NAME(${LIB_NAME} LIB_OUT)
SET(extra_dynamic_LDFLAGS "${extra_dynamic_LDFLAGS} ${LIB_OUT}")
diff --git a/mariadb_config/libmariadb.pc.in b/mariadb_config/libmariadb.pc.in
index 968181a..3f0410d 100644
--- a/mariadb_config/libmariadb.pc.in
+++ b/mariadb_config/libmariadb.pc.in
@@ -16,5 +16,6 @@ Description: MariaDB Connector/C dynamic library
Cflags: -I${includedir}
Libs: -L${libdir} -lmariadb
Libs.private: @extra_dynamic_LDFLAGS@
+Requires.private: @REQUIRES_PRIVATE@

View File

@ -0,0 +1,15 @@
diff --git a/mariadb_config/CMakeLists.txt b/mariadb_config/CMakeLists.txt
index 0a32343..4cb0ba9 100644
--- a/mariadb_config/CMakeLists.txt
+++ b/mariadb_config/CMakeLists.txt
@@ -58,9 +58,7 @@ ENDIF()
# Installation
#
-INSTALL(TARGETS mariadb_config
- DESTINATION "${INSTALL_BINDIR}"
- COMPONENT Development)
+set_target_properties(mariadb_config PROPERTIES EXCLUDE_FROM_ALL 1) # not portable
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/libmariadb.pc
DESTINATION "${INSTALL_PCDIR}"

View File

@ -1,18 +0,0 @@
diff --git a/unittest/libmariadb/CMakeLists.txt b/unittest/libmariadb/CMakeLists.txt
index e3ba18b..48c4f1d 100644
--- a/unittest/libmariadb/CMakeLists.txt
+++ b/unittest/libmariadb/CMakeLists.txt
@@ -48,6 +48,7 @@ ENDIF()
ADD_LIBRARY(ma_getopt ma_getopt.c)
+if(0)
FOREACH(API_TEST ${API_TESTS})
IF (NOT TARGET ${API_TEST})
ADD_EXECUTABLE(${API_TEST} ${API_TEST}.c)
@@ -65,3 +66,4 @@ FOREACH(API_TEST ${MANUAL_TESTS})
ADD_EXECUTABLE(${API_TEST} ${API_TEST}.c)
TARGET_LINK_LIBRARIES(${API_TEST} cctap ma_getopt mariadbclient)
ENDFOREACH()
+endif()
\ No newline at end of file

View File

@ -1,83 +0,0 @@
diff --git a/libmariadb/CMakeLists.txt b/libmariadb/CMakeLists.txt
index 7faf827..d7300b0 100644
--- a/libmariadb/CMakeLists.txt
+++ b/libmariadb/CMakeLists.txt
@@ -417,13 +417,13 @@ ADD_LIBRARY(mariadbclient STATIC ${MARIADB_OBJECTS} ${EMPTY_FILE})
TARGET_LINK_LIBRARIES(mariadbclient ${SYSTEM_LIBS})
IF(UNIX)
- ADD_LIBRARY(libmariadb SHARED ${libmariadb_RC} ${MARIADB_OBJECTS} ${EMPTY_FILE})
- SET_TARGET_PROPERTIES(libmariadb PROPERTIES COMPILE_FLAGS "${CMAKE_SHARED_LIBRARY_C_FLAGS}")
+ ADD_LIBRARY(libmariadb ${libmariadb_RC} ${MARIADB_OBJECTS} ${EMPTY_FILE})
ELSE()
- ADD_LIBRARY(libmariadb SHARED ${libmariadb_RC} ${MARIADB_OBJECTS} mariadbclient.def)
+ ADD_LIBRARY(libmariadb ${libmariadb_RC} ${MARIADB_OBJECTS} mariadbclient.def)
SET_TARGET_PROPERTIES(libmariadb PROPERTIES LINKER_LANGUAGE C)
ENDIF()
+TARGET_INCLUDE_DIRECTORIES(libmariadb PUBLIC $<INSTALL_INTERFACE:include/mysql>)
TARGET_LINK_LIBRARIES(libmariadb LINK_PRIVATE ${SYSTEM_LIBS})
SIGN_TARGET(libmariadb)
@@ -460,7 +460,9 @@ IF(WITH_MYSQLCOMPAT)
ENDIF()
ENDIF()
+IF(0)
create_symlink(libmariadb${CMAKE_STATIC_LIBRARY_SUFFIX} mariadbclient ${INSTALL_LIBDIR})
+ENDIF()
SET_TARGET_PROPERTIES(libmariadb PROPERTIES VERSION
${CPACK_PACKAGE_VERSION_MAJOR}
@@ -470,13 +472,39 @@ IF(NOT WIN32)
SET_TARGET_PROPERTIES(mariadbclient PROPERTIES OUTPUT_NAME "${LIBMARIADB_STATIC_NAME}")
ENDIF()
+IF(VCPKG_MARIADBCLIENT)
INSTALL(TARGETS mariadbclient
COMPONENT Development
- DESTINATION ${INSTALL_LIBDIR})
-IF(WIN32)
+ EXPORT unofficial-libmariadb-targets
+ LIBRARY DESTINATION lib)
+ELSE()
+ set_target_properties(mariadbclient PROPERTIES EXCLUDE_FROM_ALL 1)
+ENDIF()
+
+IF(1)
INSTALL(TARGETS libmariadb
COMPONENT SharedLibraries
- DESTINATION ${INSTALL_LIBDIR})
+ EXPORT unofficial-libmariadb-targets
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib)
+
+install(EXPORT unofficial-libmariadb-targets
+ NAMESPACE unofficial::
+ DESTINATION share/unofficial-libmariadb
+)
+
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/unofficial-libmariadb-config.cmake.in"
+[[include(CMakeFindDependencyMacro)
+find_dependency(ZLIB)
+if("@WITH_SSL@" STREQUAL "OPENSSL")
+ find_dependency(OpenSSL)
+endif()
+include("${CMAKE_CURRENT_LIST_DIR}/unofficial-libmariadb-targets.cmake")
+]])
+configure_file("${CMAKE_CURRENT_BINARY_DIR}/unofficial-libmariadb-config.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/unofficial-libmariadb-config.cmake" @ONLY)
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/unofficial-libmariadb-config.cmake DESTINATION share/unofficial-libmariadb)
+
ELSE()
# in cmake 3.12+ we can use
#INSTALL(TARGETS libmariadb LIBRARY DESTINATION ${INSTALL_LIBDIR}
@@ -488,7 +516,7 @@ INSTALL(TARGETS libmariadb LIBRARY DESTINATION ${INSTALL_LIBDIR}
COMPONENT Development NAMELINK_ONLY)
ENDIF()
-IF(MSVC)
+IF(0)
# On Windows, install PDB
INSTALL(FILES $<TARGET_PDB_FILE:libmariadb> DESTINATION "${INSTALL_LIBDIR}"
CONFIGURATIONS Debug RelWithDebInfo

View File

@ -1,40 +0,0 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 203fca7..65cc350 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -342,7 +342,8 @@ ENDIF()
IF(WITH_ICONV)
IF(NOT WIN32)
- INCLUDE(${CC_SOURCE_DIR}/cmake/FindIconv.cmake)
+ find_package(Iconv REQUIRED)
+ include_directories(${Iconv_INCLUDE_DIRS})
ENDIF()
ENDIF()
@@ -359,8 +360,8 @@ IF(WIN32)
SET(SYSTEM_LIBS ws2_32 advapi32 kernel32 shlwapi crypt32 ${LIBZ})
ELSE()
SET(SYSTEM_LIBS ${SYSTEM_LIBS} ${LIBPTHREAD} ${CMAKE_DL_LIBS} ${LIBM})
- IF(ICONV_EXTERNAL)
- SET(SYSTEM_LIBS ${SYSTEM_LIBS} ${ICONV_LIBRARIES})
+ IF(WITH_ICONV)
+ SET(SYSTEM_LIBS ${SYSTEM_LIBS} ${Iconv_LIBRARIES})
ENDIF()
ENDIF()
IF(WITH_SSL)
diff --git a/mariadb_config/CMakeLists.txt b/mariadb_config/CMakeLists.txt
index 5bbf36b..70e619b 100644
--- a/mariadb_config/CMakeLists.txt
+++ b/mariadb_config/CMakeLists.txt
@@ -38,8 +38,8 @@ STRING(STRIP "${extra_dynamic_LDFLAGS}" extra_dynamic_LDFLAGS)
LIST(REMOVE_DUPLICATES extra_dynamic_LDFLAGS)
IF(UNIX AND NOT APPLE)
- IF(ICONV_EXTERNAL)
- GET_LIB_NAME(${ICONV_LIBRARIES} LIB_OUT)
+ IF(WITH_ICONV AND NOT Iconv_IS_BUILT_IN)
+ GET_LIB_NAME("${Iconv_LIBRARIES}" LIB_OUT)
SET(extra_dynamic_LDFLAGS "${extra_dynamic_LDFLAGS} ${LIB_OUT}")
ENDIF()
ENDIF()

View File

@ -1,13 +0,0 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 33565f5..d83176d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -280,7 +280,7 @@ IF(NOT WITH_SSL STREQUAL "OFF")
IF(OPENSSL_FOUND)
ADD_DEFINITIONS(-DHAVE_OPENSSL -DHAVE_TLS)
SET(SSL_SOURCES "${CC_SOURCE_DIR}/libmariadb/secure/openssl.c")
- SET(SSL_LIBRARIES ${OPENSSL_SSL_LIBRARY} ${OPENSSL_CRYPTO_LIBRARY})
+ SET(SSL_LIBRARIES OpenSSL::SSL)
IF(WIN32)
CHECK_INCLUDE_FILES (${OPENSSL_INCLUDE_DIR}/openssl/applink.c HAVE_OPENSSL_APPLINK_C)
ENDIF()

View File

@ -0,0 +1,61 @@
diff --git a/libmariadb/CMakeLists.txt b/libmariadb/CMakeLists.txt
index 61ad0a6..bbad89a 100644
--- a/libmariadb/CMakeLists.txt
+++ b/libmariadb/CMakeLists.txt
@@ -494,7 +494,9 @@ IF(WITH_MYSQLCOMPAT)
ENDIF()
ENDIF()
+if(NOT BUILD_SHARED_LIBS)
create_symlink(libmariadb${CMAKE_STATIC_LIBRARY_SUFFIX} mariadbclient ${INSTALL_LIBDIR})
+endif()
SET_TARGET_PROPERTIES(libmariadb PROPERTIES VERSION
${CPACK_PACKAGE_VERSION_MAJOR}
@@ -502,27 +504,44 @@ SET_TARGET_PROPERTIES(libmariadb PROPERTIES VERSION
IF(NOT WIN32)
SET_TARGET_PROPERTIES(mariadbclient PROPERTIES OUTPUT_NAME "${LIBMARIADB_STATIC_NAME}")
+elseif(MINGW)
+ set_target_properties(libmariadb PROPERTIES IMPORT_PREFIX "")
ENDIF()
+if(NOT BUILD_SHARED_LIBS)
+set_target_properties(libmariadb PROPERTIES EXCLUDE_FROM_ALL 1)
+target_include_directories(mariadbclient PUBLIC $<INSTALL_INTERFACE:include/mysql>)
INSTALL(TARGETS mariadbclient
+ EXPORT unofficial-libmariadb-targets
COMPONENT Development
+ ARCHIVE
DESTINATION ${INSTALL_LIBDIR})
+else()
+set_target_properties(mariadbclient PROPERTIES EXCLUDE_FROM_ALL 1)
+target_include_directories(libmariadb PUBLIC $<INSTALL_INTERFACE:include/mysql>)
IF(WIN32)
INSTALL(TARGETS libmariadb
+ EXPORT unofficial-libmariadb-targets
COMPONENT SharedLibraries
+ RUNTIME DESTINATION ${INSTALL_BINDIR}
+ LIBRARY DESTINATION ${INSTALL_LIBDIR}
+ ARCHIVE
DESTINATION ${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}
+INSTALL(TARGETS libmariadb
+ EXPORT unofficial-libmariadb-targets
+ LIBRARY DESTINATION ${INSTALL_LIBDIR}
COMPONENT SharedLibraries NAMELINK_SKIP)
INSTALL(TARGETS libmariadb LIBRARY DESTINATION ${INSTALL_LIBDIR}
COMPONENT Development NAMELINK_ONLY)
ENDIF()
+endif()
-IF(MSVC)
+IF(0)
# On Windows, install PDB
INSTALL(FILES $<TARGET_PDB_FILE:libmariadb> DESTINATION "${INSTALL_LIBDIR}"
CONFIGURATIONS Debug RelWithDebInfo

View File

@ -1,13 +0,0 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index cd716e3..a1f2ada 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -98,7 +98,7 @@ IF(MSVC)
# Speedup system tests
INCLUDE(${CC_SOURCE_DIR}/cmake/WindowsCache.cmake)
ADD_DEFINITIONS(-DWIN32_LEAN_AND_MEAN)
- IF (MSVC)
+ IF (MSVC AND 0)
SET(CONFIG_TYPES "DEBUG" "RELEASE" "RELWITHDEBINFO")
FOREACH(BUILD_TYPE ${CONFIG_TYPES})
FOREACH(COMPILER CXX C)

View File

@ -11,16 +11,3 @@ index a82dbb7..e9005fa 100644
/* mysqld compile time options */
#ifndef MYSQL_CHARSET
diff --git a/mariadb_config/mariadb_config.c.in b/mariadb_config/mariadb_config.c.in
index 36c0117..4184e4b 100644
--- a/mariadb_config/mariadb_config.c.in
+++ b/mariadb_config/mariadb_config.c.in
@@ -225,7 +225,7 @@ end:
}
if (!p || !p[0])
{
- strncpy(installation_dir, "@CMAKE_SYSROOT@@CMAKE_INSTALL_PREFIX@", PATH_MAX - 1);
+ strncpy(installation_dir, "../@CMAKE_INSTALL_PREFIX@", PATH_MAX - 1);
return;
}
}

View File

@ -1,60 +0,0 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a109325..b56403c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -420,7 +420,7 @@ ENDIF()
INCLUDE(${CC_SOURCE_DIR}/plugins/CMakeLists.txt)
ADD_SUBDIRECTORY(include)
ADD_SUBDIRECTORY(libmariadb)
-IF(NOT WIN32)
+IF(1)
ADD_SUBDIRECTORY(mariadb_config)
ENDIF()
diff --git a/mariadb_config/CMakeLists.txt b/mariadb_config/CMakeLists.txt
index 743ae52..482a4cf 100644
--- a/mariadb_config/CMakeLists.txt
+++ b/mariadb_config/CMakeLists.txt
@@ -30,6 +30,15 @@ IF(${rllength} GREATER 0)
LIST(REMOVE_DUPLICATES SYSTEM_LIBS)
ENDIF()
+set(REQUIRES_PRIVATE "" CACHE STRING "")
+if(WITH_SSL STREQUAL "OPENSSL")
+ list(REMOVE_ITEM SYSTEM_LIBS ${SSL_LIBRARIES})
+ string(APPEND REQUIRES_PRIVATE " openssl")
+endif()
+if(WITH_EXTERNAL_ZLIB)
+ string(APPEND REQUIRES_PRIVATE " zlib")
+endif()
+
FOREACH (LIB_NAME ${SYSTEM_LIBS})
GET_LIB_NAME(${LIB_NAME} LIB_OUT)
SET(extra_dynamic_LDFLAGS "${extra_dynamic_LDFLAGS} ${LIB_OUT}")
@@ -50,6 +59,7 @@ CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mariadb_config.c.in
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/libmariadb.pc.in
${CMAKE_CURRENT_BINARY_DIR}/libmariadb.pc @ONLY)
+if(0)
ADD_EXECUTABLE(mariadb_config ${CMAKE_CURRENT_BINARY_DIR}/mariadb_config.c)
IF(CMAKE_SYSTEM_NAME MATCHES AIX)
@@ -61,6 +71,7 @@ ENDIF()
INSTALL(TARGETS mariadb_config
DESTINATION "${INSTALL_BINDIR}"
COMPONENT Development)
+endif()
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/libmariadb.pc
DESTINATION "${INSTALL_PCDIR}"
diff --git a/mariadb_config/libmariadb.pc.in b/mariadb_config/libmariadb.pc.in
index 968181a..3f0410d 100644
--- a/mariadb_config/libmariadb.pc.in
+++ b/mariadb_config/libmariadb.pc.in
@@ -16,5 +16,6 @@ Description: MariaDB Connector/C dynamic library
Cflags: -I${includedir}
Libs: -L${libdir} -lmariadb
Libs.private: @extra_dynamic_LDFLAGS@
+Requires.private: @REQUIRES_PRIVATE@

View File

@ -9,27 +9,36 @@ endif()
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO mariadb-corporation/mariadb-connector-c
REF 5e94e7c27ffad7e76665b1333a67975316b9c3c2 # v3.3.1
SHA512 0f740f88f64037990bf9d4593574b147ee02adb1fbbeb03c0dec745f0ee27d7cf03417dd09546ab70e16b4465622b8567864dbb243de0a3a7ffaebe313f7c231
HEAD_REF 3.3
REF v${VERSION}
SHA512 396ce2a36937d49ec96eb239312118c736f46383d2906b7142d9695e795f310af28255d8827cc98ad76ae4e6d5a22faf1188b7dd286791e3c85f22c96d0114b3
HEAD_REF 3.4
PATCHES
md.patch
disable-test-build.patch
fix-InstallPath.patch
fix-iconv.patch
pkgconfig.patch
fix-openssl.patch
fix-CMakeLists.patch
zstd.patch
compiler-flags.diff
dependencies.diff
disable-mariadb_config.diff
library-linkage.diff
cmake-export.diff
no-abs-path.diff
ushort-check.diff
)
file(REMOVE_RECURSE
"${SOURCE_PATH}/cmake/FindIconv.cmake"
"${SOURCE_PATH}/external/zlib"
)
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
iconv WITH_ICONV
mariadbclient VCPKG_MARIADBCLIENT
zstd WITH_ZSTD
)
string(TOUPPER "${VCPKG_LIBRARY_LINKAGE}" plugin_type)
set(zstd_plugin_type OFF)
if("zstd" IN_LIST FEATURES)
set(zstd_plugin_type ${plugin_type})
endif()
if("openssl" IN_LIST FEATURES)
set(WITH_SSL OPENSSL)
elseif("schannel" IN_LIST FEATURES)
@ -42,33 +51,53 @@ vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
${FEATURE_OPTIONS}
-DINSTALL_INCLUDEDIR=include/mysql # legacy port decisiong
-DCMAKE_POLICY_DEFAULT_CMP0153=OLD
-DINSTALL_INCLUDEDIR=include/mysql # legacy port decision
-DINSTALL_LIBDIR=lib
-DINSTALL_PLUGINDIR=plugins/${PORT}
-DWITH_UNIT_TESTS=OFF
-DWITH_CURL=OFF
-DWITH_EXTERNAL_ZLIB=ON
-DWITH_SSL=${WITH_SSL}
-DREMOTEIO_PLUGIN_TYPE=OFF
-DWITH_UNIT_TESTS=OFF
# plugins/auth
-DCLIENT_PLUGIN_AUTH_GSSAPI_CLIENT=OFF
-DCLIENT_PLUGIN_CACHING_SHA2_PASSWORD=${plugin_type}
-DCLIENT_PLUGIN_CLIENT_ED25519=DYNAMIC # want ${plugin_type}, but STATIC fails
-DCLIENT_PLUGIN_DIALOG=${plugin_type}
-DCLIENT_PLUGIN_PARSEC=OFF
-DCLIENT_PLUGIN_MYSQL_CLEAR_PASSWORD=${plugin_type}
-DCLIENT_PLUGIN_MYSQL_OLD_PASSWORD=OFF
-DCLIENT_PLUGIN_SHA256_PASSWORD=${plugin_type}
# plugins/compress
-DCLIENT_PLUGIN_ZSTD=${zstd_plugin_type}
# don't add system include dirs
-DAUTH_GSSAPI_PLUGIN_TYPE=OFF
-DWITH_ZSTD=${WITH_ZSTD}
-DREMOTEIO_PLUGIN_TYPE=OFF
MAYBE_UNUSED_VARIABLES
AUTH_GSSAPI_PLUGIN_TYPE
CLIENT_PLUGIN_AUTH_GSSAPI_CLIENT
CLIENT_PLUGIN_PARSEC
CLIENT_PLUGIN_ZSTD
)
vcpkg_cmake_install()
vcpkg_cmake_config_fixup(PACKAGE_NAME unofficial-libmariadb)
if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/libmariadb.pc" " -lmariadb" " -llibmariadb")
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libmariadb.pc" " -lmariadb" " -llibmariadb")
endif()
endif()
vcpkg_fixup_pkgconfig()
set(link_lib " -lmariadb")
if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
set(link_lib " -llibmariadb")
endif()
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
string(APPEND link_lib "client")
endif()
if(NOT link_lib STREQUAL " -lmariadb")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/libmariadb.pc" " -lmariadb" "${link_lib}")
if(NOT VCPKG_BUILD_TYPE)
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libmariadb.pc" " -lmariadb" "${link_lib}")
endif()
endif()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(INSTALL "${SOURCE_PATH}/COPYING.LIB" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING.LIB")

View File

@ -0,0 +1,13 @@
diff --git a/cmake/check_types.cmake b/cmake/check_types.cmake
index 3ecedb1..3aaba29 100644
--- a/cmake/check_types.cmake
+++ b/cmake/check_types.cmake
@@ -21,7 +21,7 @@ SET(CMAKE_EXTRA_INCLUDE_FILES stdio.h)
CHECK_TYPE_SIZE(size_t SIZEOF_SIZE_T)
SET(CMAKE_EXTRA_INCLUDE_FILES sys/types.h)
CHECK_TYPE_SIZE(uint SIZEOF_UINT)
-CHECK_TYPE_SIZE(uint SIZEOF_USHORT)
+CHECK_TYPE_SIZE(ushort SIZEOF_USHORT)
CHECK_TYPE_SIZE(ulong SIZEOF_ULONG)
CHECK_TYPE_SIZE(int8 SIZEOF_INT8)
CHECK_TYPE_SIZE(uint8 SIZEOF_UINT8)

View File

@ -1,12 +1,19 @@
{
"name": "libmariadb",
"version-semver": "3.3.1",
"port-version": 4,
"version-semver": "3.4.1",
"description": "MariaDB Connector/C is used to connect C/C++ applications to MariaDB and MySQL databases",
"homepage": "https://github.com/MariaDB/mariadb-connector-c",
"homepage": "https://github.com/mariadb-corporation/mariadb-connector-c",
"license": "LGPL-2.1-or-later",
"supports": "!uwp & !xbox",
"dependencies": [
{
"name": "libmariadb",
"default-features": false,
"features": [
"iconv"
],
"platform": "windows"
},
{
"name": "vcpkg-cmake",
"host": true
@ -24,12 +31,12 @@
"iconv": {
"description": "Enables character set conversion",
"dependencies": [
"libiconv"
{
"name": "libiconv",
"platform": "!windows"
}
]
},
"mariadbclient": {
"description": "Build the static mariadbclient library"
},
"openssl": {
"description": "SSL support (OpenSSL)",
"dependencies": [
@ -38,7 +45,7 @@
},
"schannel": {
"description": "SSL support (Secure Channel)",
"supports": "windows | mingw"
"supports": "windows"
},
"ssl": {
"description": "Default SSL backend",
@ -49,7 +56,7 @@
"features": [
"schannel"
],
"platform": "windows | mingw"
"platform": "windows"
},
{
"name": "libmariadb",
@ -57,13 +64,10 @@
"features": [
"openssl"
],
"platform": "!windows & !mingw"
"platform": "!windows"
}
]
},
"zlib": {
"description": "Obsolete. zlib is always used. This feature is left for compatibility."
},
"zstd": {
"description": "Build zstd compression plugin.",
"dependencies": [

View File

@ -1,13 +0,0 @@
diff --git a/plugins/compress/CMakeLists.txt b/plugins/compress/CMakeLists.txt
index f6dab85..0bbdf47 100644
--- a/plugins/compress/CMakeLists.txt
+++ b/plugins/compress/CMakeLists.txt
@@ -12,7 +12,7 @@ REGISTER_PLUGIN(TARGET zlib
SOURCES ${COMPRESS_PLUGIN_DIR}/c_zlib.c)
#zstd compression
-IF(${ZSTD_FOUND})
+IF(${WITH_ZSTD})
INCLUDE_DIRECTORIES(${ZSTD_INCLUDE_DIRS})
REGISTER_PLUGIN(TARGET zstd
TYPE MARIADB_CLIENT_COMPRESSION_PLUGIN

View File

@ -570,10 +570,7 @@ liblo:arm64-android=fail
liblo:x64-android=fail
liblo:x64-uwp=fail
# libmariadb conflicts with libmysql
libmariadb:arm-neon-android=fail
libmariadb:arm64-android=fail
libmariadb:arm64-windows = skip
libmariadb:x64-android=fail
libmariadb:x64-linux = skip
libmariadb:x64-osx = skip
libmariadb:arm64-osx = skip

View File

@ -23,7 +23,7 @@
"features": [
"mariadb"
],
"platform": "x86 & windows"
"platform": "android | (x86 & windows)"
},
{
"name": "sqlpp11",

View File

@ -4741,8 +4741,8 @@
"port-version": 3
},
"libmariadb": {
"baseline": "3.3.1",
"port-version": 4
"baseline": "3.4.1",
"port-version": 0
},
"libmaxminddb": {
"baseline": "1.9.1",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "052df42a61bbe15831197f9adbafcf4da7f6fcc6",
"version-semver": "3.4.1",
"port-version": 0
},
{
"git-tree": "e0c869b45c183f7486a6da4785259a949bd18b25",
"version-semver": "3.3.1",