Skip to content

Commit c100d44

Browse files
authored
CDRIVER-4680 remove enable_icu option and related code (#1342)
1 parent 0b98e5d commit c100d44

19 files changed

+44
-160
lines changed

.evergreen/etc/spec.patch

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
--- mongo-c-driver.spec.orig 2021-11-04 16:34:50.350572049 -0400
2-
+++ mongo-c-driver.spec 2021-11-04 16:37:54.962271319 -0400
3-
@@ -10,17 +10,17 @@
1+
+--- mongo-c-driver.spec.orig 2023-07-17 14:42:52.236247070 -0400
2+
++++ mongo-c-driver.spec 2023-07-17 14:43:16.572305452 -0400
3+
@@ -10,7 +10,7 @@
44
%global gh_project mongo-c-driver
55
%global libname libmongoc
66
%global libver 1.0
@@ -9,9 +9,7 @@
99
#global up_prever rc0
1010
# disabled as require a MongoDB server
1111
%bcond_with tests
12-
13-
# disable for bootstrap (libmongocrypt needs libbson)
14-
%bcond_without libmongocrypt
12+
@@ -20,7 +20,7 @@
1513

1614
Name: mongo-c-driver
1715
Summary: Client library written in C for MongoDB
@@ -20,3 +18,19 @@
2018
Release: 1%{?dist}
2119
# See THIRD_PARTY_NOTICES
2220
License: Apache-2.0 AND ISC AND MIT AND Zlib
21+
@@ -37,7 +37,6 @@
22+
BuildRequires: pkgconfig(libsasl2)
23+
BuildRequires: pkgconfig(zlib)
24+
BuildRequires: pkgconfig(snappy)
25+
-BuildRequires: pkgconfig(icu-uc)
26+
BuildRequires: pkgconfig(libzstd)
27+
%if %{with tests}
28+
BuildRequires: mongodb-server
29+
@@ -123,7 +122,6 @@
30+
-DENABLE_SSL:STRING=OPENSSL \
31+
-DENABLE_SASL:STRING=CYRUS \
32+
-DENABLE_MONGODB_AWS_AUTH:STRING=ON \
33+
- -DENABLE_ICU:STRING=ON \
34+
-DENABLE_AUTOMATIC_INIT_AND_CLEANUP:BOOL=OFF \
35+
-DENABLE_CRYPTO_SYSTEM_PROFILE:BOOL=ON \
36+
-DENABLE_MAN_PAGES:BOOL=ON \

.evergreen/scripts/compile-scan-build.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ configure_flags_append "-DCMAKE_SKIP_RPATH=TRUE" # Avoid hardcoding absolute pat
3535
configure_flags_append "-DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF"
3636
configure_flags_append "-DENABLE_CLIENT_SIDE_ENCRYPTION=ON"
3737
configure_flags_append "-DENABLE_DEBUG_ASSERTIONS=ON"
38-
configure_flags_append "-DENABLE_ICU=OFF"
3938
configure_flags_append "-DENABLE_MAINTAINER_FLAGS=ON"
4039
configure_flags_append "-DENABLE_SASL=OFF"
4140
configure_flags_append "-DENABLE_SNAPPY=OFF"

.evergreen/scripts/compile-test-azurekms.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ echo "Compile test-azurekms ... begin"
2323
-DENABLE_SNAPPY=OFF \
2424
-DENABLE_ZSTD=OFF \
2525
-DENABLE_ZLIB=OFF \
26-
-DENABLE_ICU=OFF \
2726
-DENABLE_SRV=OFF \
2827
-DENABLE_CLIENT_SIDE_ENCRYPTION=ON \
2928
-DCMAKE_PREFIX_PATH="$INSTALL_DIR" \

.evergreen/scripts/compile-test-gcpkms.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ echo "Compile test-gcpkms ... begin"
2323
-DENABLE_SNAPPY=OFF \
2424
-DENABLE_ZSTD=OFF \
2525
-DENABLE_ZLIB=OFF \
26-
-DENABLE_ICU=OFF \
2726
-DENABLE_SRV=OFF \
2827
-DENABLE_CLIENT_SIDE_ENCRYPTION=ON \
2928
-DCMAKE_PREFIX_PATH="$INSTALL_DIR" \

.evergreen/scripts/debian_package_build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export DEBOOTSTRAP_DIR=`pwd`/debootstrap.git
4343
sudo -E ./debootstrap.git/debootstrap unstable ./unstable-chroot/ http://cdn-aws.deb.debian.org/debian
4444
cp -a mongoc ./unstable-chroot/tmp/
4545
sudo chroot ./unstable-chroot /bin/bash -c "(\
46-
apt-get install -y build-essential git-buildpackage fakeroot debhelper cmake libssl-dev pkg-config python3-sphinx zlib1g-dev libicu-dev libsasl2-dev libsnappy-dev libzstd-dev libmongocrypt-dev libjs-mathjax libutf8proc-dev && \
46+
apt-get install -y build-essential git-buildpackage fakeroot debhelper cmake libssl-dev pkg-config python3-sphinx zlib1g-dev libsasl2-dev libsnappy-dev libzstd-dev libmongocrypt-dev libjs-mathjax libutf8proc-dev && \
4747
chown -R root:root /tmp/mongoc && \
4848
cd /tmp/mongoc && \
4949
git clean -fdx && \

CMakeLists.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,6 @@ mongo_setting(
127127
]]
128128
)
129129

130-
mongo_setting(ENABLE_ICU "Enable ICU support, needed for non-ASCII usernames and passwords"
131-
OPTIONS ON OFF AUTO
132-
DEFAULT VALUE AUTO)
133130
mongo_setting(ENABLE_CLIENT_SIDE_ENCRYPTION "Enable In-Use Encryption support. Requires additional support libraries."
134131
OPTIONS ON OFF AUTO
135132
DEFAULT VALUE AUTO)
@@ -472,8 +469,6 @@ if (ENABLE_MONGOC)
472469
${SOURCE_DIR}/src/zlib-1.2.13/gzwrite.c
473470
)
474471

475-
set (MONGOC_ENABLE_ICU 0)
476-
477472
set (CPACK_RESOURCE_FILE_LICENSE "${SOURCE_DIR}/COPYING")
478473

479474
include (CPack)

NEWS

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
libmongoc 1.25.0 (Unreleased)
2+
=============================
3+
4+
Improvements:
5+
6+
* Remove optional dependency of libicu.
7+
18
libmongoc 1.24.2
29
================
310

debian/control

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ Build-Depends: debhelper (>= 11),
1111
python3-sphinx,
1212
libmongocrypt-dev <!pkg.mongo-c-driver.no-libmongocrypt>,
1313
zlib1g-dev,
14-
libicu-dev,
1514
libsasl2-dev,
1615
libsnappy-dev,
1716
libutf8proc-dev,

src/libmongoc/CMakeLists.txt

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -366,28 +366,6 @@ if (ENABLE_SHM_COUNTERS)
366366
endif ()
367367
endif ()
368368

369-
if (NOT ENABLE_ICU MATCHES "AUTO|ON|OFF")
370-
message (FATAL_ERROR, "ENABLE_ICU option must be AUTO, ON, or OFF")
371-
endif()
372-
373-
if (NOT ENABLE_ICU STREQUAL OFF)
374-
if (ENABLE_ICU STREQUAL ON)
375-
# do not suppress log output if find_package cannot find ICU
376-
find_package (ICU COMPONENTS uc)
377-
elseif (ENABLE_ICU STREQUAL AUTO)
378-
find_package (ICU QUIET COMPONENTS uc)
379-
endif()
380-
if (ICU_FOUND)
381-
set (MONGOC_ENABLE_ICU 1)
382-
include_directories ("${ICU_INCLUDE_DIR}")
383-
elseif (ENABLE_ICU STREQUAL ON)
384-
message (FATAL_ERROR "No ICU library found. If ICU is installed in a non-standard directory, define ICU_ROOT as the ICU installation path.")
385-
elseif (ENABLE_ICU STREQUAL AUTO)
386-
message (STATUS "No ICU library found, SASLPrep disabled for SCRAM-SHA-256 authentication.")
387-
message (STATUS "If ICU is installed in a non-standard directory, define ICU_ROOT as the ICU installation path.")
388-
endif()
389-
endif()
390-
391369
# Configure In-Use Encryption
392370
set (MONGOC_ENABLE_CLIENT_SIDE_ENCRYPTION 0)
393371
if (NOT ENABLE_CLIENT_SIDE_ENCRYPTION MATCHES "AUTO|ON|OFF")
@@ -693,11 +671,11 @@ endif ()
693671

694672
set (LIBRARIES
695673
${SASL_LIBRARIES} ${SSL_LIBRARIES} ${SHM_LIBRARIES}
696-
${SNAPPY_LIBRARIES} ${ZLIB_LIBRARIES} ${MONGOC_ZSTD_LIBRARIES} ${ICU_LIBRARIES} ${LIBMONGOCRYPT_LIBRARY}
674+
${SNAPPY_LIBRARIES} ${ZLIB_LIBRARIES} ${MONGOC_ZSTD_LIBRARIES} ${LIBMONGOCRYPT_LIBRARY}
697675
)
698676
set (STATIC_LIBRARIES
699677
${SASL_LIBRARIES} ${SSL_LIBRARIES} ${SSL_STATIC_LIBRARIES} ${SHM_LIBRARIES}
700-
${SNAPPY_LIBRARIES} ${ZLIB_LIBRARIES} ${MONGOC_ZSTD_LIBRARIES} ${ICU_LIBRARIES} ${LIBMONGOCRYPT_LIBRARY}
678+
${SNAPPY_LIBRARIES} ${ZLIB_LIBRARIES} ${MONGOC_ZSTD_LIBRARIES} ${LIBMONGOCRYPT_LIBRARY}
701679
)
702680

703681
add_library(_mongoc-dependencies INTERFACE)
@@ -781,6 +759,11 @@ target_compile_definitions (mongoc_shared
781759
${KMS_MSG_DEFINITIONS}
782760
MCOMMON_NAME_PREFIX=_mongoc_mcommon
783761
)
762+
763+
if (USE_BUNDLED_UTF8PROC)
764+
target_compile_definitions (mongoc_shared PRIVATE UTF8PROC_STATIC)
765+
endif ()
766+
784767
# Several directories in the source and build trees contain headers we would like
785768
# include via relative reference, but they all end up in the same install path
786769
target_include_directories (
@@ -829,6 +812,9 @@ if (MONGOC_ENABLE_STATIC_BUILD)
829812
${KMS_MSG_DEFINITIONS}
830813
MCOMMON_NAME_PREFIX=_mongoc_mcommon
831814
)
815+
if (USE_BUNDLED_UTF8PROC)
816+
target_compile_definitions (mongoc_static PRIVATE UTF8PROC_STATIC)
817+
endif ()
832818
# Several directories in the source and build trees contain headers we would like
833819
# include via relative reference, but they all end up in the same install path
834820
target_include_directories (
@@ -1212,8 +1198,7 @@ endif ()
12121198
if(TARGET mongoc_static)
12131199
set(link_options
12141200
${SASL_LIBRARIES} ${SSL_LIBRARIES} ${SHM_LIBRARIES} ${ZLIB_LIBRARIES}
1215-
${SNAPPY_LIBRARIES} ${MONGOC_ZSTD_LIBRARIES} ${ICU_LIBRARIES}
1216-
${LIBMONGOCRYPT_LIBRARY})
1201+
${SNAPPY_LIBRARIES} ${MONGOC_ZSTD_LIBRARIES} ${LIBMONGOCRYPT_LIBRARY})
12171202
# Replace all absolute paths with search-dir link-file options:
12181203
list(TRANSFORM link_options
12191204
REPLACE "^(.+)/lib([^/\\.]+)\\..+$"

src/libmongoc/build/cmake/libmongoc-1.0-config.cmake.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ set (MONGOC_LIBRARIES ${MONGOC_LIBRARY} ${BSON_LIBRARIES})
3939
set (IS_FRAMEWORK_VAR 0)
4040
foreach (LIB
4141
@SASL_LIBRARIES@ @SSL_LIBRARIES@ @SHM_LIBRARIES@ @RESOLVE_LIB_NAME@
42-
@SNAPPY_LIBRARIES@ @ICU_LIBRARIES@ @MONGOC_ZSTD_LIBRARIES@ @LIBMONGOCRYPT_LIBRARY@
42+
@SNAPPY_LIBRARIES@ @MONGOC_ZSTD_LIBRARIES@ @LIBMONGOCRYPT_LIBRARY@
4343
)
4444
if (LIB STREQUAL "-framework")
4545
set (IS_FRAMEWORK_VAR 1)

src/libmongoc/build/cmake/libmongoc-static-1.0-config.cmake.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ set (MONGOC_STATIC_LIBRARIES ${MONGOC_STATIC_LIBRARY} ${ZLIB_STATIC_LIBRARY} ${B
4343
# like "-framework CoreFoundation;-framework Security".
4444
set (IS_FRAMEWORK_VAR 0)
4545
foreach (LIB @SASL_LIBRARIES@ @SSL_LIBRARIES@ @SHM_LIBRARIES@ @ZLIB_LIBRARIES@ @RESOLVE_LIB_NAME@
46-
@SNAPPY_LIBRARIES@ @ICU_LIBRARIES@ @MONGOC_ZSTD_LIBRARIES@ @LIBMONGOCRYPT_LIBRARY@
46+
@SNAPPY_LIBRARIES@ @MONGOC_ZSTD_LIBRARIES@ @LIBMONGOCRYPT_LIBRARY@
4747
)
4848
if (LIB STREQUAL "-framework")
4949
set (IS_FRAMEWORK_VAR 1)

src/libmongoc/doc/authentication.rst

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -49,21 +49,6 @@ Alternatively, SCRAM-SHA-256 can be explicitly specified as an authMechanism.
4949
5050
mongoc_client_t *client = mongoc_client_new ("mongodb://user:password@localhost/?authMechanism=SCRAM-SHA-256&authSource=mydb");
5151
52-
Passwords for SCRAM-SHA-256 undergo the preprocessing step known as SASLPrep
53-
specified in `RFC 4013 <https://tools.ietf.org/html/rfc4013>`_. SASLPrep will
54-
only be performed for passwords containing non-ASCII characters. SASLPrep
55-
requires libicu. If libicu is not available, attempting to authenticate over
56-
SCRAM-SHA-256 with non-ASCII passwords will result in error.
57-
58-
Usernames *never* undergo SASLPrep.
59-
60-
By default, when building the C driver libicu is linked if available. This can
61-
be changed with the ``ENABLE_ICU`` cmake option. To specify an installation
62-
path of libicu, specify ``ICU_ROOT`` as a cmake option. See the
63-
`FindICU <https://cmake.org/cmake/help/v3.7/module/FindICU.html>`_ documentation
64-
for more information.
65-
66-
6752
.. _authentication_scram_sha_1:
6853

6954
Basic Authentication (SCRAM-SHA-1)

src/libmongoc/examples/parse_handshake_cfg.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
"MONGOC_MD_FLAG_HAVE_SCHED_GETCPU",
3636
"MONGOC_MD_FLAG_ENABLE_SHM_COUNTERS",
3737
"MONGOC_MD_FLAG_TRACE",
38-
"MONGOC_MD_FLAG_ENABLE_ICU",
3938
"MONGOC_MD_FLAG_ENABLE_CLIENT_SIDE_ENCRYPTION",
4039
"MONGOC_MD_FLAG_ENABLE_MONGODB_AWS_AUTH",
4140
"MONGOC_MD_FLAG_ENABLE_SRV",

src/libmongoc/src/mongoc/mongoc-config.h.in

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -372,15 +372,6 @@
372372
*/
373373
#define MONGOC_TRACE @MONGOC_TRACE@
374374

375-
/*
376-
* Set if we have ICU support.
377-
*/
378-
#define MONGOC_ENABLE_ICU @MONGOC_ENABLE_ICU@
379-
380-
#if MONGOC_ENABLE_ICU != 1
381-
# undef MONGOC_ENABLE_ICU
382-
#endif
383-
384375
/*
385376
* Set if we have Client Side Encryption support.
386377
*/

src/libmongoc/src/mongoc/mongoc-handshake-private.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ typedef enum {
7878
MONGOC_MD_FLAG_HAVE_SCHED_GETCPU,
7979
MONGOC_MD_FLAG_ENABLE_SHM_COUNTERS,
8080
MONGOC_MD_FLAG_TRACE,
81-
MONGOC_MD_FLAG_ENABLE_ICU,
8281
MONGOC_MD_FLAG_ENABLE_CLIENT_SIDE_ENCRYPTION,
8382
MONGOC_MD_FLAG_ENABLE_MONGODB_AWS_AUTH,
8483
MONGOC_MD_FLAG_ENABLE_SRV,

src/libmongoc/src/mongoc/mongoc-handshake.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,6 @@ _mongoc_handshake_get_config_hex_string (void)
184184
_set_bit (bf, byte_count, MONGOC_MD_FLAG_TRACE);
185185
}
186186

187-
#ifdef MONGOC_ENABLE_ICU
188-
_set_bit (bf, byte_count, MONGOC_MD_FLAG_ENABLE_ICU);
189-
#endif
190-
191187
#ifdef MONGOC_ENABLE_CLIENT_SIDE_ENCRYPTION
192188
_set_bit (bf, byte_count, MONGOC_MD_FLAG_ENABLE_CLIENT_SIDE_ENCRYPTION);
193189
#endif
@@ -693,7 +689,7 @@ _mongoc_handshake_parse_sasl_supported_mechs (
693689
find (keyWithType ("saslSupportedMechs", array),
694690
visitEach (case (
695691
when (strEqual ("SCRAM-SHA-256"),
696-
do(sasl_supported_mechs->scram_sha_256 = true)),
692+
do (sasl_supported_mechs->scram_sha_256 = true)),
697693
when (strEqual ("SCRAM-SHA-1"),
698-
do(sasl_supported_mechs->scram_sha_1 = true))))));
694+
do (sasl_supported_mechs->scram_sha_1 = true))))));
699695
}

src/libmongoc/src/mongoc/mongoc-scram.c

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,6 @@ _mongoc_scram_cache_copy (const mongoc_scram_cache_t *cache)
112112
return ret;
113113
}
114114

115-
#ifdef MONGOC_ENABLE_ICU
116-
#include <unicode/usprep.h>
117-
#include <unicode/ustring.h>
118-
#endif
119-
120-
121115
void
122116
_mongoc_scram_cache_destroy (mongoc_scram_cache_t *cache)
123117
{
@@ -1058,7 +1052,6 @@ _mongoc_sasl_prep_required (const char *str)
10581052
return false;
10591053
}
10601054

1061-
#ifdef MONGOC_ENABLE_ICU
10621055
char *
10631056
_mongoc_sasl_prep_impl (const char *name,
10641057
const char *in_utf8,
@@ -1251,26 +1244,14 @@ _mongoc_sasl_prep_impl (const char *name,
12511244
return (char *) out_utf8;
12521245
#undef SASL_PREP_ERR_RETURN
12531246
}
1254-
#endif
12551247

12561248
char *
12571249
_mongoc_sasl_prep (const char *in_utf8, bson_error_t *err)
12581250
{
1259-
#ifdef MONGOC_ENABLE_ICU
12601251
if (_mongoc_sasl_prep_required (in_utf8)) {
12611252
return _mongoc_sasl_prep_impl ("password", in_utf8, err);
12621253
}
12631254
return bson_strdup (in_utf8);
1264-
#else
1265-
if (_mongoc_sasl_prep_required (in_utf8)) {
1266-
bson_set_error (err,
1267-
MONGOC_ERROR_SCRAM,
1268-
MONGOC_ERROR_SCRAM_PROTOCOL_ERROR,
1269-
"SCRAM Failure: ICU required to SASLPrep password");
1270-
return NULL;
1271-
}
1272-
return bson_strdup (in_utf8);
1273-
#endif
12741255
}
12751256

12761257
size_t

src/libmongoc/tests/test-mongoc-handshake.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -882,10 +882,6 @@ test_handshake_platform_config (void)
882882
BSON_ASSERT (_get_bit (config_str, MONGOC_MD_FLAG_TRACE));
883883
}
884884

885-
#ifdef MONGOC_ENABLE_ICU
886-
BSON_ASSERT (_get_bit (config_str, MONGOC_MD_FLAG_ENABLE_ICU));
887-
#endif
888-
889885
#ifdef MONGOC_ENABLE_CLIENT_SIDE_ENCRYPTION
890886
BSON_ASSERT (
891887
_get_bit (config_str, MONGOC_MD_FLAG_ENABLE_CLIENT_SIDE_ENCRYPTION));

0 commit comments

Comments
 (0)