Bug 724533 - Integrate ICU into the Mozilla build. r=glandium

This commit is contained in:
Norbert Lindenberg 2013-04-13 12:26:06 -04:00
parent 9d2f16a83c
commit 4efc92cff3
3 changed files with 133 additions and 8 deletions

View File

@ -599,13 +599,53 @@ distclean clean::
endif
endif
#############################################
# BEGIN ECMAScript Internationalization API
#
# ICU headers need to be available whether we build with the complete
# Internationalization API or not - ICU stubs rely on them.
LOCAL_INCLUDES += \
-I$(topsrcdir)/../../intl/icu/source/common \
-I$(topsrcdir)/../../intl/icu/source/i18n \
$(NULL)
-I$(topsrcdir)/../../intl/icu/source/common \
-I$(topsrcdir)/../../intl/icu/source/i18n \
$(NULL)
ifdef ENABLE_INTL_API
ifeq ($(OS_ARCH),WINNT)
# Parallel gmake is buggy on Windows
ICU_GMAKE_OPTIONS="-j1"
# Library names: On Windows, ICU uses modified library names for static
# and debug libraries.
ifdef MOZ_DEBUG
ICU_LIB_SUFFIX=d
endif
ICU_LIB_RENAME = $(foreach libname,$(ICU_LIB_NAMES),\
cp -p intl/icu/lib/s$(libname)$(ICU_LIB_SUFFIX).lib intl/icu/lib/$(libname).lib;)
endif
# - Build ICU as part of the "export" target, so things get built
# in the right order.
# - ICU requires GNU make according to its readme.html. pymake can't be used
# because it doesn't support order only dependencies.
# - Force ICU to use the standard suffix for object files because expandlibs
# will discard all files with a non-standard suffix (bug 857450).
# - Options for genrb: -k strict parsing; -R omit collation tailoring rules.
export::
$(GMAKE) $(ICU_GMAKE_OPTIONS) -C intl/icu STATIC_O=$(OBJ_SUFFIX) GENRBOPTS='-k -R'
$(ICU_LIB_RENAME)
distclean clean::
$(call SUBMAKE,$@,intl/icu)
endif
#
# END ECMAScript Internationalization API
#############################################
# The "find any vanilla new/new[] calls" script is tailored to Linux, so
# only run it there. That should be enough to catch any such calls that
@ -734,6 +774,8 @@ ifneq (,$(MOZ_ZLIB_LIBS)$(MOZ_GLUE_LDFLAGS))
DEFINES += -DUSE_ZLIB
endif
SHARED_LIBRARY_LIBS += $(ICU_LIBS)
# Prevent floating point errors caused by VC++ optimizations
ifdef _MSC_VER
# XXX We should add this to CXXFLAGS, too?
@ -1038,4 +1080,3 @@ endif
#
# END kludges for the Nitro assembler
###############################################

View File

@ -4370,14 +4370,102 @@ if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
fi
dnl ========================================================
dnl ECMAScript Internationalization API Support (uses ICU)
dnl ========================================================
MOZ_ARG_ENABLE_BOOL(intl-api,
[ --enable-intl-api Enable ECMAScript Internationalization API],
ENABLE_INTL_API=1 )
dnl Settings for the implementation of the ECMAScript Internationalization API
if test -n "$ENABLE_INTL_API"; then
AC_DEFINE(ENABLE_INTL_API)
# We build ICU as a static library.
AC_DEFINE(U_STATIC_IMPLEMENTATION)
case "$OS_TARGET" in
WINNT)
ICU_LIB_NAMES="icuin icuuc icudt"
;;
Darwin|Linux)
ICU_LIB_NAMES="icui18n icuuc icudata"
;;
*)
AC_MSG_ERROR([ECMAScript Internationalization API is not yet supported on this platform])
esac
ICU_LIBS='$(call EXPAND_LIBNAME_PATH,$(ICU_LIB_NAMES),$(DEPTH)/intl/icu/lib)'
else
ICU_LIB_NAMES=
ICU_LIBS=
fi
AC_SUBST(ENABLE_INTL_API)
AC_SUBST(ICU_LIB_NAMES)
AC_SUBST(ICU_LIBS)
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)
dnl Settings for ICU
if test -n "$ENABLE_INTL_API" ; then
# Set ICU compile options
ICU_CPPFLAGS=""
# don't use icu namespace automatically in client code
ICU_CPPFLAGS="$ICU_CPPFLAGS -DU_USING_ICU_NAMESPACE=0"
# don't include obsolete header files
ICU_CPPFLAGS="$ICU_CPPFLAGS -DU_NO_DEFAULT_INCLUDE_UTF_HEADERS=1"
# remove chunks of the library that we don't need (yet)
ICU_CPPFLAGS="$ICU_CPPFLAGS -DUCONFIG_NO_LEGACY_CONVERSION"
ICU_CPPFLAGS="$ICU_CPPFLAGS -DUCONFIG_NO_TRANSLITERATION"
ICU_CPPFLAGS="$ICU_CPPFLAGS -DUCONFIG_NO_REGULAR_EXPRESSIONS"
ICU_CPPFLAGS="$ICU_CPPFLAGS -DUCONFIG_NO_BREAK_ITERATION"
# Set OS dependent options for ICU
case "$OS_TARGET" in
Darwin)
ICU_TARGET=MacOSX
;;
Linux)
ICU_TARGET=Linux
;;
WINNT)
ICU_TARGET=MSYS/MSVC
;;
esac
# To reduce library size, use static linking
ICU_LINK_OPTS="--enable-static --disable-shared"
# Force the ICU static libraries to be position independent code
ICU_CFLAGS="$DSO_PIC_CFLAGS"
ICU_CXXFLAGS="$DSO_PIC_CFLAGS"
ICU_BUILD_OPTS=""
if test -n "$MOZ_DEBUG"; then
ICU_BUILD_OPTS="$ICU_BUILD_OPTS --enable-debug"
fi
if test -z "$MOZ_OPTIMIZE"; then
ICU_BUILD_OPTS="$ICU_BUILD_OPTS --disable-release"
fi
abs_srcdir=`(cd $srcdir; pwd)`
mkdir -p $_objdir/intl/icu
(cd $_objdir/intl/icu; \
CFLAGS="$ICU_CFLAGS" CPPFLAGS="$ICU_CPPFLAGS" CXXFLAGS="$ICU_CXXFLAGS" \
$(SHELL) $abs_srcdir/../../intl/icu/source/runConfigureICU \
$ICU_BUILD_OPTS \
$ICU_TARGET \
$ICU_LINK_OPTS \
--enable-extras=no --enable-icuio=no --enable-layout=no \
--enable-tests=no --enable-samples=no || exit 1
) || exit 1
fi
dnl ========================================================
dnl JavaScript shell
dnl ========================================================
@ -4469,4 +4557,3 @@ if test "$JS_HAS_CTYPES" -a -z "$MOZ_NATIVE_FFI"; then
ac_configure_args="$_SUBDIR_CONFIG_ARGS"
CONFIG_FILES=$old_config_files
fi

View File

@ -175,7 +175,4 @@
MOZ_NOT_REACHED("don't call this! to be used in the new object representation")
#endif
/* ECMAScript Internationalization API isn't fully implemented yet. */
#define ENABLE_INTL_API 0
#endif /* jsversion_h___ */