Bug 1276927: Build B2G with Android build scripts where possible, r=glandium

This patch adds support for configuring Gonk/B2G with Android-specific
build scripts. This removes duplicated code and simplifies maintenance
of B2G.

The B2G builds will now use libc++ for Gecko; instead of the obsolete
STLport. A side-effect of this patch is the removal of any compile-time
dependency on B2G's bionic library.

MozReview-Commit-ID: 7V6BmC7jlrs
This commit is contained in:
Thomas Zimmermann 2016-06-16 08:43:51 +01:00
Родитель 97a43c0b93
Коммит 5d152949dc
5 изменённых файлов: 25 добавлений и 24 удалений

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

@ -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(_):

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

@ -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"

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

@ -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)

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

@ -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)

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

@ -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