зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1269517 - Move android_platform to python configure. r=glandium
MozReview-Commit-ID: 30bVQUc8hGb
This commit is contained in:
Родитель
414823b805
Коммит
55afa58b7a
|
@ -11,59 +11,9 @@ MOZ_ARG_WITH_STRING(android-cxx-stl,
|
|||
android_cxx_stl=$withval,
|
||||
android_cxx_stl=libc++)
|
||||
|
||||
define([MIN_ANDROID_VERSION], [9])
|
||||
android_version=MIN_ANDROID_VERSION
|
||||
|
||||
MOZ_ARG_WITH_STRING(android-version,
|
||||
[ --with-android-version=VER
|
||||
android platform version, default] MIN_ANDROID_VERSION,
|
||||
android_version=$withval)
|
||||
|
||||
if test $android_version -lt MIN_ANDROID_VERSION ; then
|
||||
AC_MSG_ERROR([--with-android-version must be at least MIN_ANDROID_VERSION.])
|
||||
fi
|
||||
|
||||
case "$target" in
|
||||
*-android*|*-linuxandroid*)
|
||||
AC_MSG_CHECKING([for android platform directory])
|
||||
|
||||
case "$target_cpu" in
|
||||
arm)
|
||||
target_name=arm
|
||||
;;
|
||||
i?86)
|
||||
target_name=x86
|
||||
;;
|
||||
mipsel)
|
||||
target_name=mips
|
||||
;;
|
||||
esac
|
||||
|
||||
dnl Not all Android releases have their own platform release. We use
|
||||
dnl the next lower platform version in these cases.
|
||||
case $android_version in
|
||||
11|10)
|
||||
android_platform_version=9
|
||||
;;
|
||||
20)
|
||||
android_platform_version=19
|
||||
;;
|
||||
22)
|
||||
android_platform_version=21
|
||||
;;
|
||||
*)
|
||||
android_platform_version=$android_version
|
||||
;;
|
||||
esac
|
||||
|
||||
android_platform="$android_ndk"/platforms/android-"$android_platform_version"/arch-"$target_name"
|
||||
|
||||
if test -d "$android_platform" ; then
|
||||
AC_MSG_RESULT([$android_platform])
|
||||
else
|
||||
AC_MSG_ERROR([not found. Please check your NDK. With the current configuration, it should be in $android_platform])
|
||||
fi
|
||||
|
||||
dnl $android_platform will be set for us by Python configure.
|
||||
CPPFLAGS="-idirafter $android_platform/usr/include $CPPFLAGS"
|
||||
CFLAGS="-fno-short-enums -fno-exceptions $CFLAGS"
|
||||
CXXFLAGS="-fno-short-enums -fno-exceptions $CXXFLAGS"
|
||||
|
|
|
@ -14,6 +14,33 @@ js_option('--with-android-toolchain', nargs=1,
|
|||
js_option('--with-android-gnu-compiler-version', nargs=1,
|
||||
help='GNU compiler version to use')
|
||||
|
||||
@depends('--help')
|
||||
def min_android_version(_):
|
||||
return '9'
|
||||
|
||||
js_option('--with-android-version',
|
||||
nargs=1,
|
||||
help='android platform version',
|
||||
default=min_android_version)
|
||||
|
||||
@depends('--with-android-version', min_android_version)
|
||||
@imports(_from='__builtin__', _import='ValueError')
|
||||
def android_version(value, min_version):
|
||||
if not value:
|
||||
# Someone has passed --without-android-version.
|
||||
die('--with-android-version cannot be disabled.')
|
||||
|
||||
try:
|
||||
version = int(value[0])
|
||||
except ValueError:
|
||||
die('--with-android-version expects an integer value')
|
||||
|
||||
if version < int(min_version):
|
||||
die('--with-android-version must be at least %s (got %s)',
|
||||
min_version, value[0])
|
||||
|
||||
return version
|
||||
|
||||
@depends('--with-android-ndk', build_project)
|
||||
def ndk(value, build_project):
|
||||
if build_project == 'mobile/android' and not value:
|
||||
|
@ -25,6 +52,39 @@ def ndk(value, build_project):
|
|||
set_config('ANDROID_NDK', ndk)
|
||||
add_old_configure_assignment('android_ndk', ndk)
|
||||
|
||||
@depends(target, android_version, ndk)
|
||||
@checking('for android platform directory')
|
||||
def android_platform(target, android_version, ndk):
|
||||
if target.os != 'Android':
|
||||
return
|
||||
|
||||
if 'mips' in target.cpu:
|
||||
target_dir_name = 'mips'
|
||||
else:
|
||||
target_dir_name = target.cpu
|
||||
|
||||
# Not all Android releases have their own platform release. We use
|
||||
# the next lower platform version in these cases.
|
||||
if android_version in (11, 10):
|
||||
platform_version = 9
|
||||
elif android_version in (20, 22):
|
||||
platform_version = android_version - 1
|
||||
else:
|
||||
platform_version = android_version
|
||||
|
||||
platform_dir = os.path.join(ndk,
|
||||
'platforms',
|
||||
'android-%s' % platform_version,
|
||||
'arch-%s' % target_dir_name)
|
||||
|
||||
if not os.path.isdir(platform_dir):
|
||||
die("Android platform directory not found. With the current "
|
||||
"configuration, it should be in %s" % platform_dir)
|
||||
|
||||
return platform_dir
|
||||
|
||||
add_old_configure_assignment('android_platform', android_platform)
|
||||
|
||||
@depends(target, host, ndk, '--with-android-toolchain',
|
||||
'--with-android-gnu-compiler-version')
|
||||
@checking('for the Android toolchain directory', lambda x: x or 'not found')
|
||||
|
|
|
@ -272,7 +272,6 @@ def old_configure_options(*options):
|
|||
'--with-android-max-sdk',
|
||||
'--with-android-min-sdk',
|
||||
'--with-android-sdk',
|
||||
'--with-android-version',
|
||||
'--with-app-basename',
|
||||
'--with-app-name',
|
||||
'--with-arch',
|
||||
|
|
Загрузка…
Ссылка в новой задаче