diff --git a/b2g/moz.configure b/b2g/moz.configure index 7e6547af8232..297bc55d6b1c 100644 --- a/b2g/moz.configure +++ b/b2g/moz.configure @@ -6,13 +6,11 @@ option('--with-gonk', nargs=1, help='Path to the gonk base directory') -@depends_if('--with-gonk') -def gonkdir(value): +@depends_if('--with-gonk', '--help') +def gonkdir(value, _): return value[0] add_old_configure_assignment('gonkdir', gonkdir) -set_config('ANDROID_NDK', - depends_if(gonkdir)(lambda x: os.path.join(x, 'ndk'))) @depends_if('--with-gonk') def gonk_toolkit(_): diff --git a/build/autoconf/android.m4 b/build/autoconf/android.m4 index 9c2b17b5e535..8e04df47c6e6 100644 --- a/build/autoconf/android.m4 +++ b/build/autoconf/android.m4 @@ -70,7 +70,7 @@ esac AC_DEFUN([MOZ_ANDROID_CPU_ARCH], [ -if test "$OS_TARGET" = "Android" -a -z "$gonkdir"; then +if test "$OS_TARGET" = "Android"; then case "${CPU_ARCH}-${MOZ_ARCH}" in arm-armv7*) ANDROID_CPU_ARCH=armeabi-v7a @@ -93,7 +93,7 @@ fi AC_DEFUN([MOZ_ANDROID_STLPORT], [ -if test "$OS_TARGET" = "Android" -a -z "$gonkdir"; then +if test "$OS_TARGET" = "Android"; then cpu_arch_dir="$ANDROID_CPU_ARCH" if test "$MOZ_THUMB2" = 1; then cpu_arch_dir="$cpu_arch_dir/thumb" diff --git a/build/moz.configure/init.configure b/build/moz.configure/init.configure index ce175e88e076..27e92c03470b 100644 --- a/build/moz.configure/init.configure +++ b/build/moz.configure/init.configure @@ -793,4 +793,14 @@ include('pkg.configure') # Make this assignment here rather than in pkg.configure to avoid # requiring this file in unit tests. add_old_configure_assignment('PKG_CONFIG', pkg_config) + +# Bug 1278542: This function is a workaround to resolve +# |android_ndk_include|'s dependency on 'gonkdir.' The +# actual implementation is located in b2g/moz.configure. +# Remove this function as soon as 'android_ndk_include' +# depends on 'target.' +@depends('--help') +def gonkdir(_): + return None + include(include_project_configure) diff --git a/build/moz.configure/toolchain.configure b/build/moz.configure/toolchain.configure index 70863d5c2ade..da05ad3c7635 100644 --- a/build/moz.configure/toolchain.configure +++ b/build/moz.configure/toolchain.configure @@ -59,9 +59,9 @@ add_old_configure_assignment('YASM', have_yasm) # Android NDK # ============================================================== -@depends('--disable-compile-environment', build_project, '--help') -def android_ndk_include(compile_env, build_project, _): - if compile_env and build_project in ('mobile/android', 'js'): +@depends('--disable-compile-environment', build_project, gonkdir, '--help') +def android_ndk_include(compile_env, build_project, gonkdir, _): + if compile_env and (gonkdir or build_project in ('mobile/android', 'js')): return 'android-ndk.configure' include(android_ndk_include) diff --git a/old-configure.in b/old-configure.in index c5a07c7f593c..80559bb0be73 100644 --- a/old-configure.in +++ b/old-configure.in @@ -95,6 +95,10 @@ DIST="$MOZ_BUILD_ROOT/dist" MOZ_DEFAULT_COMPILER +if test "$COMPILE_ENVIRONMENT"; then + MOZ_ANDROID_NDK +fi # COMPILE_ENVIRONMENT + if test -n "$gonkdir" ; then dnl export for js/src/configure. We can't pass the option down normally, dnl because it's a `--enable-project=b2g`-only option. @@ -108,11 +112,6 @@ if test -n "$gonkdir" ; then ANDROID_VERSION="${PLATFORM_SDK_VERSION}" fi - if ! test -e "$gonkdir/ndk/sources/cxx-stl/stlport/src/iostream.cpp"; then - AC_MSG_ERROR([Couldn't find path to stlport sources in the gonk tree]) - fi - STLPORT_CPPFLAGS="-I$_topsrcdir/build/stlport/stlport -I$gonkdir/ndk/sources/cxx-stl/system/include" - case "$ANDROID_VERSION" in 15) GONK_INCLUDES="-I$gonkdir/frameworks/base/opengl/include -I$gonkdir/frameworks/base/native/include -I$gonkdir/frameworks/base/include -I$gonkdir/frameworks/base/services/camera -I$gonkdir/frameworks/base/include/media/ -I$gonkdir/frameworks/base/include/media/stagefright -I$gonkdir/frameworks/base/include/media/stagefright/openmax -I$gonkdir/frameworks/base/media/libstagefright/rtsp -I$gonkdir/frameworks/base/media/libstagefright/include -I$gonkdir/external/dbus -I$gonkdir/external/bluetooth/bluez/lib -I$gonkdir/dalvik/libnativehelper/include/nativehelper" @@ -183,26 +182,20 @@ if test -n "$gonkdir" ; then AC_MSG_ERROR([Unsupported platform version: $ANDROID_VERSION]) ;; esac - CPPFLAGS="-DANDROID $TARGET_C_INCLUDES -I$gonkdir/system -I$gonkdir/system/core/include -isystem $gonkdir/bionic -I$gonkdir/hardware/libhardware/include -I$gonkdir/external/valgrind/fxos-include $GONK_INCLUDES $CPPFLAGS" - CFLAGS="-fno-short-enums -fno-exceptions $CFLAGS" - CXXFLAGS="-fno-short-enums -fno-exceptions $CXXFLAGS $STLPORT_CPPFLAGS" + + CPPFLAGS="-I$gonkdir/system -I$gonkdir/system/core/include -I$gonkdir/hardware/libhardware/include -I$gonkdir/external/valgrind/fxos-include $GONK_INCLUDES $CPPFLAGS" + LDFLAGS="-L$gonkdir/out/target/product/$GONK_PRODUCT/obj/lib -Wl,-rpath-link=$gonkdir/out/target/product/$GONK_PRODUCT/obj/lib $LDFLAGS" dnl Add -llog by default, since we use it all over the place. LIBS="$LIBS -llog" - LDFLAGS="-L$gonkdir/out/target/product/$GONK_PRODUCT/obj/lib -Wl,-rpath-link=$gonkdir/out/target/product/$GONK_PRODUCT/obj/lib --sysroot=$gonkdir/out/target/product/$GONK_PRODUCT/obj/ $LDFLAGS" - AC_DEFINE(ANDROID) AC_DEFINE_UNQUOTED(ANDROID_VERSION, $ANDROID_VERSION) AC_SUBST(ANDROID_VERSION) AC_DEFINE(HAVE_SYS_UIO_H) AC_DEFINE(HAVE_PTHREADS) direct_nspr_config=1 - android_cxx_stl=mozstlport -else - if test "$COMPILE_ENVIRONMENT"; then - MOZ_ANDROID_NDK - fi # COMPILE_ENVIRONMENT +else case "$target" in *-android*|*-linuxandroid*) ZLIB_DIR=yes