From 78de513e83492842e6554541316f07780c38fb24 Mon Sep 17 00:00:00 2001 From: Kai Pastor Date: Tue, 6 Aug 2024 09:35:47 +0200 Subject: [PATCH] [vcpkg baseline][mongo-c-driver] Fix utf8proc dependency export, cleanup (#40249) --- .../disable-dynamic-when-static.patch | 16 ++++ ports/mongo-c-driver/fix-dependencies.patch | 80 +++++++++++-------- .../mongo-c-driver/libmongoc-1.0-config.cmake | 5 -- ports/mongo-c-driver/portfile.cmake | 15 ++-- ports/mongo-c-driver/usage | 4 +- ports/mongo-c-driver/vcpkg.json | 2 +- versions/baseline.json | 2 +- versions/m-/mongo-c-driver.json | 5 ++ 8 files changed, 81 insertions(+), 48 deletions(-) delete mode 100644 ports/mongo-c-driver/libmongoc-1.0-config.cmake diff --git a/ports/mongo-c-driver/disable-dynamic-when-static.patch b/ports/mongo-c-driver/disable-dynamic-when-static.patch index 2c73636b36..070e8bea49 100644 --- a/ports/mongo-c-driver/disable-dynamic-when-static.patch +++ b/ports/mongo-c-driver/disable-dynamic-when-static.patch @@ -1,3 +1,19 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 1fe4c76..96be699 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -354,11 +354,9 @@ if (USE_SYSTEM_LIBBSON) + + set (USING_SYSTEM_BSON TRUE) + if (NOT TARGET mongo::bson_shared) +- message (FATAL_ERROR "System libbson built without shared library target") + endif () + set (BSON_LIBRARIES mongo::bson_shared) + if (NOT TARGET mongo::bson_static) +- message (FATAL_ERROR "System libbson built without static library target") + endif () + set (BSON_STATIC_LIBRARIES mongo::bson_static) + endif () diff --git a/src/libmongoc/CMakeLists.txt b/src/libmongoc/CMakeLists.txt index 74c541f..737e566 100644 --- a/src/libmongoc/CMakeLists.txt diff --git a/ports/mongo-c-driver/fix-dependencies.patch b/ports/mongo-c-driver/fix-dependencies.patch index 2cb09d5913..1e4c348bf8 100644 --- a/ports/mongo-c-driver/fix-dependencies.patch +++ b/ports/mongo-c-driver/fix-dependencies.patch @@ -1,33 +1,3 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 1fe4c76..96be699 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -347,11 +347,9 @@ if (USE_SYSTEM_LIBBSON) - - set (USING_SYSTEM_BSON TRUE) - if (NOT TARGET mongo::bson_shared) -- message (FATAL_ERROR "System libbson built without shared library target") - endif () - set (BSON_LIBRARIES mongo::bson_shared) - if (NOT TARGET mongo::bson_static) -- message (FATAL_ERROR "System libbson built without static library target") - endif () - set (BSON_STATIC_LIBRARIES mongo::bson_static) - endif () -diff --git a/build/cmake/libmongoc-1.0-config.cmake.in b/build/cmake/libmongoc-1.0-config.cmake.in -index a068408..d0aeadd 100644 ---- a/build/cmake/libmongoc-1.0-config.cmake.in -+++ b/build/cmake/libmongoc-1.0-config.cmake.in -@@ -24,6 +24,9 @@ set (MONGOC_VERSION_FULL @libmongoc_VERSION_FULL@) - - include(CMakeFindDependencyMacro) - find_dependency (mongoc-1.0) -+if("@ENABLE_SNAPPY@" STREQUAL "ON") -+ find_dependency(Snappy CONFIG) -+endif() - - set(MONGOC_LIBRARY mongo::mongoc_shared) - set(MONGOC_LIBRARIES mongo::mongoc_shared) diff --git a/build/cmake/libmongoc-static-1.0-config.cmake.in b/build/cmake/libmongoc-static-1.0-config.cmake.in index bec3163..a32d5f3 100644 --- a/build/cmake/libmongoc-static-1.0-config.cmake.in @@ -43,7 +13,7 @@ index bec3163..a32d5f3 100644 set(MONGOC_STATIC_LIBRARY mongo::mongoc_static) set(MONGOC_STATIC_LIBRARIES mongo::mongoc_static) diff --git a/src/libmongoc/CMakeLists.txt b/src/libmongoc/CMakeLists.txt -index 5f553c5..4675313 100644 +index 0a18f5a..5346a9d 100644 --- a/src/libmongoc/CMakeLists.txt +++ b/src/libmongoc/CMakeLists.txt @@ -50,7 +50,7 @@ endif () @@ -69,16 +39,60 @@ index 5f553c5..4675313 100644 endif () mongo_bool01 (MONGOC_ENABLE_SHM_COUNTERS ENABLE_SHM_COUNTERS) +@@ -759,7 +759,7 @@ set (STATIC_LIBRARIES + ) + + # utf8proc configuration +-find_package(Utf8Proc REQUIRED) ++find_package(unofficial-utf8proc CONFIG REQUIRED) + set(UTF8PROC_INCLUDE_DIRS, "") + if (USE_BUNDLED_UTF8PROC) + set ( +@@ -955,7 +955,7 @@ if (MONGOC_ENABLE_STATIC_BUILD) + set_target_properties (mongoc_static PROPERTIES + VERSION 0.0.0 + OUTPUT_NAME "${MONGOC_OUTPUT_BASENAME}-static-${MONGOC_API_VERSION}" +- pkg_config_REQUIRES "libbson-static-1.0" ++ pkg_config_REQUIRES "libbson-static-1.0 libutf8proc" + ) + if(MONGOC_ENABLE_STATIC_INSTALL) + mongo_generate_pkg_config (mongoc_static FILENAME libmongoc-static-${MONGOC_API_VERSION}.pc INSTALL) diff --git a/src/libmongoc/src/mongoc-config.cmake b/src/libmongoc/src/mongoc-config.cmake -index 31e6cbc..365fb5b 100644 +index 31e6cbc..cdbb756 100644 --- a/src/libmongoc/src/mongoc-config.cmake +++ b/src/libmongoc/src/mongoc-config.cmake @@ -1,5 +1,8 @@ include(CMakeFindDependencyMacro) find_dependency(bson-1.0 @libmongoc_VERSION@) -+if("@ENABLE_SNAPPY@" STREQUAL "ON") ++if("@ENABLE_SNAPPY@") + find_dependency(Snappy CONFIG) +endif() # If we need to import a TLS package for our imported targets, do that now: set(MONGOC_TLS_BACKEND [[@TLS_BACKEND@]]) +@@ -13,8 +16,6 @@ if(_tls_package) + set(CMAKE_MODULE_PATH "${_prev_path}") + endif() + +-include("${CMAKE_CURRENT_LIST_DIR}/mongoc-targets.cmake") +- + unset(_required) + unset(_quiet) + if(${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED) +@@ -29,9 +30,8 @@ if(NOT _mongoc_built_with_bundled_utf8proc AND NOT TARGET PkgConfig::PC_UTF8PROC + # libmongoc was compiled against an external utf8proc and links against a + # FindPkgConfig-generated IMPORTED target. Find that package and generate that + # imported target here: +- find_dependency(PkgConfig) +- pkg_check_modules(PC_UTF8PROC ${_required} ${_quiet} libutf8proc IMPORTED_TARGET GLOBAL) + endif() ++find_dependency(unofficial-utf8proc CONFIG) + + # Find dependencies for SASL + set(_sasl_backend [[@SASL_BACKEND@]]) +@@ -43,3 +43,5 @@ if(_sasl_backend STREQUAL "Cyrus") + find_dependency(SASL2 2.0) + set(CMAKE_MODULE_PATH "${_prev_path}") + endif() ++ ++include("${CMAKE_CURRENT_LIST_DIR}/mongoc-targets.cmake") diff --git a/ports/mongo-c-driver/libmongoc-1.0-config.cmake b/ports/mongo-c-driver/libmongoc-1.0-config.cmake deleted file mode 100644 index 1126bf417a..0000000000 --- a/ports/mongo-c-driver/libmongoc-1.0-config.cmake +++ /dev/null @@ -1,5 +0,0 @@ -include(CMakeFindDependencyMacro) -find_dependency(libmongoc-static-1.0 ${${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION} CONFIG) -set(MONGOC_DEFINITIONS "${MONGOC_STATIC_DEFINITIONS}") -set(MONGOC_INCLUDE_DIRS "${MONGOC_STATIC_INCLUDE_DIRS}") -set(MONGOC_LIBRARIES "${MONGOC_STATIC_LIBRARIES}") diff --git a/ports/mongo-c-driver/portfile.cmake b/ports/mongo-c-driver/portfile.cmake index 0d4eb9f8d9..ad4830fc0c 100644 --- a/ports/mongo-c-driver/portfile.cmake +++ b/ports/mongo-c-driver/portfile.cmake @@ -12,6 +12,9 @@ vcpkg_from_github( fix-mingw.patch ) file(WRITE "${SOURCE_PATH}/VERSION_CURRENT" "${VERSION}") +file(TOUCH "${SOURCE_PATH}/src/utf8proc-editable") +file(GLOB vendored_libs "${SOURCE_PATH}/src/utf8proc-*" "${SOURCE_PATH}/src/zlib-*/*.h") +file(REMOVE_RECURSE ${vendored_libs}) # Cannot use string(COMPARE EQUAL ...) set(ENABLE_STATIC OFF) @@ -74,16 +77,16 @@ if("snappy" IN_LIST FEATURES AND VCPKG_LIBRARY_LINKAGE STREQUAL "static") endif() vcpkg_fixup_pkgconfig() -vcpkg_cmake_config_fixup(PACKAGE_NAME mongoc-1.0 CONFIG_PATH "lib/cmake/mongoc-1.0" DO_NOT_DELETE_PARENT_CONFIG_PATH) +# deprecated +vcpkg_cmake_config_fixup(PACKAGE_NAME libmongoc-1.0 CONFIG_PATH "lib/cmake/libmongoc-1.0" DO_NOT_DELETE_PARENT_CONFIG_PATH) if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") + vcpkg_cmake_config_fixup(PACKAGE_NAME libmongoc-static-1.0 CONFIG_PATH "lib/cmake/libmongoc-static-1.0" DO_NOT_DELETE_PARENT_CONFIG_PATH) vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/mongoc/mongoc-macros.h" "#define MONGOC_MACROS_H" "#define MONGOC_MACROS_H\n#ifndef MONGOC_STATIC\n#define MONGOC_STATIC\n#endif") - vcpkg_cmake_config_fixup(PACKAGE_NAME libmongoc-static-1.0 CONFIG_PATH "lib/cmake/libmongoc-static-1.0") - file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/share/libmongoc-1.0") - file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/libmongoc-1.0-config.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/libmongoc-1.0") -else() - vcpkg_cmake_config_fixup(PACKAGE_NAME libmongoc-1.0 CONFIG_PATH "lib/cmake/libmongoc-1.0") + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/libmongoc-1.0/libmongoc-1.0-config.cmake" "mongoc_shared" "mongoc_static") endif() +# recommended +vcpkg_cmake_config_fixup(PACKAGE_NAME mongoc-1.0 CONFIG_PATH "lib/cmake/mongoc-1.0") file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include" diff --git a/ports/mongo-c-driver/usage b/ports/mongo-c-driver/usage index 1333196828..ae5fca480f 100644 --- a/ports/mongo-c-driver/usage +++ b/ports/mongo-c-driver/usage @@ -1,4 +1,4 @@ mongo-c-driver provides CMake targets: - find_package(mongoc-1.0 CONFIG REQUIRED) - target_link_libraries(main PRIVATE $,mongo::mongoc_shared,mongo::mongoc_static>) + find_package(mongoc-1.0 CONFIG REQUIRED) + target_link_libraries(main PRIVATE $,mongo::mongoc_shared,mongo::mongoc_static>) diff --git a/ports/mongo-c-driver/vcpkg.json b/ports/mongo-c-driver/vcpkg.json index 863d80d816..1fc7550e77 100644 --- a/ports/mongo-c-driver/vcpkg.json +++ b/ports/mongo-c-driver/vcpkg.json @@ -1,7 +1,7 @@ { "name": "mongo-c-driver", "version": "1.27.4", - "port-version": 1, + "port-version": 2, "description": "Client library written in C for MongoDB.", "homepage": "https://github.com/mongodb/mongo-c-driver", "license": null, diff --git a/versions/baseline.json b/versions/baseline.json index e496dc02ac..0e8dbb7865 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -5906,7 +5906,7 @@ }, "mongo-c-driver": { "baseline": "1.27.4", - "port-version": 1 + "port-version": 2 }, "mongo-cxx-driver": { "baseline": "3.10.2", diff --git a/versions/m-/mongo-c-driver.json b/versions/m-/mongo-c-driver.json index d0a1024934..96877a9925 100644 --- a/versions/m-/mongo-c-driver.json +++ b/versions/m-/mongo-c-driver.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "5feb5bb8f584c01633e780733ffa72f03066a45e", + "version": "1.27.4", + "port-version": 2 + }, { "git-tree": "e0d49789eb2474ec5c4a4bf3b1d54f16805e997d", "version": "1.27.4",