gentoo/dev-libs/libmongocrypt/files/libmongocrypt-1.10.1-build-version.patch
2024-07-06 02:18:49 +02:00

92 lines
4.3 KiB
Diff

From 887361a9e3bc3cfae306badb9f583e20bc808410 Mon Sep 17 00:00:00 2001
From: Kevin Albertson <kevin.albertson@mongodb.com>
Date: Fri, 5 Jul 2024 09:44:18 -0400
Subject: [PATCH 1/2] 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..ae489cfb5 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
From 5d4657060df0a3ab22293094669fe769aa8bfde3 Mon Sep 17 00:00:00 2001
From: Kevin Albertson <kevin.albertson@mongodb.com>
Date: Fri, 5 Jul 2024 16:30:38 -0400
Subject: [PATCH 2/2] use lowercase variable names
---
cmake/ImportBSON.cmake | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/cmake/ImportBSON.cmake b/cmake/ImportBSON.cmake
index ae489cfb5..fac2cb921 100644
--- a/cmake/ImportBSON.cmake
+++ b/cmake/ImportBSON.cmake
@@ -145,11 +145,11 @@ function (_import_bson)
# 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.
if (DEFINED CACHE{BUILD_VERSION})
- set (SAVED_CACHED_BUILD_VERSION "${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}")
+ set (saved_build_version "${BUILD_VERSION}")
unset (BUILD_VERSION) # Undefine normal variable.
endif ()
# Disable building tests in C driver:
@@ -164,11 +164,11 @@ 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")
+ 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}")
+ 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