Combine ICU libraries icu-i18n and icu-uc into a single dependency
authorEarl Chew <earl_chew@yahoo.com>
Sat, 16 Dec 2023 16:48:36 +0000 (08:48 -0800)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 10 May 2024 00:26:35 +0000 (00:26 +0000)
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 <earl_chew@yahoo.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
lib/util/charset/iconv.c
lib/util/charset/wscript_build
lib/util/charset/wscript_configure

index 131df640986649f71a8a8dae3c6d41265978dc37..074794a26e31df239c9d8a5b5c3f811ec62f3b11 100644 (file)
@@ -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 <unicode/ustring.h>
 #include <unicode/utrans.h>
 #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)
        {
index c69a17170ad6e70b38237036600c8a5ce9899dde..3af90a0ad574220328c6806912dbccc7857b0828 100644 (file)
@@ -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',
index 58858f69b319d45232fc036bc0d973120b846a08..c49b55a4fd4b7452005827c1b7bef4697b5d1b30 100644 (file)
@@ -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'] = ''