From 05807488fd340751ee976c5f8a367013ff94843e Mon Sep 17 00:00:00 2001 From: Earl Chew Date: Sat, 16 Dec 2023 08:48:36 -0800 Subject: [PATCH] Combine ICU libraries icu-i18n and icu-uc into a single dependency Rather than probing for icu-i18n, icu-uc, and icudata libraries separately, only probe for icu-i18n, and icu-uc, as direct dependencies This avoids overlinking with icudata, and allows the package to build even when ICU is not installed as a system library. RN: Only use icu-i18n and icu-uc to express ICU dependency BUG: https://bugzilla.samba.org/show_bug.cgi?id=15623 Signed-off-by: Earl Chew Reviewed-by: Andrew Bartlett Reviewed-by: Douglas Bagnall --- lib/util/charset/iconv.c | 8 ++++---- lib/util/charset/wscript_build | 3 ++- lib/util/charset/wscript_configure | 17 +++++++---------- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/lib/util/charset/iconv.c b/lib/util/charset/iconv.c index 131df640986..074794a26e3 100644 --- a/lib/util/charset/iconv.c +++ b/lib/util/charset/iconv.c @@ -26,7 +26,7 @@ #include "lib/util/charset/charset.h" #include "lib/util/charset/charset_proto.h" -#ifdef HAVE_ICU_I18N +#ifdef HAVE_ICUI18N #include #include #endif @@ -168,7 +168,7 @@ static size_t sys_iconv(void *cd, } #endif -#ifdef HAVE_ICU_I18N +#ifdef HAVE_ICUI18N static size_t sys_uconv(void *cd, const char **inbuf, size_t *inbytesleft, @@ -334,7 +334,7 @@ static bool is_utf16(const char *name) static int smb_iconv_t_destructor(smb_iconv_t hwd) { -#ifdef HAVE_ICU_I18N +#ifdef HAVE_ICUI18N /* * This has to come first, as the cd_direct member won't be an iconv * handle and must not be passed to iconv_close(). @@ -418,7 +418,7 @@ _PUBLIC_ smb_iconv_t smb_iconv_open_ex(TALLOC_CTX *mem_ctx, const char *tocode, } #endif -#ifdef HAVE_ICU_I18N +#ifdef HAVE_ICUI18N if (strcasecmp(fromcode, "UTF8-NFD") == 0 && strcasecmp(tocode, "UTF8-NFC") == 0) { diff --git a/lib/util/charset/wscript_build b/lib/util/charset/wscript_build index c69a17170ad..3af90a0ad57 100644 --- a/lib/util/charset/wscript_build +++ b/lib/util/charset/wscript_build @@ -6,7 +6,8 @@ bld.SAMBA_SUBSYSTEM('ICONV_WRAPPER', weird.c charset_macosxfs.c ''', - public_deps='iconv replace talloc ' + bld.env['icu-libs']) + deps=bld.env['icu-libs'], + public_deps='iconv replace talloc') bld.SAMBA_SUBSYSTEM('charset', public_headers='charset.h', diff --git a/lib/util/charset/wscript_configure b/lib/util/charset/wscript_configure index 58858f69b31..c49b55a4fd4 100644 --- a/lib/util/charset/wscript_configure +++ b/lib/util/charset/wscript_configure @@ -37,15 +37,12 @@ conf.CHECK_CODE(''' lib='iconv', headers='errno.h iconv.h') -if conf.CHECK_CFG(package='icu-i18n', +if conf.CHECK_CFG(package='icu-i18n icu-uc', args='--cflags --libs', - msg='Checking for icu-i18n', - uselib_store='ICU_I18N'): - for lib in conf.env['LIB_ICU_I18N']: - conf.CHECK_LIB(lib, shlib=True, mandatory=True) - conf.env['icu-libs'] = ' '.join(conf.env['LIB_ICU_I18N']) - if not conf.CHECK_HEADERS('unicode/ustring.h'): - conf.fatal('Found libicu, but unicode/ustring.h is missing') + msg='Checking for icu-i18n icu-uc', + uselib_store='ICUI18N'): + conf.env['icu-libs'] = 'icui18n' + conf.CHECK_LIB(conf.env['icu-libs'], shlib=True, mandatory=True) + if not conf.CHECK_HEADERS('unicode/ustring.h', lib='icui18n'): + conf.fatal('Found icui18n, but unicode/ustring.h is missing') conf.DEFINE('HAVE_UTF8_NORMALISATION', 1) -else: - conf.env['icu-libs'] = '' -- 2.47.3