Skip to content

Commit

Permalink
[mongo-cxx-driver] update to 3.9.0 (#34994)
Browse files Browse the repository at this point in the history
* update to 3.9.0

* update version

* update libbson

* update version

* Fix static compilation issue

* update version

* patch

* update version

* patch

* update version
  • Loading branch information
jimwang118 authored Nov 17, 2023
1 parent 42f810b commit 939eaca
Show file tree
Hide file tree
Showing 17 changed files with 174 additions and 234 deletions.
30 changes: 5 additions & 25 deletions ports/libbson/fix-include-directory.patch
Original file line number Diff line number Diff line change
@@ -1,33 +1,13 @@
diff --git a/src/libbson/CMakeLists.txt b/src/libbson/CMakeLists.txt
index 88de79a..c3cfd7e 100644
index e3eaca4..ef3644b 100644
--- a/src/libbson/CMakeLists.txt
+++ b/src/libbson/CMakeLists.txt
@@ -347,7 +347,7 @@ if (ENABLE_EXAMPLES)
endif () # ENABLE_EXAMPLES
@@ -302,7 +302,7 @@ endif () # ENABLE_EXAMPLES
# 8888888 888 888 88888P' "Y888 "Y888888 888 888

set (BSON_HEADER_INSTALL_DIR
- "${CMAKE_INSTALL_INCLUDEDIR}/libbson-${BSON_API_VERSION}"
+ "${CMAKE_INSTALL_INCLUDEDIR}"
)

if (MONGOC_ENABLE_STATIC_INSTALL)
diff --git a/src/libbson/src/libbson-1.0.pc.in b/src/libbson/src/libbson-1.0.pc.in
index b65abbc..33346f3 100644
--- a/src/libbson/src/libbson-1.0.pc.in
+++ b/src/libbson/src/libbson-1.0.pc.in
@@ -7,4 +7,4 @@ Name: libbson
Description: The libbson BSON serialization library.
Version: @VERSION@
Libs: -L${libdir} -lbson-@BSON_API_VERSION@
-Cflags: -I${includedir}/libbson-@BSON_API_VERSION@
+Cflags: -I${includedir}
diff --git a/src/libbson/src/libbson-static-1.0.pc.in b/src/libbson/src/libbson-static-1.0.pc.in
index 6ee58d0..e03a95b 100644
--- a/src/libbson/src/libbson-static-1.0.pc.in
+++ b/src/libbson/src/libbson-static-1.0.pc.in
@@ -7,4 +7,4 @@ Name: libbson static archive
Description: The libbson BSON serialization library.
Version: @VERSION@
Libs: -L${libdir} -lbson-static-@BSON_API_VERSION@ @LIBBSON_LIBRARIES@
-Cflags: -I${includedir}/libbson-@BSON_API_VERSION@ -DBSON_STATIC
+Cflags: -I${includedir} -DBSON_STATIC
function(install_export_target target)
# Tell pkg-config where the headers are going:
10 changes: 7 additions & 3 deletions ports/libbson/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,20 @@ vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO mongodb/mongo-c-driver
REF "${VERSION}"
SHA512 242416638bf6722ccda67ecc15cf78f8531f1a4ae0e89fd66cde74221d7b98b859442f5b70628802972961e69156fd7afcc916d7a83cc134d5723eb0b6e15cc9
SHA512 e0f15a8a45ff156136251f1a0e5d0cc2b0253ba9dbf062a6eaef73e02c3b7999d3af31a9eb2ebf2c141e5b2367e356b3ea56b8eb083a5097d88f81bbc4f0be23
HEAD_REF master
PATCHES
disable-dynamic-when-static.patch
fix-include-directory.patch # vcpkg legacy decision
fix-missing-header.patch # for building mongo-c-driver
)
file(WRITE "${SOURCE_PATH}/VERSION_CURRENT" "${VERSION}")

# Cannot use string(COMPARE EQUAL ...)
set(ENABLE_STATIC OFF)
set(ENABLE_SHARED OFF)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
set(ENABLE_STATIC ON)
else()
set(ENABLE_SHARED ON)
endif()

vcpkg_cmake_configure(
Expand All @@ -33,10 +34,13 @@ vcpkg_cmake_configure(
-DENABLE_SRV=OFF
-DENABLE_SSL=OFF
-DENABLE_STATIC=${ENABLE_STATIC}
-DENABLE_SHARED=${ENABLE_SHARED}
-DENABLE_TESTS=OFF
-DENABLE_UNINSTALL=OFF
-DENABLE_ZLIB=SYSTEM
-DENABLE_ZSTD=OFF
MAYBE_UNUSED_VARIABLES
ENABLE_ICU
)
vcpkg_cmake_install()
vcpkg_copy_pdbs()
Expand Down
2 changes: 1 addition & 1 deletion ports/libbson/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "libbson",
"version": "1.24.3",
"version": "1.25.1",
"description": "libbson is a library providing useful routines related to building, parsing, and iterating BSON documents.",
"homepage": "https://github.com/mongodb/mongo-c-driver/tree/master/src/libbson",
"license": null,
Expand Down
63 changes: 25 additions & 38 deletions ports/mongo-c-driver/disable-dynamic-when-static.patch
Original file line number Diff line number Diff line change
@@ -1,37 +1,38 @@
diff --git a/src/libmongoc/CMakeLists.txt b/src/libmongoc/CMakeLists.txt
index bf95bd0c1..c9900b7fa 100644
index 61cae9c..5f553c5 100644
--- a/src/libmongoc/CMakeLists.txt
+++ b/src/libmongoc/CMakeLists.txt
@@ -745,6 +745,7 @@ if (MONGOC_ENABLE_STATIC_BUILD)
@@ -812,6 +812,7 @@ if (MONGOC_ENABLE_STATIC_BUILD)
set_target_properties (mcd_rpc PROPERTIES OUTPUT_NAME "mcd-rpc")
endif ()

+if (NOT MONGOC_ENABLE_STATIC_BUILD)
add_library (mongoc_shared SHARED ${SOURCES} ${HEADERS} ${HEADERS_FORWARDING})
set_target_properties (mongoc_shared PROPERTIES CMAKE_CXX_VISIBILITY_PRESET hidden)
target_link_libraries (mongoc_shared PRIVATE ${LIBRARIES} PUBLIC ${BSON_LIBRARIES})
@@ -786,7 +787,7 @@ target_include_directories (
set_target_properties (mongoc_shared PROPERTIES VERSION 0.0.0 SOVERSION 0)
set_target_properties (mongoc_shared PROPERTIES OUTPUT_NAME "${MONGOC_OUTPUT_BASENAME}-${MONGOC_API_VERSION}")

if(WIN32)
# Add resource-definition script for Windows shared library (.dll).
@@ -865,7 +866,7 @@ set_target_properties (mongoc_shared PROPERTIES
)
mongo_generate_pkg_config(mongoc_shared INSTALL RENAME libmongoc-${MONGOC_API_VERSION}.pc)
-if (MONGOC_ENABLE_STATIC_BUILD)
+else()
add_library (mongoc_static STATIC ${SOURCES} ${HEADERS} ${HEADERS_FORWARDING})
if(ENABLE_COVERAGE)
target_compile_options(mongoc_static PRIVATE --coverage)
@@ -840,7 +841,11 @@ if (ENABLE_APPLE_FRAMEWORK)
target_link_libraries (mongoc_static PUBLIC ${STATIC_LIBRARIES} ${BSON_STATIC_LIBRARIES} mongo::detail::c_dependencies)
if (NOT WIN32 AND ENABLE_PIC)
@@ -934,7 +935,11 @@ if (ENABLE_APPLE_FRAMEWORK)
endif ()

add_executable (mongoc-stat ${PROJECT_SOURCE_DIR}/../../src/tools/mongoc-stat.c)
-target_link_libraries (mongoc-stat mongoc_shared ${LIBRARIES})
+if (NOT MONGOC_ENABLE_STATIC_BUILD)
target_link_libraries (mongoc-stat mongoc_shared ${LIBRARIES})
+ target_link_libraries (mongoc-stat mongoc_shared ${LIBRARIES})
+else()
+target_link_libraries (mongoc-stat mongoc_static ${LIBRARIES})
+ target_link_libraries (mongoc-stat mongoc_static ${LIBRARIES})
+endif()

# mongoc-stat works if shared memory performance counters are enabled.
if (ENABLE_SHM_COUNTERS)
@@ -1161,7 +1166,7 @@ file (COPY ${PROJECT_SOURCE_DIR}/tests/x509gen DESTINATION ${PROJECT_BINARY_DIR}
@@ -1244,7 +1249,7 @@ file (COPY ${PROJECT_SOURCE_DIR}/tests/x509gen DESTINATION ${PROJECT_BINARY_DIR}
file (COPY ${PROJECT_SOURCE_DIR}/tests/release_files DESTINATION ${PROJECT_BINARY_DIR}/tests)

if (MONGOC_ENABLE_STATIC_INSTALL)
Expand All @@ -40,33 +41,19 @@ index bf95bd0c1..c9900b7fa 100644
else ()
set (TARGETS_TO_INSTALL mongoc_shared)
endif ()
@@ -1226,10 +1231,12 @@ configure_file (
${CMAKE_CURRENT_SOURCE_DIR}/src/libmongoc-1.0.pc.in
${CMAKE_CURRENT_BINARY_DIR}/src/libmongoc-1.0.pc
@ONLY)
@@ -1299,6 +1304,7 @@ endif()
# Relative include-path will be given the install prefix:
set_property(TARGET ${TARGETS_TO_INSTALL} APPEND PROPERTY pkg_config_INCLUDE_DIRECTORIES "${MONGOC_HEADER_INSTALL_DIR}")

+if(NOT MONGOC_ENABLE_STATIC_INSTALL)
install (
FILES ${CMAKE_CURRENT_BINARY_DIR}/src/libmongoc-1.0.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
)
+endif()
if (MONGOC_ENABLE_STATIC_INSTALL)
configure_file (
${CMAKE_CURRENT_SOURCE_DIR}/src/libmongoc-static-1.0.pc.in
@@ -1239,7 +1246,7 @@ if (MONGOC_ENABLE_STATIC_INSTALL)
FILES ${CMAKE_CURRENT_BINARY_DIR}/src/libmongoc-static-1.0.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
)
-endif ()
+else()
# Deprecated alias for libmongoc-1.0.pc, see CDRIVER-2086.
if (MONGOC_ENABLE_SSL)
configure_file (
@@ -1251,6 +1258,7 @@ if (MONGOC_ENABLE_SSL)
@@ -1310,6 +1316,7 @@ if (MONGOC_ENABLE_SSL)
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
)
endif ()
+endif()
+endif ()

include (CMakePackageConfigHelpers)
set (INCLUDE_INSTALL_DIRS "${MONGOC_HEADER_INSTALL_DIR}")

89 changes: 40 additions & 49 deletions ports/mongo-c-driver/fix-dependencies.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 71c13fd..8464824 100644
index 1fe4c76..96be699 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -205,11 +205,9 @@ if (ENABLE_BSON STREQUAL SYSTEM)
@@ -347,11 +347,9 @@ if (USE_SYSTEM_LIBBSON)

set (USING_SYSTEM_BSON TRUE)
if (NOT TARGET mongo::bson_shared)
Expand All @@ -14,11 +14,39 @@ index 71c13fd..8464824 100644
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
+++ 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 d108e5d..a097016 100644
index 5f553c5..4675313 100644
--- a/src/libmongoc/CMakeLists.txt
+++ b/src/libmongoc/CMakeLists.txt
@@ -51,7 +51,7 @@ configure_file (
@@ -50,7 +50,7 @@ endif ()
set (ZLIB_INCLUDE_DIRS "")
if (ENABLE_ZLIB MATCHES "SYSTEM|AUTO")
message (STATUS "Searching for zlib CMake packages")
Expand All @@ -27,16 +55,7 @@ index d108e5d..a097016 100644
if (ZLIB_FOUND)
message (STATUS " zlib found version \"${ZLIB_VERSION_STRING}\"")
message (STATUS " zlib include path \"${ZLIB_INCLUDE_DIRS}\"")
@@ -146,7 +146,7 @@ if (NOT ENABLE_SSL STREQUAL OFF)
if (ENABLE_SSL STREQUAL "OPENSSL"
OR (NOT APPLE AND NOT WIN32 AND ENABLE_SSL STREQUAL "AUTO"))
# Sets OPENSSL_FOUND on success.
- include (FindOpenSSL)
+ find_package(OpenSSL REQUIRED)
endif ()

if (ENABLE_SSL STREQUAL LIBRESSL)
@@ -364,10 +364,10 @@ else ()
@@ -468,10 +468,10 @@ else ()
endif ()

# Sets SNAPPY_LIBRARIES and SNAPPY_INCLUDE_DIRS.
Expand All @@ -49,45 +68,17 @@ index d108e5d..a097016 100644
- include_directories ("${SNAPPY_INCLUDE_DIRS}")
endif ()

set (MONGOC_ENABLE_SHM_COUNTERS 0)
diff --git a/src/libmongoc/build/cmake/libmongoc-1.0-config.cmake.in b/src/libmongoc/build/cmake/libmongoc-1.0-config.cmake.in
index feeca02..1ec92ae 100644
--- a/src/libmongoc/build/cmake/libmongoc-1.0-config.cmake.in
+++ b/src/libmongoc/build/cmake/libmongoc-1.0-config.cmake.in
@@ -19,6 +19,10 @@ set (MONGOC_MINOR_VERSION @MONGOC_MINOR_VERSION@)
set (MONGOC_MICRO_VERSION @MONGOC_MICRO_VERSION@)
set (MONGOC_VERSION @MONGOC_VERSION@)

+include(CMakeFindDependencyMacro)
+if("@ENABLE_SNAPPY@" STREQUAL "ON")
+ find_dependency(Snappy CONFIG)
+endif()
find_package (libbson-1.0 "@MONGOC_MAJOR_VERSION@.@MONGOC_MINOR_VERSION@" REQUIRED)

@PACKAGE_INIT@
diff --git a/src/libmongoc/build/cmake/libmongoc-static-1.0-config.cmake.in b/src/libmongoc/build/cmake/libmongoc-static-1.0-config.cmake.in
index 6f05b0c..0e388e6 100644
--- a/src/libmongoc/build/cmake/libmongoc-static-1.0-config.cmake.in
+++ b/src/libmongoc/build/cmake/libmongoc-static-1.0-config.cmake.in
@@ -19,6 +19,10 @@ set (MONGOC_STATIC_MINOR_VERSION @MONGOC_MINOR_VERSION@)
set (MONGOC_STATIC_MICRO_VERSION @MONGOC_MICRO_VERSION@)
set (MONGOC_STATIC_VERSION @MONGOC_VERSION@)

+include(CMakeFindDependencyMacro)
+if("@ENABLE_SNAPPY@" STREQUAL "ON")
+ find_dependency(Snappy CONFIG)
+endif()
find_package (libbson-static-1.0 "@MONGOC_MAJOR_VERSION@.@MONGOC_MINOR_VERSION@" REQUIRED)

@PACKAGE_INIT@
mongo_bool01 (MONGOC_ENABLE_SHM_COUNTERS ENABLE_SHM_COUNTERS)
diff --git a/src/libmongoc/src/mongoc-config.cmake b/src/libmongoc/src/mongoc-config.cmake
index 7fe7cf4..12611a3 100644
index 31e6cbc..365fb5b 100644
--- a/src/libmongoc/src/mongoc-config.cmake
+++ b/src/libmongoc/src/mongoc-config.cmake
@@ -1,3 +1,6 @@
@@ -1,5 +1,8 @@
include(CMakeFindDependencyMacro)
find_dependency(bson-1.0 @libmongoc_VERSION@)
+if("@ENABLE_SNAPPY@" STREQUAL "ON")
+ find_dependency(Snappy CONFIG)
+endif()
find_dependency(bson-1.0 @MONGOC_MAJOR_VERSION@.@MONGOC_MINOR_VERSION@.@MONGOC_MICRO_VERSION@)
include("${CMAKE_CURRENT_LIST_DIR}/mongoc-targets.cmake")

# If we need to import a TLS package for our imported targets, do that now:
set(MONGOC_TLS_BACKEND [[@TLS_BACKEND@]])
24 changes: 2 additions & 22 deletions ports/mongo-c-driver/fix-include-directory.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
diff --git a/src/libmongoc/CMakeLists.txt b/src/libmongoc/CMakeLists.txt
index 86f59ae..d108e5d 100644
index 4675313..847e073 100644
--- a/src/libmongoc/CMakeLists.txt
+++ b/src/libmongoc/CMakeLists.txt
@@ -1172,7 +1172,7 @@ else ()
@@ -1255,7 +1255,7 @@ else ()
endif ()

set (MONGOC_HEADER_INSTALL_DIR
Expand All @@ -11,23 +11,3 @@ index 86f59ae..d108e5d 100644
)

install (
diff --git a/src/libmongoc/src/libmongoc-1.0.pc.in b/src/libmongoc/src/libmongoc-1.0.pc.in
index 1b489d8..991603e 100644
--- a/src/libmongoc/src/libmongoc-1.0.pc.in
+++ b/src/libmongoc/src/libmongoc-1.0.pc.in
@@ -8,4 +8,4 @@ Description: The libmongoc MongoDB client library.
Version: @VERSION@
Requires: libbson-1.0
Libs: -L${libdir} -lmongoc-1.0
-Cflags: -I${includedir}/libmongoc-@MONGOC_API_VERSION@
+Cflags: -I${includedir}
diff --git a/src/libmongoc/src/libmongoc-static-1.0.pc.in b/src/libmongoc/src/libmongoc-static-1.0.pc.in
index d59ee64..c23bb62 100644
--- a/src/libmongoc/src/libmongoc-static-1.0.pc.in
+++ b/src/libmongoc/src/libmongoc-static-1.0.pc.in
@@ -8,4 +8,4 @@ Description: The libmongoc MongoDB client library.
Version: @VERSION@
Requires: libbson-static-1.0
Libs: -L${libdir} -lmongoc-static-1.0 @MONGOC_LIBRARIES@
-Cflags: -I${includedir}/libmongoc-@MONGOC_API_VERSION@ -DMONGOC_STATIC
+Cflags: -I${includedir}/libmongoc -DMONGOC_STATIC
Loading

0 comments on commit 939eaca

Please sign in to comment.