Bug 1360291 - Detect NDK version number; r=nalexander

Detect the NDK major/minor version numbers, and feed that to Breakpad.
For AArch64, some Breakpad headers try to workaround NDK oddities by
checking the ANDROID_NDK_MAJOR_VERSION and ANDROID_NDK_MINOR_VERSION
macros.
This commit is contained in:
Jim Chen 2017-05-04 19:19:31 -04:00
parent 5a39ae87ca
commit 055a903128
4 changed files with 47 additions and 0 deletions

View File

@ -57,6 +57,47 @@ def ndk(value, build_project):
set_config('ANDROID_NDK', ndk)
add_old_configure_assignment('android_ndk', ndk)
@depends(ndk)
@checking('for android ndk version')
@imports(_from='__builtin__', _import='open')
def ndk_version(ndk):
if not ndk:
# Building 'js/src' for non-Android.
return
with open(os.path.join(ndk, 'source.properties'), 'r') as f:
for line in f:
if not line.startswith('Pkg.Revision'):
continue
(_, version) = line.split('=')
if version:
return version.strip()
die('Unexpected Pkg.Revision line in source.properties')
die('Cannot determine NDK version from source.properties')
@depends(ndk_version)
def ndk_major_version(ndk_version):
if not ndk_version:
# Building 'js/src' for non-Android.
return
(major, minor, revision) = ndk_version.split('.')
if major:
return major
die('Unexpected NDK version string: ' + ndk_version)
set_config('ANDROID_NDK_MAJOR_VERSION', ndk_major_version);
@depends(ndk_version)
def ndk_minor_version(ndk_version):
if not ndk_version:
# Building 'js/src' for non-Android.
return
(major, minor, revision) = ndk_version.split('.')
if minor:
return minor
die('Unexpected NDK version string: ' + ndk_version)
set_config('ANDROID_NDK_MINOR_VERSION', ndk_minor_version);
@depends(target, android_version, ndk)
@checking('for android platform directory')
@imports(_from='os.path', _import='isdir')

View File

@ -24,6 +24,8 @@ if CONFIG['OS_TARGET'] == 'Linux' or CONFIG['OS_TARGET'] == 'Android':
DEFINES['COMMON_LINUX_GUID_CREATOR_H__'] = 1
if CONFIG['OS_TARGET'] == 'Android':
DEFINES['ANDROID_NDK_MAJOR_VERSION'] = CONFIG['ANDROID_NDK_MAJOR_VERSION']
DEFINES['ANDROID_NDK_MINOR_VERSION'] = CONFIG['ANDROID_NDK_MINOR_VERSION']
LOCAL_INCLUDES += [
'/toolkit/crashreporter/google-breakpad/src/common/android/include',
]

View File

@ -38,6 +38,8 @@ HOST_CXXFLAGS += [
]
if CONFIG['OS_TARGET'] == 'Android':
DEFINES['ANDROID_NDK_MAJOR_VERSION'] = CONFIG['ANDROID_NDK_MAJOR_VERSION']
DEFINES['ANDROID_NDK_MINOR_VERSION'] = CONFIG['ANDROID_NDK_MINOR_VERSION']
LOCAL_INCLUDES += [
'/toolkit/crashreporter/google-breakpad/src/common/android/include',
]

View File

@ -83,6 +83,8 @@ include('/ipc/chromium/chromium-config.mozbuild')
FINAL_LIBRARY = 'xul'
if CONFIG['OS_TARGET'] == 'Android':
DEFINES['ANDROID_NDK_MAJOR_VERSION'] = CONFIG['ANDROID_NDK_MAJOR_VERSION']
DEFINES['ANDROID_NDK_MINOR_VERSION'] = CONFIG['ANDROID_NDK_MINOR_VERSION']
DEFINES['ANDROID_PACKAGE_NAME'] = '"%s"' % CONFIG['ANDROID_PACKAGE_NAME']
# NDK5 workarounds
DEFINES['_STLP_CONST_CONSTRUCTOR_BUG'] = True