Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[libmariadb] Update #21359

Merged
merged 20 commits into from
Nov 17, 2021
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions ports/libmariadb/export-cmake-targets.patch
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ index c109a20..e1fa3f1 100644
--- a/libmariadb/CMakeLists.txt
+++ b/libmariadb/CMakeLists.txt
@@ -405,6 +405,7 @@ ELSE()
TARGET_LINK_LIBRARIES(libmariadb LINK_PRIVATE mariadbclient)
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})

@@ -453,13 +454,25 @@ ENDIF()
@@ -453,13 +454,30 @@ ENDIF()

INSTALL(TARGETS mariadbclient
COMPONENT Development
Expand All @@ -23,12 +23,17 @@ index c109a20..e1fa3f1 100644
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)

+install(EXPORT unofficial-libmariadb-targets DESTINATION share/unofficial-libmariadb)
+install(EXPORT unofficial-libmariadb-targets
+ NAMESPACE unofficial::
+ DESTINATION share/unofficial-libmariadb
+)
+
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/unofficial-libmariadb-config.cmake"
+[[include(CMakeFindDependencyMacro)
+find_dependency(ZLIB)
+find_dependency(OpenSSL)
+if("]] "${WITH_SSL}" [[" STREQUAL "OPENSSL")
+ find_dependency(OpenSSL)
+endif()
JackBoosY marked this conversation as resolved.
Show resolved Hide resolved
+include("${CMAKE_CURRENT_LIST_DIR}/unofficial-libmariadb-targets.cmake")
+]])
+
Expand Down
6 changes: 3 additions & 3 deletions ports/libmariadb/fix-InstallPath.patch
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ index bcfd4de..c109a20 100644
+ ADD_LIBRARY(libmariadb ${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} mariadbclient.def)
+ ADD_LIBRARY(libmariadb ${libmariadb_RC} mariadbclient.def)
TARGET_LINK_LIBRARIES(libmariadb LINK_PRIVATE mariadbclient)
- 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()

@@ -453,13 +453,15 @@ ENDIF()

INSTALL(TARGETS mariadbclient
Expand Down
13 changes: 0 additions & 13 deletions ports/libmariadb/fix-build-error-with-cmake3.20.patch

This file was deleted.

16 changes: 16 additions & 0 deletions ports/libmariadb/no-extra-static-lib.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
diff --git a/libmariadb/CMakeLists.txt b/libmariadb/CMakeLists.txt
index 39fa709..a726a6d 100644
--- a/libmariadb/CMakeLists.txt
+++ b/libmariadb/CMakeLists.txt
@@ -455,10 +455,7 @@ IF(NOT WIN32)
SET_TARGET_PROPERTIES(mariadbclient PROPERTIES OUTPUT_NAME "${LIBMARIADB_STATIC_NAME}")
ENDIF()

-INSTALL(TARGETS mariadbclient
- COMPONENT Development
- EXPORT unofficial-libmariadb-targets
- LIBRARY DESTINATION lib)
+SET_TARGET_PROPERTIES(mariadbclient PROPERTIES EXCLUDE_FROM_ALL 1) # target mariadb follows vcpkg linkage
INSTALL(TARGETS libmariadb
COMPONENT SharedLibraries
EXPORT unofficial-libmariadb-targets
60 changes: 60 additions & 0 deletions ports/libmariadb/pkgconfig.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0be0fb1..33565f5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -393,7 +393,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 70e619b..7a22fa1 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 "bin"
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@


76 changes: 35 additions & 41 deletions ports/libmariadb/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,20 @@ if (EXISTS "${CURRENT_INSTALLED_DIR}/share/libmysql")
message(FATAL_ERROR "FATAL ERROR: libmysql and libmariadb are incompatible.")
endif()

string(REGEX MATCHALL "openssl|schannel" ssl_backends ${FEATURES})
if(ssl_backends MATCHES ";")
JackBoosY marked this conversation as resolved.
Show resolved Hide resolved
message(FATAL_ERROR "Only one SSL backend must be selected.")
endif()

if("schannel" IN_LIST FEATURES AND NOT VCPKG_TARGET_IS_WINDOWS)
message(FATAL_ERROR "Feature schannel not supported on non-Windows platforms.")
endif()

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO mariadb-corporation/mariadb-connector-c
REF 7d304d26c787a3f0430624db977b615aba56e4bb # v3.1.12
SHA512 16e74b2cbe401492ef294e2442a00ef1739089152a88d9263ca4d17b65260554b330630e9405813fd9089fa445d676e3b6aa91ac94128ad6b0a299e8b7edc1b3
REF b2bb1b213c79169b7c994a99f21f47f11be465d4 # v3.1.15
SHA512 51ebd2e9fd505eebc7691c60fe0b86cfc5368f8b370fba6c3ec8f5514319ef1e0de4910ad5e093cd7d5e5c7782120e22e8c85c94af9389fa4e240cedf012d755
HEAD_REF 3.1
PATCHES
arm64.patch
Expand All @@ -15,68 +24,53 @@ vcpkg_from_github(
fix-InstallPath.patch
fix-iconv.patch
export-cmake-targets.patch
fix-build-error-with-cmake3.20.patch #This can be removed in next release, which has been merged to upstream.
pkgconfig.patch
no-extra-static-lib.patch
)

vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
zlib WITH_EXTERNAL_ZLIB
iconv WITH_ICONV
)

if("openssl" IN_LIST FEATURES)
set(WITH_SSL OPENSSL)
elseif("schannel" IN_LIST FEATURES)
set(WITH_SSL ON)
else()
set(WITH_SSL OFF)
endif()

vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
${FEATURE_OPTIONS}
-DINSTALL_PLUGINDIR=plugin/${PORT}
-DINSTALL_INCLUDEDIR=include/mysql # legacy port decisiong
-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
-DAUTH_GSSAPI_PLUGIN_TYPE=OFF
MAYBE_UNUSED_VARIABLES
AUTH_GSSAPI_PLUGIN_TYPE
)

vcpkg_install_cmake()

vcpkg_fixup_cmake_targets(CONFIG_PATH share/unofficial-libmariadb TARGET_PATH share/unofficial-libmariadb)

vcpkg_fixup_pkgconfig()

if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
# remove debug header
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
endif()
vcpkg_cmake_install()

if(VCPKG_BUILD_TYPE STREQUAL "debug")
# move headers
file(RENAME
${CURRENT_PACKAGES_DIR}/debug/include
${CURRENT_PACKAGES_DIR}/include)
endif()
vcpkg_cmake_config_fixup(PACKAGE_NAME unofficial-libmariadb)

if (NOT VCPKG_TARGET_IS_WINDOWS)
vcpkg_copy_tools(TOOL_NAMES mariadb_config AUTO_CLEAN)
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()

# remove plugin folder
file(REMOVE_RECURSE
${CURRENT_PACKAGES_DIR}/lib/mariadb
${CURRENT_PACKAGES_DIR}/debug/lib/mariadb)

# copy & remove header files
file(REMOVE
${CURRENT_PACKAGES_DIR}/include/mariadb/my_config.h.in
${CURRENT_PACKAGES_DIR}/include/mariadb/mysql_version.h.in
${CURRENT_PACKAGES_DIR}/include/mariadb/CMakeLists.txt
${CURRENT_PACKAGES_DIR}/include/mariadb/Makefile.am)
file(RENAME
${CURRENT_PACKAGES_DIR}/include/mariadb
${CURRENT_PACKAGES_DIR}/include/mysql)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")

# copy license file
file(INSTALL ${SOURCE_PATH}/COPYING.LIB DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
file(INSTALL "${SOURCE_PATH}/COPYING.LIB" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
47 changes: 39 additions & 8 deletions ports/libmariadb/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
{
"name": "libmariadb",
"version-semver": "3.1.12",
"port-version": 2,
"version-semver": "3.1.15",
"description": "MariaDB Connector/C is used to connect C/C++ applications to MariaDB and MySQL databases",
"homepage": "https://github.com/MariaDB/mariadb-connector-c",
"default-features": [
"openssl",
"supports": "!uwp",
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
},
"zlib"
],
"default-features": [
"ssl"
],
"features": {
"iconv": {
"description": "Enables character set conversion",
Expand All @@ -16,16 +26,37 @@
]
},
"openssl": {
"description": "Enable SSL support",
"description": "SSL support (OpenSSL)",
"dependencies": [
"openssl"
]
},
"zlib": {
"description": "Use internal zlib",
"schannel": {
"description": "SSL support (Secure Channel)"
},
"ssl": {
"description": "Default SSL backend",
"dependencies": [
"zlib"
{
"name": "libmariadb",
"default-features": false,
"features": [
"schannel"
],
"platform": "windows | mingw"
},
{
"name": "libmariadb",
"default-features": false,
"features": [
"openssl"
],
"platform": "!windows & !mingw"
}
]
},
"zlib": {
"description": "Obsolete. zlib is always used. This feature is left for compatibility."
}
}
}
2 changes: 1 addition & 1 deletion ports/poco/fix_dependency.patch
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ index 4e05272..44dd7cb 100644
+ find_package(libmysql)
+ if (NOT libmysql_FOUND)
+ find_package(unofficial-libmariadb CONFIG REQUIRED)
+ set(MYSQL_LIBRARIES libmariadb)
+ set(MYSQL_LIBRARIES unofficial::libmariadb)
+ endif()
endif()

Expand Down
1 change: 1 addition & 0 deletions ports/poco/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "poco",
"version-semver": "1.11.0",
"port-version": 1,
"description": "Modern, powerful open source C++ class libraries for building network and internet-based applications that run on desktop, server, mobile and embedded systems.",
"homepage": "https://github.com/pocoproject/poco",
"supports": "!uwp",
Expand Down
1 change: 0 additions & 1 deletion scripts/ci.baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,6 @@ libmariadb:x64-uwp = skip
libmariadb:x64-windows = skip
libmariadb:x64-windows-static = skip
libmariadb:x64-windows-static-md=skip
libmariadb:x86-windows = skip
# libmesh installs tons of problematic files that conflict with other ports (boost, eigen, etc)
libmesh:arm64-windows=skip
libmesh:arm-uwp=skip
Expand Down
6 changes: 3 additions & 3 deletions versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -3609,8 +3609,8 @@
"port-version": 1
},
"libmariadb": {
"baseline": "3.1.12",
"port-version": 2
"baseline": "3.1.15",
"port-version": 0
},
"libmaxminddb": {
"baseline": "1.4.3",
Expand Down Expand Up @@ -5278,7 +5278,7 @@
},
"poco": {
"baseline": "1.11.0",
"port-version": 0
"port-version": 1
},
"podofo": {
"baseline": "0.9.7",
Expand Down
5 changes: 5 additions & 0 deletions versions/l-/libmariadb.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "e339ae3a5164d61cfc18a4075744903ebebdca51",
"version-semver": "3.1.15",
"port-version": 0
},
{
"git-tree": "64479ab60db54486912b858f760af83dd2474f1c",
"version-semver": "3.1.12",
Expand Down
5 changes: 5 additions & 0 deletions versions/p-/poco.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "83279266114bf6eab34a86e6009313e10f3aa11e",
"version-semver": "1.11.0",
"port-version": 1
},
{
"git-tree": "e8f4d5c1548d23526e05b069ee626d7d7f9a4399",
"version-semver": "1.11.0",
Expand Down