Bug 734050 - Build stlport as part of our build process. r=ted
authorMike Hommey <mh+mozilla@glandium.org>
Fri, 23 Mar 2012 17:35:09 +0100
changeset 90165 4934f8f21328c65032e55f86decb6c491a492ee1
parent 90164 ca4a43a9a316100a7fa14c5a23f239c0b7fe73a7
child 90166 68def3ab33b6c65ee705865ec70ab56a0595112e
push idunknown
push userunknown
push dateunknown
reviewersted
bugs734050
milestone14.0a1
Bug 734050 - Build stlport as part of our build process. r=ted
allmakefiles.sh
build/Makefile.in
build/stlport/Makefile.in
build/stlport/stl/config/_android.h.in
config/autoconf.mk.in
configure.in
js/src/configure.in
--- a/allmakefiles.sh
+++ b/allmakefiles.sh
@@ -69,16 +69,22 @@ config/doxygen.cfg
 config/expandlibs_config.py
 config/tests/src-simple/Makefile
 mfbt/Makefile
 probes/Makefile
 extensions/Makefile
 "
 
 if [ ! "$LIBXUL_SDK" ]; then
+  if [ "$STLPORT_SOURCES" ]; then
+    add_makefiles "
+      build/stlport/Makefile
+      build/stlport/stl/config/_android.h
+    "
+  fi
   add_makefiles "
     memory/mozalloc/Makefile
     mozglue/Makefile
     mozglue/build/Makefile
   "
   if [ "$MOZ_MEMORY" ]; then
     add_makefiles "
       memory/jemalloc/Makefile
--- a/build/Makefile.in
+++ b/build/Makefile.in
@@ -48,16 +48,20 @@ MODULE = build
 ifeq (,$(filter WINNT OS2,$(OS_ARCH)))
 DIRS		= unix
 endif
 
 ifeq (WINNT,$(OS_ARCH))
 DIRS = win32
 endif
 
+ifdef STLPORT_SOURCES
+DIRS += stlport
+endif
+
 DIRS += pgo
 
 TEST_DIRS += autoconf/test
 ifeq (android,$(MOZ_WIDGET_TOOLKIT))
 TEST_DIRS += mobile/sutagent/android \
           mobile/sutagent/android/watcher \
           mobile/sutagent/android/ffxcp \
           mobile/sutagent/android/fencp \
new file mode 100644
--- /dev/null
+++ b/build/stlport/Makefile.in
@@ -0,0 +1,30 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this file,
+# You can obtain one at http://mozilla.org/MPL/2.0/.
+
+DEPTH = ../..
+topsrcdir = @top_srcdir@
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+MODULES = stlport
+LIBRARY_NAME = stlport_static
+FORCE_STATIC_LIB = 1
+STL_FLAGS =
+
+# Force to build a static library, instead of a fake library, without
+# installing it in dist/lib.
+LIBRARY = $(LIB_PREFIX)$(LIBRARY_NAME).$(LIB_SUFFIX)
+
+VPATH += $(STLPORT_SOURCES)/src
+
+CPPSRCS = $(notdir $(wildcard $(STLPORT_SOURCES)/src/*.cpp))
+CSRCS = $(notdir $(wildcard $(STLPORT_SOURCES)/src/*.c))
+
+include $(topsrcdir)/config/rules.mk
+
+DEFINES += -D_GNU_SOURCE
+CXXFLAGS += -fuse-cxa-atexit
+INCLUDES += -I$(STLPORT_SOURCES)/stlport
new file mode 100644
--- /dev/null
+++ b/build/stlport/stl/config/_android.h.in
@@ -0,0 +1,23 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+  * You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef mozilla_stl_config__android_h
+#define mozilla_stl_config__android_h
+
+#include "@STLPORT_SOURCES@/stlport/stl/config/_android.h"
+
+// No rtti support
+#undef _STLP_NO_RTTI
+#define _STLP_NO_RTTI 1
+
+// No throwing exceptions
+#undef _STLP_NO_EXCEPTIONS
+#define _STLP_NO_EXCEPTIONS 1
+
+#undef _STLP_NATIVE_CPP_C_HEADER
+#define _STLP_NATIVE_CPP_C_HEADER(header) <../../system/include/header>
+#undef _STLP_NATIVE_CPP_RUNTIME_HEADER
+#define _STLP_NATIVE_CPP_RUNTIME_HEADER(header) <../../system/include/header>
+
+#endif /* mozilla_stl_config__android_h */
--- a/config/autoconf.mk.in
+++ b/config/autoconf.mk.in
@@ -686,16 +686,17 @@ MOZ_APP_COMPONENT_LIBS = @MOZ_APP_COMPON
 MOZ_APP_EXTRA_LIBS = @MOZ_APP_EXTRA_LIBS@
 
 ANDROID_NDK       = @ANDROID_NDK@
 ANDROID_TOOLCHAIN = @ANDROID_TOOLCHAIN@
 ANDROID_PLATFORM  = @ANDROID_PLATFORM@
 ANDROID_SDK       = @ANDROID_SDK@
 ANDROID_PLATFORM_TOOLS = @ANDROID_PLATFORM_TOOLS@
 ANDROID_VERSION   = @ANDROID_VERSION@
+STLPORT_SOURCES   = @STLPORT_SOURCES@
 
 ANDROID_PACKAGE_NAME = @ANDROID_PACKAGE_NAME@
 
 JS_SHARED_LIBRARY = @JS_SHARED_LIBRARY@
 
 MOZ_INSTRUMENT_EVENT_LOOP = @MOZ_INSTRUMENT_EVENT_LOOP@
 
 MOZ_SYSTEM_PLY = @MOZ_SYSTEM_PLY@
--- a/configure.in
+++ b/configure.in
@@ -1611,33 +1611,36 @@ fi
 if test "$OS_TARGET" = "Android" -a -z "$gonkdir"; then
     if test -n "$MOZ_ANDROID_LIBSTDCXX" ; then
        if test ! -e "$android_ndk/sources/cxx-stl/gnu-libstdc++/libs/$ANDROID_CPU_ARCH/libstdc++.a" ; then
           AC_MSG_ERROR([Cannot find path to libstdc++ (NDK version >= 5?)])
        fi
        STLPORT_CPPFLAGS="-I$android_ndk/sources/cxx-stl/gnu-libstdc++/include -I$android_ndk/sources/cxx-stl/gnu-libstdc++/libs/$ANDROID_CPU_ARCH/include -D_GLIBCXX_PERMIT_BACKWARD_HASH"
        STLPORT_LDFLAGS="-L$android_ndk/sources/cxx-stl/gnu-libstdc++/libs/$ANDROID_CPU_ARCH"
        STLPORT_LIBS="-lstdc++"
-    elif test -e "$android_ndk/sources/cxx-stl/stlport/libs/$ANDROID_CPU_ARCH/libstlport_static.a" ; then
-       STLPORT_CPPFLAGS="-I$android_ndk/sources/cxx-stl/stlport/stlport"
-       STLPORT_LDFLAGS="-L$android_ndk/sources/cxx-stl/stlport/libs/$ANDROID_CPU_ARCH/"
+    elif test -e "$android_ndk/sources/cxx-stl/stlport/src/iostream.cpp" ; then
+       STLPORT_SOURCES="$android_ndk/sources/cxx-stl/stlport"
+       STLPORT_CPPFLAGS="-I$_objdir/build/stlport -I$android_ndk/sources/cxx-stl/stlport/stlport"
+       STLPORT_LDFLAGS="-L$_objdir/build/stlport -L$android_ndk/sources/cxx-stl/stlport/libs/$ANDROID_CPU_ARCH/"
        STLPORT_LIBS="-lstlport_static"
     elif  test -e "$android_ndk/tmp/ndk-digit/build/install/sources/cxx-stl/stlport/libs/$ANDROID_CPU_ARCH/libstlport_static.a" ; then
        STLPORT_CPPFLAGS="-I$android_ndk/sources/cxx-stl/stlport/stlport"
        STLPORT_LDFLAGS="-L$android_ndk/tmp/ndk-digit/build/install/sources/cxx-stl/stlport/libs/$ANDROID_CPU_ARCH"
        STLPORT_LIBS="-lstlport_static"
     elif test "$target" != "arm-android-eabi"; then
        dnl fail if we're not building with NDKr4
        AC_MSG_ERROR([Couldn't find path to stlport in the android ndk])
     fi
     CXXFLAGS="$CXXFLAGS $STLPORT_CPPFLAGS"
     LDFLAGS="$LDFLAGS $STLPORT_LDFLAGS"
     LIBS="$LIBS $STLPORT_LIBS"
 fi
 
+AC_SUBST([STLPORT_SOURCES])
+
 dnl ========================================================
 dnl Suppress Clang Argument Warnings
 dnl ========================================================
 if test -n "$CLANG_CC"; then
     _WARNINGS_CFLAGS="-Qunused-arguments ${_WARNINGS_CFLAGS}"
     CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
 fi
 if test -n "$CLANG_CXX"; then
@@ -9100,16 +9103,19 @@ if test "$MOZ_MEMORY"; then
 fi
 if test -n "$MOZ_GLUE_LDFLAGS"; then
    export MOZ_GLUE_LDFLAGS
 fi
 if test -n "$MOZ_GLUE_PROGRAM_LDFLAGS"; then
    export MOZ_GLUE_PROGRAM_LDFLAGS
 fi
 export MOZ_APP_NAME
+export STLPORT_CPPFLAGS
+export STLPORT_LDFLAGS
+export STLPORT_LIBS
 AC_OUTPUT_SUBDIRS(js/src)
 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
 
 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR
 
 dnl Prevent the regeneration of autoconf.mk forcing rebuilds of the world
 dnl Needs to be at the end to respect possible changes from NSPR configure
 if cmp -s config/autoconf.mk config/autoconf.mk.orig; then
--- a/js/src/configure.in
+++ b/js/src/configure.in
@@ -1525,34 +1525,36 @@ if test "$OS_TARGET" = "Android"; then
       ;;
     x86-*)
       ANDROID_CPU_ARCH=x86
       ;;
     esac
 fi
 
 if test "$OS_TARGET" = "Android" -a -z "$gonkdir"; then
-    if test -n "$MOZ_ANDROID_LIBSTDCXX" ; then
-       if test ! -e "$android_ndk/sources/cxx-stl/gnu-libstdc++/libs/$ANDROID_CPU_ARCH/libstdc++.a" ; then
-          AC_MSG_ERROR([Cannot find path to libstdc++ (NDK version >= 5?)])
-       fi
-       STLPORT_CPPFLAGS="-I$android_ndk/sources/cxx-stl/gnu-libstdc++/include -I$android_ndk/sources/cxx-stl/gnu-libstdc++/libs/$ANDROID_CPU_ARCH/include -D_GLIBCXX_PERMIT_BACKWARD_HASH"
-       STLPORT_LDFLAGS="-L$android_ndk/sources/cxx-stl/gnu-libstdc++/libs/$ANDROID_CPU_ARCH"
-       STLPORT_LIBS="-lstdc++"
-    elif test -e "$android_ndk/sources/cxx-stl/stlport/libs/$ANDROID_CPU_ARCH/libstlport_static.a" ; then
-       STLPORT_CPPFLAGS="-I$android_ndk/sources/cxx-stl/stlport/stlport"
-       STLPORT_LDFLAGS="-L$android_ndk/sources/cxx-stl/stlport/libs/$ANDROID_CPU_ARCH/"
-       STLPORT_LIBS="-lstlport_static"
-    elif  test -e "$android_ndk/tmp/ndk-digit/build/install/sources/cxx-stl/stlport/libs/$ANDROID_CPU_ARCH/libstlport_static.a" ; then
-       STLPORT_CPPFLAGS="-I$android_ndk/sources/cxx-stl/stlport/stlport"
-       STLPORT_LDFLAGS="-L$android_ndk/tmp/ndk-digit/build/install/sources/cxx-stl/stlport/libs/$ANDROID_CPU_ARCH"
-       STLPORT_LIBS="-lstlport_static"
-    elif test "$target" != "arm-android-eabi"; then
-       dnl fail if we're not building with NDKr4
-       AC_MSG_ERROR([Couldn't find path to stlport in the android ndk])
+    if test -z "$STLPORT_CPPFLAGS$STLPORT_LDFLAGS$STLPORT_LIBS"; then
+        if test -n "$MOZ_ANDROID_LIBSTDCXX" ; then
+            if test ! -e "$android_ndk/sources/cxx-stl/gnu-libstdc++/libs/$ANDROID_CPU_ARCH/libstdc++.a" ; then
+                AC_MSG_ERROR([Cannot find path to libstdc++ (NDK version >= 5?)])
+            fi
+            STLPORT_CPPFLAGS="-I$android_ndk/sources/cxx-stl/gnu-libstdc++/include -I$android_ndk/sources/cxx-stl/gnu-libstdc++/libs/$ANDROID_CPU_ARCH/include -D_GLIBCXX_PERMIT_BACKWARD_HASH"
+            STLPORT_LDFLAGS="-L$android_ndk/sources/cxx-stl/gnu-libstdc++/libs/$ANDROID_CPU_ARCH"
+            STLPORT_LIBS="-lstdc++"
+        elif test -e "$android_ndk/sources/cxx-stl/stlport/libs/$ANDROID_CPU_ARCH/libstlport_static.a" ; then
+            STLPORT_CPPFLAGS="-I$android_ndk/sources/cxx-stl/stlport/stlport"
+            STLPORT_LDFLAGS="-L$android_ndk/sources/cxx-stl/stlport/libs/$ANDROID_CPU_ARCH/"
+            STLPORT_LIBS="-lstlport_static"
+        elif  test -e "$android_ndk/tmp/ndk-digit/build/install/sources/cxx-stl/stlport/libs/$ANDROID_CPU_ARCH/libstlport_static.a" ; then
+            STLPORT_CPPFLAGS="-I$android_ndk/sources/cxx-stl/stlport/stlport"
+            STLPORT_LDFLAGS="-L$android_ndk/tmp/ndk-digit/build/install/sources/cxx-stl/stlport/libs/$ANDROID_CPU_ARCH"
+            STLPORT_LIBS="-lstlport_static"
+        elif test "$target" != "arm-android-eabi"; then
+            dnl fail if we're not building with NDKr4
+            AC_MSG_ERROR([Couldn't find path to stlport in the android ndk])
+        fi
     fi
     CXXFLAGS="$CXXFLAGS $STLPORT_CPPFLAGS"
     LDFLAGS="$LDFLAGS $STLPORT_LDFLAGS"
     LIBS="$LIBS $STLPORT_LIBS"
 
     # save these for libffi's subconfigure,
     # which doesn't know how to figure this stuff out on its own
     ANDROID_CFLAGS="$CFLAGS"