diff --git a/aclocal.m4 b/aclocal.m4 index cb9215de1c5d7b4ca8e83439ac2407c73f8db56a..8dedf26ea68bb25dfefe18d1f7b78e6b4eb0d068 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -17,7 +17,6 @@ builtin(include, build/autoconf/compiler-opts.m4)dnl builtin(include, build/autoconf/expandlibs.m4)dnl builtin(include, build/autoconf/arch.m4)dnl builtin(include, build/autoconf/android.m4)dnl -builtin(include, build/autoconf/icu.m4)dnl builtin(include, build/autoconf/clang-plugin.m4)dnl builtin(include, build/autoconf/alloc.m4)dnl builtin(include, build/autoconf/sanitize.m4)dnl diff --git a/build/autoconf/icu.m4 b/build/autoconf/icu.m4 deleted file mode 100644 index 631e0002585c20f66a3db2f4839e2988f7bd88e6..0000000000000000000000000000000000000000 --- a/build/autoconf/icu.m4 +++ /dev/null @@ -1,99 +0,0 @@ -dnl This Source Code Form is subject to the terms of the Mozilla Public -dnl License, v. 2.0. If a copy of the MPL was not distributed with this -dnl file, You can obtain one at http://mozilla.org/MPL/2.0/. - -dnl Set the MOZ_ICU_VERSION variable to denote the current version of the -dnl ICU library, as well as a few other things. - -AC_DEFUN([MOZ_CONFIG_ICU], [ - -MOZ_SYSTEM_ICU= -MOZ_ARG_WITH_BOOL(system-icu, -[ --with-system-icu - Use system ICU (located with pkgconfig)], - MOZ_SYSTEM_ICU=1) - -if test -n "$MOZ_SYSTEM_ICU"; then - PKG_CHECK_MODULES(MOZ_ICU, icu-i18n >= 67.1) - CFLAGS="$CFLAGS $MOZ_ICU_CFLAGS" - CXXFLAGS="$CXXFLAGS $MOZ_ICU_CFLAGS" - AC_DEFINE(MOZ_SYSTEM_ICU) -fi - -AC_SUBST(MOZ_SYSTEM_ICU) - -MOZ_ARG_WITH_STRING(intl-api, -[ --with-intl-api, --without-intl-api - Determine the status of the ECMAScript Internationalization API. The first - (or lack of any of these) builds and exposes the API. The second doesn't - build ICU at all.], - _INTL_API=$withval) - -JS_HAS_INTL_API= -case "$_INTL_API" in -no) - ;; -yes) - JS_HAS_INTL_API=1 - ;; -*) - AC_MSG_ERROR([Invalid value passed to --with-intl-api: $_INTL_API]) - ;; -esac - -if test -n "$JS_HAS_INTL_API"; then - USE_ICU=1 -fi - -if test -n "$JS_HAS_INTL_API"; then - AC_DEFINE(JS_HAS_INTL_API) -fi - -dnl Settings for the implementation of the ECMAScript Internationalization API -if test -n "$USE_ICU"; then - icudir="$_topsrcdir/intl/icu/source" - if test ! -d "$icudir"; then - icudir="$_topsrcdir/../../intl/icu/source" - if test ! -d "$icudir"; then - AC_MSG_ERROR([Cannot find the ICU directory]) - fi - fi - - version=`sed -n 's/^[[[:space:]]]*#[[:space:]]*define[[:space:]][[:space:]]*U_ICU_VERSION_MAJOR_NUM[[:space:]][[:space:]]*\([0-9][0-9]*\)[[:space:]]*$/\1/p' "$icudir/common/unicode/uvernum.h"` - if test x"$version" = x; then - AC_MSG_ERROR([cannot determine icu version number from uvernum.h header file $lineno]) - fi - MOZ_ICU_VERSION="$version" - - # TODO: the l is actually endian-dependent - # We could make this set as 'l' or 'b' for little or big, respectively, - # but we'd need to check in a big-endian version of the file. - ICU_DATA_FILE="icudt${version}l.dat" -fi - -AC_SUBST(MOZ_ICU_VERSION) -AC_SUBST(JS_HAS_INTL_API) -AC_SUBST(USE_ICU) -AC_SUBST(ICU_DATA_FILE) - -if test -n "$USE_ICU"; then - dnl Source files that use ICU should have control over which parts of the ICU - dnl namespace they want to use. - AC_DEFINE(U_USING_ICU_NAMESPACE,0) - - if test -z "$MOZ_SYSTEM_ICU"; then - case "$OS_TARGET:$CPU_ARCH" in - WINNT:aarch64) - dnl we use non-yasm, non-GNU as solutions here. - ;; - *) - if test -z "$YASM" -a -z "$GNU_AS" -a "$COMPILE_ENVIRONMENT"; then - AC_MSG_ERROR([Building ICU requires either yasm or a GNU assembler. If you do not have either of those available for this platform you must use --without-intl-api]) - fi - ;; - esac - dnl We build ICU as a static library. - AC_DEFINE(U_STATIC_IMPLEMENTATION) - fi -fi -]) diff --git a/build/moz.configure/old.configure b/build/moz.configure/old.configure index 1822e31148590cd15c324d20ee32891ed8d72d0c..c539a46693f01225d735d9b5274ea8f4087b5f0e 100644 --- a/build/moz.configure/old.configure +++ b/build/moz.configure/old.configure @@ -242,11 +242,9 @@ def old_configure_options(*options): '--with-app-name', '--with-branding', '--with-distribution-id', - '--with-intl-api', '--with-macbundlename-prefix', '--with-nss-exec-prefix', '--with-nss-prefix', - '--with-system-icu', '--with-system-libevent', '--with-system-nss', '--with-system-png', diff --git a/js/app.mozbuild b/js/app.mozbuild index 80488800c5eaeff32ecc5fb4ff1a0eaf06ce79d8..36cedb8938436917f2ac14457fedecfde4d32ec9 100644 --- a/js/app.mozbuild +++ b/js/app.mozbuild @@ -26,7 +26,7 @@ DIRS += [ '/mozglue', ] -if CONFIG['USE_ICU']: +if CONFIG['JS_HAS_INTL_API']: DIRS += [ '/config/external/icu', ] diff --git a/js/moz.configure b/js/moz.configure index e4bbd9fa4fabdfd77e5819b5d8ff54fd44a1aded..b1c9685733b03d3642f1ae2dc0125b2486ed48ad 100644 --- a/js/moz.configure +++ b/js/moz.configure @@ -720,3 +720,64 @@ js_option('--with-jitreport-granularity', default='3', choices=('0', '1', '2', ' set_define('JS_DEFAULT_JITREPORT_GRANULARITY', depends_if('--with-jitreport-granularity')(lambda value: value[0])) + + +# ECMAScript Internationalization API Support (uses ICU) +# ====================================================== +js_option('--with-system-icu', help='Use system ICU') + +system_icu = pkg_check_modules('MOZ_ICU', 'icu-i18n >= 67.1', when='--with-system-icu') + +set_config('MOZ_SYSTEM_ICU', True, when=system_icu) +set_define('MOZ_SYSTEM_ICU', True, when=system_icu) + +js_option('--without-intl-api', help='Disable ECMAScript Internationalization API') + +@depends('--with-intl-api', building_js) +def check_intl_api(enabled, building_js): + if not enabled and not building_js: + die('--without-intl-api is not supported') + +set_config('JS_HAS_INTL_API', True, when='--with-intl-api') +set_define('JS_HAS_INTL_API', True, when='--with-intl-api') + +@depends(check_build_environment, when='--with-intl-api') +@imports(_from='__builtin__', _import='open') +@imports(_from='__builtin__', _import='ValueError') +def icu_version(build_env): + path = os.path.join(build_env.topsrcdir, 'intl', 'icu', 'source', 'common', + 'unicode', 'uvernum.h') + with open(path, encoding='utf-8') as fh: + for line in fh: + if line.startswith('#define'): + define = line.split(None, 3) + if len(define) == 3 and define[1] == 'U_ICU_VERSION_MAJOR_NUM': + try: + return str(int(define[2])) + except ValueError: + pass + die('Cannot determine ICU version number from uvernum.h header file') + +set_config('MOZ_ICU_VERSION', icu_version) + +@depends(icu_version, target, when='--with-intl-api') +def icu_data_file(version, target): + # target.endianness is always 'big' or 'little' + return 'icudt%s%s.dat' % (version, target.endianness[0]) + +set_config('ICU_DATA_FILE', icu_data_file) + +# Source files that use ICU should have control over which parts of the ICU +# namespace they want to use. +set_define('U_USING_ICU_NAMESPACE', '0', when='--with-intl-api') + +# We build ICU as a static library. +set_define('U_STATIC_IMPLEMENTATION', True, when=depends(system_icu)(lambda x: not x)) + +@depends(yasm, gnu_as, target, compile_environment) +def can_build_data_file(yasm, gnu_as, target, compile_environment): + if not compile_environment or (target.kernel == 'WINNT' and target.cpu == 'aarch64'): + return + if not yasm and not gnu_as: + die('Building ICU requires either yasm or a GNU assembler. If you do not have ' + 'either of those available for this platform you must use --without-intl-api') diff --git a/js/src/aclocal.m4 b/js/src/aclocal.m4 index 83c54af6c5d7a322853b538c768ebf137a1d399d..0e8eb088ac7183438d7cfedb9527d29075797d5b 100644 --- a/js/src/aclocal.m4 +++ b/js/src/aclocal.m4 @@ -16,7 +16,6 @@ builtin(include, ../../build/autoconf/compiler-opts.m4)dnl builtin(include, ../../build/autoconf/expandlibs.m4)dnl builtin(include, ../../build/autoconf/arch.m4)dnl builtin(include, ../../build/autoconf/android.m4)dnl -builtin(include, ../../build/autoconf/icu.m4)dnl builtin(include, ../../build/autoconf/clang-plugin.m4)dnl builtin(include, ../../build/autoconf/alloc.m4)dnl builtin(include, ../../build/autoconf/sanitize.m4)dnl diff --git a/js/src/old-configure.in b/js/src/old-configure.in index 653d2bc76e87c8ecb0066f4d77a85e2e88ea943a..29d32873112c9fe48a5d0a724c54b389a25d2889 100644 --- a/js/src/old-configure.in +++ b/js/src/old-configure.in @@ -1354,15 +1354,6 @@ AC_SUBST(MOZ_APP_DISPLAYNAME) AC_SUBST(MOZ_PKG_SPECIAL) -dnl ======================================================== -dnl ECMAScript Internationalization API Support (uses ICU) -dnl ======================================================== - -dnl top-level configure may override this with --without-intl-api -_INTL_API=yes - -MOZ_CONFIG_ICU() - dnl Echo the CFLAGS to remove extra whitespace. CFLAGS=`echo \ $_COMPILATION_CFLAGS \ diff --git a/js/sub.configure b/js/sub.configure index dbd5ef21c5c72babc0b3ef46bd85a78bcc803db8..1731fc977188c5191344bc25daa9f41f45ee5722 100644 --- a/js/sub.configure +++ b/js/sub.configure @@ -49,9 +49,6 @@ def js_subconfigure(host, target, build_env, js_configure_args, mozconfig, options = [host, target] + js_configure_args - if not substs.get('JS_HAS_INTL_API'): - options.append('--without-intl-api') - options.append('--prefix=%s/dist' % build_env.topobjdir) if substs.get('ZLIB_IN_MOZGLUE'): diff --git a/old-configure.in b/old-configure.in index c5f796f2f75a88e3de69874e891b986c2839331a..e47cab2141b73ae455eaa606ad329f5c19efd78d 100644 --- a/old-configure.in +++ b/old-configure.in @@ -2819,18 +2819,6 @@ dnl win32 options AC_SUBST(WIN32_REDIST_DIR) AC_SUBST(WIN_UCRT_REDIST_DIR) -dnl ======================================================== -dnl ICU Support -dnl ======================================================== - -_INTL_API=yes - -if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then - USE_ICU=1 -fi - -MOZ_CONFIG_ICU() - dnl Echo the CFLAGS to remove extra whitespace. CFLAGS=`echo \ $_COMPILATION_CFLAGS \ diff --git a/python/mozbuild/mozbuild/frontend/context.py b/python/mozbuild/mozbuild/frontend/context.py index 074981efa874275592c19b43226d7fdbd5667a3a..9350ee4f11ec651fdef038235bb42436cc58c8cd 100644 --- a/python/mozbuild/mozbuild/frontend/context.py +++ b/python/mozbuild/mozbuild/frontend/context.py @@ -534,7 +534,7 @@ class CompileFlags(TargetCompileFlags): ('CXXFLAGS', 'CFLAGS')), ('OS_INCLUDES', list(itertools.chain(*(context.config.substs.get(v, []) for v in ( 'NSPR_CFLAGS', 'NSS_CFLAGS', 'MOZ_JPEG_CFLAGS', 'MOZ_PNG_CFLAGS', - 'MOZ_ZLIB_CFLAGS', 'MOZ_PIXMAN_CFLAGS')))), + 'MOZ_ZLIB_CFLAGS', 'MOZ_PIXMAN_CFLAGS', 'MOZ_ICU_CFLAGS')))), ('CXXFLAGS', 'CFLAGS')), ('DSO', context.config.substs.get('DSO_CFLAGS'), ('CXXFLAGS', 'CFLAGS')), diff --git a/toolkit/library/moz.build b/toolkit/library/moz.build index 7531c07e194cc47bb3c8861b7aabc3132da44642..cdc0577443a9e25e71abcf9db2be6bd644ac14f7 100644 --- a/toolkit/library/moz.build +++ b/toolkit/library/moz.build @@ -148,11 +148,6 @@ USE_LIBS += [ 'zlib', ] -if CONFIG['USE_ICU']: - USE_LIBS += [ - 'icu', - ] - if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk': USE_LIBS += [ 'mozgtk_stub',