Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit dc8e93a

Browse files
author
Norbert Lindenberg
committed
Bug 724533 - Integrate ICU into the Mozilla build (but don't actually build it, until a compile-time flag gets flipped). r=glandium
1 parent 53efaae commit dc8e93a

3 files changed

Lines changed: 133 additions & 8 deletions

File tree

js/src/Makefile.in

Lines changed: 45 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -556,13 +556,53 @@ distclean clean::
556556
endif
557557
endif
558558

559+
560+
#############################################
561+
# BEGIN ECMAScript Internationalization API
562+
#
563+
559564
# ICU headers need to be available whether we build with the complete
560565
# Internationalization API or not - ICU stubs rely on them.
561566

562567
LOCAL_INCLUDES += \
563-
-I$(topsrcdir)/../../intl/icu/source/common \
564-
-I$(topsrcdir)/../../intl/icu/source/i18n \
565-
$(NULL)
568+
-I$(topsrcdir)/../../intl/icu/source/common \
569+
-I$(topsrcdir)/../../intl/icu/source/i18n \
570+
$(NULL)
571+
572+
ifdef ENABLE_INTL_API
573+
574+
ifeq ($(OS_ARCH),WINNT)
575+
# Parallel gmake is buggy on Windows
576+
ICU_GMAKE_OPTIONS="-j1"
577+
# Library names: On Windows, ICU uses modified library names for static
578+
# and debug libraries.
579+
ifdef MOZ_DEBUG
580+
ICU_LIB_SUFFIX=d
581+
endif
582+
ICU_LIB_RENAME = $(foreach libname,$(ICU_LIB_NAMES),\
583+
cp -p intl/icu/lib/s$(libname)$(ICU_LIB_SUFFIX).lib intl/icu/lib/$(libname).lib;)
584+
endif
585+
586+
# - Build ICU as part of the "export" target, so things get built
587+
# in the right order.
588+
# - ICU requires GNU make according to its readme.html. pymake can't be used
589+
# because it doesn't support order only dependencies.
590+
# - Force ICU to use the standard suffix for object files because expandlibs
591+
# will discard all files with a non-standard suffix (bug 857450).
592+
# - Options for genrb: -k strict parsing; -R omit collation tailoring rules.
593+
export::
594+
$(GMAKE) $(ICU_GMAKE_OPTIONS) -C intl/icu STATIC_O=$(OBJ_SUFFIX) GENRBOPTS='-k -R'
595+
$(ICU_LIB_RENAME)
596+
597+
distclean clean::
598+
$(call SUBMAKE,$@,intl/icu)
599+
600+
endif
601+
602+
#
603+
# END ECMAScript Internationalization API
604+
#############################################
605+
566606

567607
# The "find any vanilla new/new[] calls" script is tailored to Linux, so
568608
# only run it there. That should be enough to catch any such calls that
@@ -687,6 +727,8 @@ ifneq (,$(MOZ_ZLIB_LIBS)$(MOZ_GLUE_LDFLAGS))
687727
DEFINES += -DUSE_ZLIB
688728
endif
689729

730+
SHARED_LIBRARY_LIBS += $(ICU_LIBS)
731+
690732
# Prevent floating point errors caused by VC++ optimizations
691733
ifdef _MSC_VER
692734
# XXX We should add this to CXXFLAGS, too?
@@ -984,4 +1026,3 @@ endif
9841026
#
9851027
# END kludges for the Nitro assembler
9861028
###############################################
987-

js/src/configure.in

Lines changed: 88 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4403,14 +4403,102 @@ if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
44034403
AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
44044404
fi
44054405

4406+
4407+
dnl ========================================================
44064408
dnl ECMAScript Internationalization API Support (uses ICU)
44074409
dnl ========================================================
44084410

4411+
MOZ_ARG_ENABLE_BOOL(intl-api,
4412+
[ --enable-intl-api Enable ECMAScript Internationalization API],
4413+
ENABLE_INTL_API=1 )
4414+
4415+
dnl Settings for the implementation of the ECMAScript Internationalization API
4416+
if test -n "$ENABLE_INTL_API"; then
4417+
AC_DEFINE(ENABLE_INTL_API)
4418+
# We build ICU as a static library.
4419+
AC_DEFINE(U_STATIC_IMPLEMENTATION)
4420+
4421+
case "$OS_TARGET" in
4422+
WINNT)
4423+
ICU_LIB_NAMES="icuin icuuc icudt"
4424+
;;
4425+
Darwin|Linux)
4426+
ICU_LIB_NAMES="icui18n icuuc icudata"
4427+
;;
4428+
*)
4429+
AC_MSG_ERROR([ECMAScript Internationalization API is not yet supported on this platform])
4430+
esac
4431+
4432+
ICU_LIBS='$(call EXPAND_LIBNAME_PATH,$(ICU_LIB_NAMES),$(DEPTH)/intl/icu/lib)'
4433+
else
4434+
ICU_LIB_NAMES=
4435+
ICU_LIBS=
4436+
fi
4437+
4438+
AC_SUBST(ENABLE_INTL_API)
4439+
AC_SUBST(ICU_LIB_NAMES)
4440+
AC_SUBST(ICU_LIBS)
4441+
44094442
dnl Source files that use ICU should have control over which parts of the ICU
44104443
dnl namespace they want to use.
44114444
AC_DEFINE(U_USING_ICU_NAMESPACE,0)
44124445

44134446

4447+
dnl Settings for ICU
4448+
if test -n "$ENABLE_INTL_API" ; then
4449+
# Set ICU compile options
4450+
ICU_CPPFLAGS=""
4451+
# don't use icu namespace automatically in client code
4452+
ICU_CPPFLAGS="$ICU_CPPFLAGS -DU_USING_ICU_NAMESPACE=0"
4453+
# don't include obsolete header files
4454+
ICU_CPPFLAGS="$ICU_CPPFLAGS -DU_NO_DEFAULT_INCLUDE_UTF_HEADERS=1"
4455+
# remove chunks of the library that we don't need (yet)
4456+
ICU_CPPFLAGS="$ICU_CPPFLAGS -DUCONFIG_NO_LEGACY_CONVERSION"
4457+
ICU_CPPFLAGS="$ICU_CPPFLAGS -DUCONFIG_NO_TRANSLITERATION"
4458+
ICU_CPPFLAGS="$ICU_CPPFLAGS -DUCONFIG_NO_REGULAR_EXPRESSIONS"
4459+
ICU_CPPFLAGS="$ICU_CPPFLAGS -DUCONFIG_NO_BREAK_ITERATION"
4460+
4461+
# Set OS dependent options for ICU
4462+
case "$OS_TARGET" in
4463+
Darwin)
4464+
ICU_TARGET=MacOSX
4465+
;;
4466+
Linux)
4467+
ICU_TARGET=Linux
4468+
;;
4469+
WINNT)
4470+
ICU_TARGET=MSYS/MSVC
4471+
;;
4472+
esac
4473+
4474+
# To reduce library size, use static linking
4475+
ICU_LINK_OPTS="--enable-static --disable-shared"
4476+
# Force the ICU static libraries to be position independent code
4477+
ICU_CFLAGS="$DSO_PIC_CFLAGS"
4478+
ICU_CXXFLAGS="$DSO_PIC_CFLAGS"
4479+
4480+
ICU_BUILD_OPTS=""
4481+
if test -n "$MOZ_DEBUG"; then
4482+
ICU_BUILD_OPTS="$ICU_BUILD_OPTS --enable-debug"
4483+
fi
4484+
if test -z "$MOZ_OPTIMIZE"; then
4485+
ICU_BUILD_OPTS="$ICU_BUILD_OPTS --disable-release"
4486+
fi
4487+
4488+
abs_srcdir=`(cd $srcdir; pwd)`
4489+
mkdir -p $_objdir/intl/icu
4490+
(cd $_objdir/intl/icu; \
4491+
CFLAGS="$ICU_CFLAGS" CPPFLAGS="$ICU_CPPFLAGS" CXXFLAGS="$ICU_CXXFLAGS" \
4492+
$(SHELL) $abs_srcdir/../../intl/icu/source/runConfigureICU \
4493+
$ICU_BUILD_OPTS \
4494+
$ICU_TARGET \
4495+
$ICU_LINK_OPTS \
4496+
--enable-extras=no --enable-icuio=no --enable-layout=no \
4497+
--enable-tests=no --enable-samples=no || exit 1
4498+
) || exit 1
4499+
fi
4500+
4501+
44144502
dnl ========================================================
44154503
dnl JavaScript shell
44164504
dnl ========================================================
@@ -4502,4 +4590,3 @@ if test "$JS_HAS_CTYPES" -a -z "$MOZ_NATIVE_FFI"; then
45024590
ac_configure_args="$_SUBDIR_CONFIG_ARGS"
45034591
CONFIG_FILES=$old_config_files
45044592
fi
4505-

js/src/jsversion.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,4 @@
6464
MOZ_NOT_REACHED("don't call this! to be used in the new object representation")
6565
#endif
6666

67-
/* ECMAScript Internationalization API isn't fully implemented yet. */
68-
#define ENABLE_INTL_API 0
69-
7067
#endif /* jsversion_h___ */

0 commit comments

Comments
 (0)