gentoo/dev-libs/libmongocrypt/files/libmongocrypt-1.10.1-build-version.patch

50 lines
2.4 KiB
Diff

From d8f335e3df9dccbfea1af5651b895f37a740a72e Mon Sep 17 00:00:00 2001
From: Kevin Albertson <kevin.albertson@mongodb.com>
Date: Mon, 8 Jul 2024 10:35:32 -0400
Subject: [PATCH] MONGOCRYPT-706 clear `BUILD_VERSION` before including C
driver (#855)
* MONGOCRYPT-706 clear `BUILD_VERSION` before including C driver
To prevent applying `BUILD_VERSION` intended for libmongocrypt to the C driver.
---
cmake/ImportBSON.cmake | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/cmake/ImportBSON.cmake b/cmake/ImportBSON.cmake
index 58d863b87..fac2cb921 100644
--- a/cmake/ImportBSON.cmake
+++ b/cmake/ImportBSON.cmake
@@ -142,9 +142,16 @@ function (_import_bson)
set (ENABLE_EXTRA_ALIGNMENT ${_extra_alignment_default} CACHE BOOL "Toggle extra alignment of bson_t")
# We don't want the subproject to find libmongocrypt
set (ENABLE_CLIENT_SIDE_ENCRYPTION OFF CACHE BOOL "Disable client-side encryption for the libmongoc subproject")
- # Set `BUILD_VERSION` so C driver does not use a `BUILD_VERSION` meant for libmongocrypt.
+ # Clear `BUILD_VERSION` so C driver does not use a `BUILD_VERSION` meant for libmongocrypt.
# Both libmongocrypt and C driver support setting a `BUILD_VERSION` to override the version.
- set (BUILD_VERSION ${MONGOC_FETCH_TAG_FOR_LIBBSON})
+ if (DEFINED CACHE{BUILD_VERSION})
+ set (saved_cached_build_version "${BUILD_VERSION}")
+ unset (BUILD_VERSION CACHE) # Undefine cache variable.
+ endif ()
+ if (DEFINED BUILD_VERSION)
+ set (saved_build_version "${BUILD_VERSION}")
+ unset (BUILD_VERSION) # Undefine normal variable.
+ endif ()
# Disable building tests in C driver:
set (ENABLE_TESTS OFF)
set (BUILD_TESTING OFF)
@@ -157,6 +164,12 @@ function (_import_bson)
else ()
add_subdirectory ("${MONGOCRYPT_MONGOC_DIR}" _mongo-c-driver EXCLUDE_FROM_ALL)
endif ()
+ if (DEFINED saved_cached_build_version)
+ set (BUILD_VERSION "${saved_cached_build_version}" CACHE STRING "Library version")
+ endif ()
+ if (DEFINED saved_build_version)
+ set (BUILD_VERSION "${saved_build_version}")
+ endif ()
if (TARGET mongoc_static)
# Workaround: Embedded mongoc_static does not set its INCLUDE_DIRECTORIES for user targets
target_include_directories (mongoc_static