Commit 90885289 authored by Mike Hommey's avatar Mike Hommey
Browse files

Bug 1635764 - Move --with-system-icu and --with-intl-api to python configure....

Bug 1635764 - Move --with-system-icu and --with-intl-api to python configure. r=firefox-build-system-reviewers,rstewart

At the same time, because it's now simpler to do so, set the right data
file name for big-endians, even though we don't have or produce it
(bug #1264836). Also remove USE_ICU, which is redundant with
JS_HAS_INTL_API, and actively break the build at configure time when
using --without-intl-api with Firefox because this hasn't actually
worked for close to 3 years (since bug 1402048).

Differential Revision: https://phabricator.services.mozilla.com/D77416
parent 8a9448c7
......@@ -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
......
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
])
......@@ -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',
......
......@@ -26,7 +26,7 @@ DIRS += [
'/mozglue',
]
if CONFIG['USE_ICU']:
if CONFIG['JS_HAS_INTL_API']:
DIRS += [
'/config/external/icu',
]
......
......@@ -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')
......@@ -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
......
......@@ -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 \
......
......@@ -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'):
......
......@@ -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 \
......
......@@ -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')),
......
......@@ -148,11 +148,6 @@ USE_LIBS += [
'zlib',
]
if CONFIG['USE_ICU']:
USE_LIBS += [
'icu',
]
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk':
USE_LIBS += [
'mozgtk_stub',
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment