diff options
Diffstat (limited to 'vcpkg/ports/mongo-c-driver')
| -rw-r--r-- | vcpkg/ports/mongo-c-driver/disable-dynamic-when-static.patch | 65 | ||||
| -rw-r--r-- | vcpkg/ports/mongo-c-driver/fix-dependencies.patch | 98 | ||||
| -rw-r--r-- | vcpkg/ports/mongo-c-driver/fix-include-directory.patch | 13 | ||||
| -rw-r--r-- | vcpkg/ports/mongo-c-driver/fix-mingw.patch | 63 | ||||
| -rw-r--r-- | vcpkg/ports/mongo-c-driver/portfile.cmake | 106 | ||||
| -rw-r--r-- | vcpkg/ports/mongo-c-driver/remove_abs_patch.cmake | 13 | ||||
| -rw-r--r-- | vcpkg/ports/mongo-c-driver/usage | 4 | ||||
| -rw-r--r-- | vcpkg/ports/mongo-c-driver/vcpkg.json | 48 |
8 files changed, 410 insertions, 0 deletions
diff --git a/vcpkg/ports/mongo-c-driver/disable-dynamic-when-static.patch b/vcpkg/ports/mongo-c-driver/disable-dynamic-when-static.patch new file mode 100644 index 0000000..9ac0206 --- /dev/null +++ b/vcpkg/ports/mongo-c-driver/disable-dynamic-when-static.patch @@ -0,0 +1,65 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 3a40f52..d080479 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -358,11 +358,11 @@ 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 fcab819..be0bfb2 100644 +--- a/src/libmongoc/CMakeLists.txt ++++ b/src/libmongoc/CMakeLists.txt +@@ -889,7 +889,7 @@ set ( + "${mongo-c-driver_SOURCE_DIR}/src/uthash" + ) + +-if (ENABLE_SHARED) ++if (NOT MONGOC_ENABLE_STATIC_BUILD) + add_library (mongoc_shared SHARED ${SOURCES} ${HEADERS} ${HEADERS_FORWARDING}) + if(WIN32) + # Add resource-definition script for Windows shared library (.dll). +@@ -966,7 +966,7 @@ if (ENABLE_SHARED) + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") + endif () # ENABLE_SHM_COUNTERS + +-endif () # ENABLE_SHARED ++endif () # NOT MONGOC_ENABLE_STATIC_BUILD + + if (MONGOC_ENABLE_STATIC_BUILD) + add_library (mongoc_static STATIC ${SOURCES} ${HEADERS} ${HEADERS_FORWARDING}) +@@ -1364,7 +1364,7 @@ if (MONGOC_ENABLE_STATIC_INSTALL) + list (APPEND TARGETS_TO_INSTALL mongoc_static) + endif () + +-if (ENABLE_SHARED) ++if (NOT MONGOC_ENABLE_STATIC_BUILD) + list (APPEND TARGETS_TO_INSTALL mongoc_shared) + endif () + +@@ -1419,6 +1419,7 @@ endif() + set_property(TARGET ${TARGETS_TO_INSTALL} APPEND PROPERTY pkg_config_INCLUDE_DIRECTORIES "${MONGOC_HEADER_INSTALL_DIR}") + + # Deprecated alias for libmongoc-1.0.pc, see CDRIVER-2086. ++if (NOT MONGOC_ENABLE_STATIC_BUILD) + if (MONGOC_ENABLE_SSL) + configure_file ( + ${CMAKE_CURRENT_SOURCE_DIR}/src/libmongoc-ssl-1.0.pc.in +@@ -1429,6 +1430,7 @@ if (MONGOC_ENABLE_SSL) + DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig + ) + endif () ++endif () + + include (CMakePackageConfigHelpers) + diff --git a/vcpkg/ports/mongo-c-driver/fix-dependencies.patch b/vcpkg/ports/mongo-c-driver/fix-dependencies.patch new file mode 100644 index 0000000..1e4c348 --- /dev/null +++ b/vcpkg/ports/mongo-c-driver/fix-dependencies.patch @@ -0,0 +1,98 @@ +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 ++++ b/build/cmake/libmongoc-static-1.0-config.cmake.in +@@ -24,6 +24,9 @@ set (MONGOC_STATIC_VERSION_FULL @libmongoc_VERSION_FULL@) + + include(CMakeFindDependencyMacro) + find_dependency (mongoc-1.0) ++if("@ENABLE_SNAPPY@" STREQUAL "ON") ++ find_dependency(Snappy CONFIG) ++endif() + + 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 0a18f5a..5346a9d 100644 +--- a/src/libmongoc/CMakeLists.txt ++++ b/src/libmongoc/CMakeLists.txt +@@ -50,7 +50,7 @@ endif () + set (ZLIB_INCLUDE_DIRS "") + if (ENABLE_ZLIB MATCHES "SYSTEM|AUTO") + message (STATUS "Searching for zlib CMake packages") +- include (FindZLIB) ++ find_package(ZLIB REQUIRED) + if (ZLIB_FOUND) + message (STATUS " zlib found version \"${ZLIB_VERSION_STRING}\"") + message (STATUS " zlib include path \"${ZLIB_INCLUDE_DIRS}\"") +@@ -468,10 +468,10 @@ else () + endif () + + # Sets SNAPPY_LIBRARIES and SNAPPY_INCLUDE_DIRS. +-include (FindSnappy) +-if (SNAPPY_INCLUDE_DIRS) ++if(ENABLE_SNAPPY) ++ find_package(Snappy CONFIG REQUIRED) ++ set(SNAPPY_LIBRARIES Snappy::snappy) + set (MONGOC_ENABLE_COMPRESSION 1) +- include_directories ("${SNAPPY_INCLUDE_DIRS}") + 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..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@") ++ 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/vcpkg/ports/mongo-c-driver/fix-include-directory.patch b/vcpkg/ports/mongo-c-driver/fix-include-directory.patch new file mode 100644 index 0000000..965f1d1 --- /dev/null +++ b/vcpkg/ports/mongo-c-driver/fix-include-directory.patch @@ -0,0 +1,13 @@ +diff --git a/src/libmongoc/CMakeLists.txt b/src/libmongoc/CMakeLists.txt +index 4675313..847e073 100644 +--- a/src/libmongoc/CMakeLists.txt ++++ b/src/libmongoc/CMakeLists.txt +@@ -1255,7 +1255,7 @@ else () + endif () + + set (MONGOC_HEADER_INSTALL_DIR +- "${CMAKE_INSTALL_INCLUDEDIR}/libmongoc-${MONGOC_API_VERSION}" ++ "${CMAKE_INSTALL_INCLUDEDIR}" + ) + + install ( diff --git a/vcpkg/ports/mongo-c-driver/fix-mingw.patch b/vcpkg/ports/mongo-c-driver/fix-mingw.patch new file mode 100644 index 0000000..5cbd2f6 --- /dev/null +++ b/vcpkg/ports/mongo-c-driver/fix-mingw.patch @@ -0,0 +1,63 @@ +diff --git a/src/libmongoc/CMakeLists.txt b/src/libmongoc/CMakeLists.txt +index 5be5265..b2bc27d 100644 +--- a/src/libmongoc/CMakeLists.txt ++++ b/src/libmongoc/CMakeLists.txt +@@ -209,7 +209,7 @@ endfunction() + # Per-backend link libs/options: + set(SecureTransport/LINK_LIBRARIES "-framework CoreFoundation" "-framework Security") + set(SecureTransport/pkg_config_LIBS -framework Corefoundation -framework Security) +-set(SecureChannel/LINK_LIBRARIES secur32.lib crypt32.lib Bcrypt.lib) ++set(SecureChannel/LINK_LIBRARIES secur32.lib crypt32.lib bcrypt.lib) + set(SecureChannel/pkg_config_LIBS ${SecureChannel/LINK_LIBRARIES}) + set(LibreSSL/LINK_LIBRARIES LibreSSL::TLS LibreSSL::Crypto) + set(LibreSSL/pkg_config_LIBS -ltls -lcrypto) +@@ -360,7 +360,7 @@ function(_use_sasl libname) + target_link_libraries(_mongoc-dependencies INTERFACE _mongoc-sasl_backend) + install(TARGETS _mongoc-sasl_backend EXPORT mongoc-targets) + if(libname STREQUAL "SSPI") +- target_link_libraries(_mongoc-sasl_backend INTERFACE secur32.lib crypt32.lib Shlwapi.lib) ++ target_link_libraries(_mongoc-sasl_backend INTERFACE secur32.lib crypt32.lib shlwapi.lib) + set(backend "SSPI") + elseif(libname STREQUAL "CYRUS") + find_package(SASL2 2.0 REQUIRED) +diff --git a/src/libmongoc/src/mongoc/mongoc-client.c b/src/libmongoc/src/mongoc/mongoc-client.c +index 096e0f9..62eca88 100644 +--- a/src/libmongoc/src/mongoc/mongoc-client.c ++++ b/src/libmongoc/src/mongoc/mongoc-client.c +@@ -18,8 +18,8 @@ + #include <mongoc/mongoc-config.h> + #ifdef MONGOC_HAVE_DNSAPI + /* for DnsQuery_UTF8 */ +-#include <Windows.h> +-#include <WinDNS.h> ++#include <windows.h> ++#include <winDNS.h> + #include <ws2tcpip.h> + #else + #if defined(MONGOC_HAVE_RES_NSEARCH) || defined(MONGOC_HAVE_RES_SEARCH) +diff --git a/src/libmongoc/src/mongoc/mongoc-socket.c b/src/libmongoc/src/mongoc/mongoc-socket.c +index df48fd0..3231035 100644 +--- a/src/libmongoc/src/mongoc/mongoc-socket.c ++++ b/src/libmongoc/src/mongoc/mongoc-socket.c +@@ -25,7 +25,7 @@ + #include <mongoc/mongoc-socket-private.h> + #include <mongoc/mongoc-trace-private.h> + #ifdef _WIN32 +-#include <Mstcpip.h> ++#include <mstcpip.h> + #include <process.h> + #endif + #include <common-cmp-private.h> +diff --git a/src/libmongoc/src/mongoc/mongoc-sspi-private.h b/src/libmongoc/src/mongoc/mongoc-sspi-private.h +index 381c417..3c7689c 100644 +--- a/src/libmongoc/src/mongoc/mongoc-sspi-private.h ++++ b/src/libmongoc/src/mongoc/mongoc-sspi-private.h +@@ -28,7 +28,7 @@ BSON_BEGIN_DECLS + + #define SECURITY_WIN32 1 /* Required for SSPI */ + +-#include <Windows.h> ++#include <windows.h> + #include <limits.h> + #include <sspi.h> + #include <string.h> diff --git a/vcpkg/ports/mongo-c-driver/portfile.cmake b/vcpkg/ports/mongo-c-driver/portfile.cmake new file mode 100644 index 0000000..ab00b38 --- /dev/null +++ b/vcpkg/ports/mongo-c-driver/portfile.cmake @@ -0,0 +1,106 @@ +# This port needs to be updated at the same time as libbson +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO mongodb/mongo-c-driver + REF "${VERSION}" + SHA512 2f751bf33410f084e083fc73d8ebb138e40c956e9bccb2ca460d33ab5e6b75793e1910defb1d5faad849a9668e0afc5024179ad323beacd75a12538f2abda270 + HEAD_REF master + PATCHES + disable-dynamic-when-static.patch + fix-dependencies.patch + fix-include-directory.patch + fix-mingw.patch + remove_abs_patch.cmake +) +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) +if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") + set(ENABLE_STATIC ON) +endif() + +vcpkg_check_features(OUT_FEATURE_OPTIONS OPTIONS + FEATURES + snappy ENABLE_SNAPPY + zstd ENABLE_ZSTD +) + +if("openssl" IN_LIST FEATURES) + list(APPEND OPTIONS -DENABLE_SSL=OPENSSL) +elseif(VCPKG_TARGET_IS_WINDOWS) + list(APPEND OPTIONS -DENABLE_SSL=WINDOWS) +elseif(VCPKG_TARGET_IS_OSX OR VCPKG_TARGET_IS_IOS) + list(APPEND OPTIONS -DENABLE_SSL=DARWIN) +else() + list(APPEND OPTIONS -DENABLE_SSL=OFF) +endif() + +if(VCPKG_TARGET_IS_ANDROID) + vcpkg_list(APPEND OPTIONS -DENABLE_SRV=OFF) +endif() + +vcpkg_find_acquire_program(PKGCONFIG) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + DISABLE_PARALLEL_CONFIGURE + OPTIONS + ${OPTIONS} + "-DBUILD_VERSION=${VERSION}" + -DUSE_BUNDLED_UTF8PROC=OFF + -DUSE_SYSTEM_LIBBSON=ON + -DENABLE_CLIENT_SIDE_ENCRYPTION=OFF + -DENABLE_EXAMPLES=OFF + -DENABLE_SASL=OFF + -DENABLE_SHM_COUNTERS=OFF + -DENABLE_STATIC=${ENABLE_STATIC} + -DENABLE_TESTS=OFF + -DBUILD_TESTING=OFF + -DENABLE_UNINSTALL=OFF + -DENABLE_ZLIB=SYSTEM + "-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}" + MAYBE_UNUSED_VARIABLES + PKG_CONFIG_EXECUTABLE +) + +vcpkg_cmake_install() +vcpkg_copy_pdbs() + +if("snappy" IN_LIST FEATURES AND VCPKG_LIBRARY_LINKAGE STREQUAL "static") + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/libmongoc-static-1.0.pc" " -lSnappy::snappy" "") + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/libmongoc-static-1.0.pc" "Requires: " "Requires: snappy ") + if(NOT VCPKG_BUILD_TYPE) + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libmongoc-static-1.0.pc" " -lSnappy::snappy" "") + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libmongoc-static-1.0.pc" "Requires: " "Requires: snappy ") + endif() +endif() +vcpkg_fixup_pkgconfig() + +# 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_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" + "${CURRENT_PACKAGES_DIR}/debug/share" +) + +file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") + +vcpkg_install_copyright( + FILE_LIST + "${SOURCE_PATH}/COPYING" + "${SOURCE_PATH}/THIRD_PARTY_NOTICES" + "${SOURCE_PATH}/src/libmongoc/THIRD_PARTY_NOTICES" +) diff --git a/vcpkg/ports/mongo-c-driver/remove_abs_patch.cmake b/vcpkg/ports/mongo-c-driver/remove_abs_patch.cmake new file mode 100644 index 0000000..f68db18 --- /dev/null +++ b/vcpkg/ports/mongo-c-driver/remove_abs_patch.cmake @@ -0,0 +1,13 @@ +diff --git a/src/libmongoc/CMakeLists.txt b/src/libmongoc/CMakeLists.txt +index 6e295d68fb..54ab225ba7 100644 +--- a/src/libmongoc/CMakeLists.txt ++++ b/src/libmongoc/CMakeLists.txt +@@ -474,7 +474,7 @@ if (NOT WIN32) + mongoc_get_accept_args (MONGOC_SOCKET_ARG2 MONGOC_SOCKET_ARG3) + endif () + +-set (MONGOC_CC ${CMAKE_C_COMPILER}) ++cmake_path(GET CMAKE_C_COMPILER FILENAME MONGOC_CC) + set (MONGOC_USER_SET_CFLAGS ${CMAKE_C_FLAGS}) + set (MONGOC_USER_SET_LDFLAGS ${CMAKE_EXE_LINKER_FLAGS}) + diff --git a/vcpkg/ports/mongo-c-driver/usage b/vcpkg/ports/mongo-c-driver/usage new file mode 100644 index 0000000..ae5fca4 --- /dev/null +++ b/vcpkg/ports/mongo-c-driver/usage @@ -0,0 +1,4 @@ +mongo-c-driver provides CMake targets:
+
+ find_package(mongoc-1.0 CONFIG REQUIRED)
+ target_link_libraries(main PRIVATE $<IF:$<TARGET_EXISTS:mongo::mongoc_shared>,mongo::mongoc_shared,mongo::mongoc_static>)
diff --git a/vcpkg/ports/mongo-c-driver/vcpkg.json b/vcpkg/ports/mongo-c-driver/vcpkg.json new file mode 100644 index 0000000..5ef37de --- /dev/null +++ b/vcpkg/ports/mongo-c-driver/vcpkg.json @@ -0,0 +1,48 @@ +{ + "name": "mongo-c-driver", + "version": "1.30.6", + "description": "Client library written in C for MongoDB.", + "homepage": "https://github.com/mongodb/mongo-c-driver", + "license": "Apache-2.0", + "supports": "!uwp", + "dependencies": [ + "libbson", + { + "name": "mongo-c-driver", + "features": [ + "openssl" + ], + "platform": "!windows & !osx & !ios" + }, + "utf8proc", + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + }, + "zlib" + ], + "features": { + "openssl": { + "description": "Use OpenSSL (even on Windows or Apple systems)", + "dependencies": [ + "openssl" + ] + }, + "snappy": { + "description": "Enables snappy compressor support", + "dependencies": [ + "snappy" + ] + }, + "zstd": { + "description": "Enables zstd compressor support", + "dependencies": [ + "zstd" + ] + } + } +} |