Skip to content

Commit 8ef0dfd

Browse files
authored
MONGOCRYPT-843 update libbson dependency to 2.1.0 (#1068)
1 parent dffd66e commit 8ef0dfd

17 files changed

+122
-235
lines changed

.evergreen/config.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1337,6 +1337,8 @@ buildvariants:
13371337
- name: rhel-62-64-bit
13381338
display_name: "RHEL 6.2 64-bit"
13391339
run_on: rhel62-small
1340+
expansions:
1341+
compile_env: CFLAGS="-D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS" ADDITIONAL_CMAKE_FLAGS="-DENABLE_TESTS=OFF -DBUILD_TESTING=OFF"
13401342
tasks:
13411343
- build-and-test-and-upload
13421344
- build-and-test-shared-bson

.evergreen/debian_package_build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ sudo chroot ./unstable-chroot /bin/bash -c '(set -o xtrace && \
8383
LANG=C /bin/bash ./debian/build_snapshot.sh && \
8484
debc ../*.changes && \
8585
dpkg -i ../*.deb && \
86-
/usr/bin/gcc -I/usr/include/mongocrypt -I/usr/include/libbson-1.0 -o example-state-machine test/example-state-machine.c -lmongocrypt -lbson-1.0 )'
86+
/usr/bin/gcc $(pkgconf --cflags mongocrypt bson2) -o example-state-machine test/example-state-machine.c -lmongocrypt -lbson2 )'
8787

8888
[ -e ./unstable-chroot/tmp/libmongocrypt/example-state-machine ] || (echo "Example 'example-state-machine' was not built!" ; exit 1)
8989
(cd ./unstable-chroot/tmp/ ; tar zcvf ../../deb.tar.gz *.dsc *.orig.tar.gz *.debian.tar.xz *.build *.deb)

.evergreen/linker-tests.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ fi
6161
run_chdir "$MONGOC_DIR" git apply --ignore-whitespace "$linker_tests_deps_root/bson_patches/libbson1.patch"
6262
# Apply patches to fix compile on RHEL 6.2. TODO: try to remove once RHEL 6.2 is dropped (MONGOCRYPT-688).
6363
run_chdir "$MONGOC_DIR" git apply "$LIBMONGOCRYPT_DIR/etc/libbson-remove-GCC-diagnostic-pragma.patch"
64-
run_chdir "$MONGOC_DIR" git apply "$LIBMONGOCRYPT_DIR/etc/libbson-remove-GCC-diagnostic-in-functions.patch"
64+
run_chdir "$MONGOC_DIR" git apply "$LIBMONGOCRYPT_DIR/etc/mongo-common-test-harness.patch"
6565

6666
BUILD_PATH="$MONGOC_DIR/cmake-build"
6767
BSON1_INSTALL_PATH="$linker_tests_root/install/bson1"
@@ -80,7 +80,7 @@ run_chdir "$MONGOC_DIR" git reset --hard
8080
run_chdir "$MONGOC_DIR" git apply --ignore-whitespace "$linker_tests_deps_root/bson_patches/libbson2.patch"
8181
# Apply patch to fix compile on RHEL 6.2. TODO: try to remove once RHEL 6.2 is dropped (MONGOCRYPT-688).
8282
run_chdir "$MONGOC_DIR" git apply "$LIBMONGOCRYPT_DIR/etc/libbson-remove-GCC-diagnostic-pragma.patch"
83-
run_chdir "$MONGOC_DIR" git apply "$LIBMONGOCRYPT_DIR/etc/libbson-remove-GCC-diagnostic-in-functions.patch"
83+
run_chdir "$MONGOC_DIR" git apply "$LIBMONGOCRYPT_DIR/etc/mongo-common-test-harness.patch"
8484
LIBBSON2_SRC_DIR="$MONGOC_DIR"
8585
echo "Prepare libbson2 ... done"
8686

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
cmake_minimum_required (VERSION 3.15...4.0)
22
project (app C)
33
add_executable (app app.c)
4-
find_package (bson-1.0 1.11 REQUIRED)
5-
message ("-- libbson found version \"${bson-1.0_VERSION}\"")
6-
target_link_libraries (app PRIVATE mongo::bson_static)
4+
find_package (bson REQUIRED)
5+
message ("-- libbson found version \"${bson_VERSION}\"")
6+
target_link_libraries (app PRIVATE bson::static)
77

88
find_package (mongocrypt REQUIRED)
99
target_link_libraries (app PRIVATE mongo::mongocrypt)

.evergreen/linker_tests_deps/bson_patches/libbson1.patch

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
Adds a printf to bson_malloc0 to test linking scenarios with two forms of libbson.
22
See linker-tests.sh. If this patch fails to apply, regenerate from libbson's source.
33

4-
diff --git a/src/libbson/src/bson/bson-memory.c b/src/libbson/src/bson/bson-memory.c
4+
diff --git a/src/libbson/src/bson/memory.c b/src/libbson/src/bson/memory.c
55
index 0e1523331..aa7112305 100644
6-
--- a/src/libbson/src/bson/bson-memory.c
7-
+++ b/src/libbson/src/bson/bson-memory.c
6+
--- a/src/libbson/src/bson/memory.c
7+
+++ b/src/libbson/src/bson/memory.c
88
@@ -104,6 +104,7 @@ bson_malloc0 (size_t num_bytes) /* IN */
99
{
1010
void *mem = NULL;

.evergreen/linker_tests_deps/bson_patches/libbson2.patch

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
Adds a printf to bson_malloc0 to test linking scenarios with two forms of libbson.
22
See linker-tests.sh. If this patch fails to apply, regenerate from libbson's source.
33

4-
diff --git a/src/libbson/src/bson/bson-memory.c b/src/libbson/src/bson/bson-memory.c
4+
diff --git a/src/libbson/src/bson/memory.c b/src/libbson/src/bson/memory.c
55
index 0e1523331..aa7112305 100644
6-
--- a/src/libbson/src/bson/bson-memory.c
7-
+++ b/src/libbson/src/bson/bson-memory.c
6+
--- a/src/libbson/src/bson/memory.c
7+
+++ b/src/libbson/src/bson/memory.c
88
@@ -104,6 +104,7 @@ bson_malloc0 (size_t num_bytes) /* IN */
99
{
1010
void *mem = NULL;

.evergreen/pkgconfig-tests.sh

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ if is_true USE_NINJA; then
4343
bash "$EVG_DIR/ensure-ninja.sh"
4444
fi
4545

46+
# Apply patches to fix compile on RHEL 6.2. TODO: try to remove once RHEL 6.2 is dropped (MONGOCRYPT-688).
47+
run_chdir "$mongoc_src_dir" git apply "$LIBMONGOCRYPT_DIR/etc/libbson-remove-GCC-diagnostic-pragma.patch"
48+
run_chdir "$mongoc_src_dir" git apply "$LIBMONGOCRYPT_DIR/etc/mongo-common-test-harness.patch"
49+
4650
echo "Building libbson ..."
4751
libbson_install_dir="$pkgconfig_tests_root/install/libbson"
4852
build_dir="$mongoc_src_dir/_build"
@@ -52,7 +56,7 @@ run_cmake -DENABLE_MONGOC=OFF \
5256
-H"$mongoc_src_dir" \
5357
-B"$build_dir"
5458
run_cmake --build "$build_dir" --target install --config RelWithDebInfo
55-
libbson_pkg_config_path="$(native_path "$(dirname "$(find "$libbson_install_dir" -name libbson-1.0.pc)")")"
59+
libbson_pkg_config_path="$(native_path "$(dirname "$(find "$libbson_install_dir" -name bson2.pc)")")"
5660
echo "Building libbson ... done"
5761

5862
echo "Build libmongocrypt, static linking against libbson and configured for the PPA ..."
@@ -79,7 +83,7 @@ pkg-config --debug --print-errors --exists libmongocrypt
7983
echo "Validating pkg-config scripts ... done"
8084

8185
echo "Build example-state-machine, static linking against libmongocrypt ..."
82-
gcc $(pkg-config --cflags libmongocrypt-static libbson-static-1.0) \
86+
gcc $(pkg-config --cflags libmongocrypt-static bson2-static) \
8387
-o "$pkgconfig_tests_root/example-state-machine" \
8488
"$LIBMONGOCRYPT_DIR/test/example-state-machine.c" \
8589
$(pkg-config --libs libmongocrypt-static)
@@ -95,7 +99,7 @@ command "$pkgconfig_tests_root/example-no-bson"
9599
echo "Build example-no-bson, static linking against libmongocrypt ... done"
96100

97101
echo "Build example-state-machine, dynamic linking against libmongocrypt ..."
98-
gcc $(pkg-config --cflags libmongocrypt libbson-static-1.0) \
102+
gcc $(pkg-config --cflags libmongocrypt bson2-static) \
99103
-o "$pkgconfig_tests_root/example-state-machine" \
100104
"$LIBMONGOCRYPT_DIR/test/example-state-machine.c" \
101105
$(pkg-config --libs libmongocrypt)
@@ -127,7 +131,7 @@ run_cmake --build "$build_dir" --target install --config RelWithDebInfo
127131
echo "Build libmongocrypt, dynamic linking against libbson ... done"
128132

129133
echo "Build example-state-machine, static linking against libmongocrypt ..."
130-
gcc $(pkg-config --cflags libmongocrypt-static libbson-static-1.0) \
134+
gcc $(pkg-config --cflags libmongocrypt-static bson2-static) \
131135
-o "$pkgconfig_tests_root/example-state-machine" \
132136
"$LIBMONGOCRYPT_DIR/test/example-state-machine.c" \
133137
$(pkg-config --libs libmongocrypt-static)
@@ -146,7 +150,7 @@ env LD_LIBRARY_PATH="$libbson_install_dir/lib:/$libbson_install_dir/lib64" \
146150
echo "Build example-no-bson, static linking against libmongocrypt ... done"
147151

148152
echo "Build example-state-machine, dynamic linking against libmongocrypt ..."
149-
gcc $(pkg-config --cflags libmongocrypt libbson-static-1.0) \
153+
gcc $(pkg-config --cflags libmongocrypt bson2-static) \
150154
-o "$pkgconfig_tests_root/example-state-machine" \
151155
"$LIBMONGOCRYPT_DIR/test/example-state-machine.c" \
152156
$(pkg-config --libs libmongocrypt)

.evergreen/prep_c_driver_source.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
set -euxo pipefail
44

55
# Clone mongo-c-driver and check out to a tagged version.
6-
MONGO_C_DRIVER_VERSION=1.30.3
6+
MONGO_C_DRIVER_VERSION=2.1.0
77

88
# Force checkout with lf endings since .sh must have lf, not crlf on Windows
99
git clone https://github.com/mongodb/mongo-c-driver.git --config core.eol=lf --config core.autocrlf=false --depth=1 --branch $MONGO_C_DRIVER_VERSION

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
- This applies to MongoDB C Driver when `MONGOCRYPT_MONGOC_DIR` is not set to `USE-SYSTEM`.
1010
- This applies to IntelDFP when `MONGOCRYPT_DFP_DIR` is not set to `USE-SYSTEM`.
1111
- Note: `FetchContent_Populate()` is still used for CMake versions prior to 3.18 to avoid `add_subdirectory()` behavior.
12+
- Bump downloaded libbson version from 1.30.3 to 2.1.0.
1213

1314
## 1.15.2
1415

CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -622,11 +622,11 @@ install (
622622
set (PROJECT_VERSION "${BUILD_VERSION}")
623623
set (PROJECT_DESCRIPTION "The libmongocrypt client-side field level encryption library.")
624624
if (NOT ENABLE_BUILD_FOR_PPA)
625-
set (PKG_CONFIG_STATIC_REQUIRES "libbson-static-1.0")
625+
set (PKG_CONFIG_STATIC_REQUIRES "bson2-static")
626626
endif ()
627627
if (USE_SHARED_LIBBSON)
628-
set (PKG_CONFIG_REQUIRES "libbson-1.0")
629-
set (PKG_CONFIG_STATIC_REQUIRES "libbson-1.0")
628+
set (PKG_CONFIG_REQUIRES "bson2")
629+
set (PKG_CONFIG_STATIC_REQUIRES "bson2")
630630
endif ()
631631
set (PKG_CONFIG_LIBDIR "\${prefix}/${CMAKE_INSTALL_LIBDIR}")
632632
set (PKG_CONFIG_INCLUDEDIR "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}/mongocrypt")

0 commit comments

Comments
 (0)