Bug 912371 - Cross compile support for ICU. r=glandium

--HG--
rename : build/autoconf/codeset.m4 => js/src/build/autoconf/codeset.m4
This commit is contained in:
Makoto Kato 2013-11-28 14:49:10 +09:00
Родитель 75fe3d1f2f
Коммит 4b25f5dfda
4 изменённых файлов: 174 добавлений и 38 удалений

Просмотреть файл

@ -238,7 +238,7 @@ ifeq ($(OS_ARCH),WINNT)
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;)
cp -p intl/icu/target/lib/s$(libname)$(ICU_LIB_SUFFIX).lib intl/icu/target/lib/$(libname).lib;)
endif
ifdef .PYMAKE
@ -254,11 +254,17 @@ endif
# - Options for genrb: -k strict parsing; -R omit collation tailoring rules.
buildicu:
# ICU's build system is full of races, so force non-parallel build.
+$(ICU_MAKE) -j1 -C intl/icu STATIC_O=$(OBJ_SUFFIX) GENRBOPTS='-k -R'
ifdef CROSS_COMPILE
+$(ICU_MAKE) -j1 -C intl/icu/host STATIC_O=$(OBJ_SUFFIX) GENRBOPTS='-k -R -C'
endif
+$(ICU_MAKE) -j1 -C intl/icu/target STATIC_O=$(OBJ_SUFFIX) GENRBOPTS='-k -R'
$(ICU_LIB_RENAME)
distclean clean::
$(call SUBMAKE,$@,intl/icu)
ifdef CROSS_COMPILE
$(call SUBMAKE,$@,intl/icu/host)
endif
$(call SUBMAKE,$@,intl/icu/target)
endif
endif

1
js/src/aclocal.m4 поставляемый
Просмотреть файл

@ -11,6 +11,7 @@ builtin(include, build/autoconf/ccache.m4)dnl
builtin(include, build/autoconf/wrapper.m4)dnl
builtin(include, build/autoconf/pkg.m4)dnl
builtin(include, build/autoconf/nspr.m4)dnl
builtin(include, build/autoconf/codeset.m4)dnl
builtin(include, build/autoconf/altoptions.m4)dnl
builtin(include, build/autoconf/mozprog.m4)dnl
builtin(include, build/autoconf/mozheader.m4)dnl

Просмотреть файл

@ -0,0 +1,24 @@
# codeset.m4 serial AM1 (gettext-0.10.40)
dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
dnl This file is free software, distributed under the terms of the GNU
dnl General Public License. As a special exception to the GNU General
dnl Public License, this file may be distributed as part of a program
dnl that contains a configuration script generated by Autoconf, under
dnl the same distribution terms as the rest of that program.
dnl From Bruno Haible.
AC_DEFUN([AM_LANGINFO_CODESET],
[
AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
[AC_TRY_LINK([#include <langinfo.h>],
[char* cs = nl_langinfo(CODESET);],
am_cv_langinfo_codeset=yes,
am_cv_langinfo_codeset=no)
])
if test $am_cv_langinfo_codeset = yes; then
AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
[Define if you have <langinfo.h> and nl_langinfo(CODESET).])
HAVE_LANGINFO_CODESET=1
fi
])

Просмотреть файл

@ -2570,6 +2570,8 @@ dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
fi
AM_LANGINFO_CODESET
AC_LANG_C
dnl **********************
@ -4197,7 +4199,7 @@ if test -n "$ENABLE_INTL_API"; then
*)
AC_MSG_ERROR([ECMAScript Internationalization API is not yet supported on this platform])
esac
MOZ_ICU_LIBS='$(call EXPAND_LIBNAME_PATH,$(ICU_LIB_NAMES),$(DEPTH)/intl/icu/lib)'
MOZ_ICU_LIBS='$(call EXPAND_LIBNAME_PATH,$(ICU_LIB_NAMES),$(DEPTH)/intl/icu/target/lib)'
fi
fi
@ -4227,33 +4229,99 @@ if test -n "$ENABLE_INTL_API" -a -z "$MOZ_NATIVE_ICU"; then
ICU_CPPFLAGS="$ICU_CPPFLAGS -DUCONFIG_NO_REGULAR_EXPRESSIONS"
ICU_CPPFLAGS="$ICU_CPPFLAGS -DUCONFIG_NO_BREAK_ITERATION"
ICU_CROSS_BUILD_OPT=""
ICU_SRCDIR=""
# Set OS dependent options for ICU
case "$OS_TARGET" in
Darwin)
ICU_TARGET=MacOSX
;;
Linux)
ICU_TARGET=Linux
;;
WINNT)
ICU_TARGET=MSYS/MSVC
ICU_SRCDIR="--srcdir=$(cd $srcdir/../../intl/icu/source; pwd -W)"
;;
DragonFly|FreeBSD|NetBSD|OpenBSD)
ICU_TARGET=BSD
;;
esac
if test "$HOST_OS_ARCH" = "WINNT"; then
ICU_SRCDIR="--srcdir=$(cd $srcdir/../../intl/icu/source; pwd -W)"
fi
if test "$CROSS_COMPILE"; then
# Building host tools. It is necessary to build target binary.
case "$HOST_OS_ARCH" in
Darwin)
ICU_TARGET=MacOSX
;;
Linux)
ICU_TARGET=Linux
;;
WINNT)
ICU_TARGET=MSYS/MSVC
;;
*bsd*|dragonfly*)
ICU_TARGET=BSD
;;
esac
# Remove _DEPEND_CFLAGS from HOST_FLAGS to avoid configure error
HOST_ICU_CFLAGS="$HOST_CFLAGS"
HOST_ICU_CXXFLAGS="$HOST_CXXFLAGS"
HOST_ICU_CFLAGS=`echo $HOST_ICU_CFLAGS | sed "s|$_DEPEND_CFLAGS||g"`
HOST_ICU_CXXFLAGS=`echo $HOST_ICU_CFXXLAGS | sed "s|$_DEPEND_CFLAGS||g"`
# ICU requires RTTI
if test "$GNU_CC"; then
HOST_ICU_CXXFLAGS=`echo $HOST_ICU_CXXFLAGS | sed 's|-fno-rtti|-frtti|g'`
elif test "$_MSC_VER"; then
HOST_ICU_CXXFLAGS=`echo $HOST_ICU_CXXFLAGS | sed 's|-GR-|-GR|g'`
fi
HOST_ICU_BUILD_OPTS=""
if test -n "$MOZ_DEBUG"; then
HOST_ICU_BUILD_OPTS="$HOST_ICU_BUILD_OPTS --enable-debug"
fi
abs_srcdir=`(cd $srcdir; pwd)`
mkdir -p $_objdir/intl/icu/host
(cd $_objdir/intl/icu/host
MOZ_SUBCONFIGURE_WRAP([.],[
CC="$HOST_CC" CXX="$HOST_CXX" LD="$HOST_LD" \
CFLAGS="$HOST_ICU_CFLAGS $HOST_OPTIMIZE_FLAGS" \
CPPFLAGS="$ICU_CPPFLAGS" \
CXXFLAGS="$HOST_ICU_CXXFLAGS $HOST_OPTIMZIE_FLAGS" \
$SHELL $abs_srcdir/../../intl/icu/source/runConfigureICU \
$HOST_ICU_BUILD_OPTS \
$ICU_TARGET \
dnl Shell quoting is fun.
${ICU_SRCDIR+"$ICU_SRCDIR"} \
--enable-static --disable-shared \
--enable-extras=no --enable-icuio=no --enable-layout=no \
--enable-tests=no --enable-samples=no || exit 1
])
) || exit 1
# generate config/icucross.mk
$GMAKE -C $_objdir/intl/icu/host/ config/icucross.mk
# --with-cross-build requires absolute path
ICU_HOST_PATH=`cd $_objdir/intl/icu/host && pwd`
ICU_CROSS_BUILD_OPT="--with-cross-build=$ICU_HOST_PATH"
ICU_TARGET_OPT="--build=$build --host=$target"
else
# CROSS_COMPILE isn't set build and target are i386 and x86-64.
# So we must set target for --build and --host.
ICU_TARGET_OPT="--build=$target --host=$target"
fi
# 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_CFLAGS="$DSO_PIC_CFLAGS $CFLAGS"
ICU_CXXFLAGS="$DSO_PIC_CFLAGS $CXXFLAGS"
ICU_BUILD_OPTS=""
if test -n "$MOZ_DEBUG"; then
ICU_BUILD_OPTS="$ICU_BUILD_OPTS --enable-debug"
if test -n "$MOZ_DEBUG" -o "MOZ_DEBUG_SYMBOLS"; then
ICU_CFLAGS="$ICU_CFLAGS $MOZ_DEBUG_FLAGS"
ICU_CXXFLAGS="$ICU_CXXFLAGS $MOZ_DEBUG_FLAGS"
ICU_LDFLAGS="$MOZ_DEBUG_LDFLAGS"
if test -z "$MOZ_DEBUG"; then
# To generate debug symbols, it requires MOZ_DEBUG_FLAGS.
# But, not debug build.
ICU_CFLAGS="$ICU_CFLAGS -UDEBUG -DNDEBUG"
ICU_CXXFLAGS="$ICU_CXXFLAGS -UDEBUG -DNDEBUG"
else
ICU_BUILD_OPTS="$ICU_BUILD_OPTS --enable-debug"
fi
fi
if test -z "$MOZ_OPTIMIZE"; then
ICU_BUILD_OPTS="$ICU_BUILD_OPTS --disable-release"
@ -4262,21 +4330,58 @@ if test -n "$ENABLE_INTL_API" -a -z "$MOZ_NATIVE_ICU"; then
ICU_CXXFLAGS="$ICU_CXXFLAGS $MOZ_OPTIMIZE_FLAGS"
fi
abs_srcdir=`(cd $srcdir; pwd)`
mkdir -p $_objdir/intl/icu
(cd $_objdir/intl/icu
if test "$am_cv_langinfo_codeset" = "no"; then
# ex. Android
ICU_CPPFLAGS="$ICU_CPPFLAGS -DU_HAVE_NL_LANGINFO_CODESET=0"
fi
# ICU requires RTTI
if test "$GNU_CC"; then
ICU_CXXFLAGS=`echo $ICU_CXXFLAGS | sed 's|-fno-rtti|-frtti|g'`
else
if test "$_MSC_VER"; then
ICU_CXXFLAGS=`echo $ICU_CXXFLAGS | sed 's|-GR-|-GR|g'`
fi
# Add RTL flags for MSVCRT.DLL
if test -n "$MOZ_DEBUG"; then
ICU_CFLAGS="$ICU_CFLAGS -MDd"
ICU_CXXFLAGS="$ICU_CXXFLAGS -MDd"
else
ICU_CFLAGS="$ICU_CFLAGS -MD"
ICU_CXXFLAGS="$ICU_CXXFLAGS -MD"
fi
# add disable optimize flag for workaround for bug 899948
if test -z "$MOZ_OPTIMIZE"; then
ICU_CFLAGS="$ICU_CFLAGS -Od"
ICU_CXXFLAGS="$ICU_CXXFLAGS -Od"
fi
fi
# We cannot use AC_OUTPUT_SUBDIRS since ICU tree is out of spidermonkey.
# When using AC_OUTPUT_SUBDIRS, objdir of ICU is out of objdir
# due to relative path.
# If building ICU moves into root of mozilla tree, we can use
# AC_OUTPUT_SUBDIR instead.
mkdir -p $_objdir/intl/icu/target
(cd $_objdir/intl/icu/target
MOZ_SUBCONFIGURE_WRAP([.],[
CC="$CC" CXX="$CXX" \
CFLAGS="$ICU_CFLAGS" CPPFLAGS="$ICU_CPPFLAGS" CXXFLAGS="$ICU_CXXFLAGS" \
$SHELL $abs_srcdir/../../intl/icu/source/runConfigureICU \
$ICU_BUILD_OPTS \
$ICU_TARGET \
$ICU_LINK_OPTS \
dnl Shell quoting is fun.
${ICU_SRCDIR+"$ICU_SRCDIR"} \
--enable-extras=no --enable-icuio=no --enable-layout=no \
--enable-tests=no --enable-samples=no || exit 1
])
AR="$AR" CC="$CC" CXX="$CXX" LD="$LD" \
ARFLAGS="$ARFLAGS" \
CPPFLAGS="$ICU_CPPFLAGS $CPPFLAGS" \
CFLAGS="$ICU_CFLAGS" \
CXXFLAGS="$ICU_CXXFLAGS" \
LDFLAGS="$ICU_LDFLAGS $LDFLAGS" \
$SHELL $_topsrcdir/../../intl/icu/source/configure \
$ICU_BUILD_OPTS \
$ICU_CROSS_BUILD_OPT \
$ICU_LINK_OPTS \
${ICU_SRCDIR+"$ICU_SRCDIR"} \
$ICU_TARGET_OPT \
--disable-extras --disable-icuio --disable-layout \
--disable-tests --disable-samples || exit 1
])
) || exit 1
fi