зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1397764 - Part 2. Generate BINDGEN_CFLAGS for Android. r=chmanchester
Building Fennec/Android uses cross compiler toolchain. So we have to generate clang options (include path for c++ headers and gcc headers, gcc-toolchain path and etc) from NDK path for bindgen. The following options are required for android build. (from stlport_cppflags) -I$topsrcdir/android-ndk/sources/cxx-stl/llvm-libc++/libcxx/include -I$topsrcdir/android-ndk/sources/android/support/include -I$topsrcdir/android-ndk/sources/cxx-stl/llvm-libc++abi/libcxxabi/include" (others for clang) -isystem $topsrcdir/android-ndk/platforms/android-9/arch-arm/usr/include -gcc-toolchain $topsrcdir/android-ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64 -I$topsrcdir/android-ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9/include -I$topsrcdir/android-ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9/include-fixed" Also, since bindgen_cflags_defaults uses as default, some funcions requires '--help'. MozReview-Commit-ID: 7zfhw3IxQ2W --HG-- extra : rebase_source : 0ede4f0d1ec212cfe411f6abe0f55f4b0c70643d
This commit is contained in:
Родитель
6a7100fa7b
Коммит
8ab65ab25c
|
@ -23,9 +23,9 @@ js_option('--with-android-version',
|
|||
help='android platform version',
|
||||
default=min_android_version)
|
||||
|
||||
@depends('--with-android-version', min_android_version)
|
||||
@depends('--with-android-version', min_android_version, '--help')
|
||||
@imports(_from='__builtin__', _import='ValueError')
|
||||
def android_version(value, min_version):
|
||||
def android_version(value, min_version, _):
|
||||
if not value:
|
||||
# Someone has passed --without-android-version.
|
||||
die('--with-android-version cannot be disabled.')
|
||||
|
@ -43,8 +43,10 @@ def android_version(value, min_version):
|
|||
|
||||
add_old_configure_assignment('android_version', android_version)
|
||||
|
||||
@depends('--with-android-ndk', build_project)
|
||||
def ndk(value, build_project):
|
||||
@depends('--with-android-ndk', build_project, '--help')
|
||||
def ndk(value, build_project, help):
|
||||
if help:
|
||||
return
|
||||
if build_project == 'mobile/android' and not value:
|
||||
die('You must specify --with-android-ndk=/path/to/ndk when '
|
||||
'building mobile/android')
|
||||
|
@ -95,10 +97,10 @@ def ndk_minor_version(ndk_version):
|
|||
|
||||
set_config('ANDROID_NDK_MINOR_VERSION', ndk_minor_version);
|
||||
|
||||
@depends(target, android_version, ndk)
|
||||
@depends(target, android_version, ndk, '--help')
|
||||
@checking('for android platform directory')
|
||||
@imports(_from='os.path', _import='isdir')
|
||||
def android_platform(target, android_version, ndk):
|
||||
def android_platform(target, android_version, ndk, _):
|
||||
if target.os != 'Android':
|
||||
return
|
||||
|
||||
|
@ -138,11 +140,11 @@ def extra_toolchain_flags(platform_dir):
|
|||
return ['-idirafter',
|
||||
os.path.join(platform_dir, 'usr', 'include')]
|
||||
|
||||
@depends(target, host, ndk, '--with-android-toolchain')
|
||||
@depends(target, host, ndk, '--with-android-toolchain', '--help')
|
||||
@checking('for the Android toolchain directory', lambda x: x or 'not found')
|
||||
@imports(_from='os.path', _import='isdir')
|
||||
@imports(_from='mozbuild.shellutil', _import='quote')
|
||||
def android_toolchain(target, host, ndk, toolchain):
|
||||
def android_toolchain(target, host, ndk, toolchain, _):
|
||||
if not ndk:
|
||||
return
|
||||
if toolchain:
|
||||
|
@ -175,14 +177,18 @@ def android_toolchain(target, host, ndk, toolchain):
|
|||
|
||||
set_config('ANDROID_TOOLCHAIN', android_toolchain)
|
||||
|
||||
@depends(target, android_toolchain)
|
||||
def android_toolchain_prefix(target, toolchain):
|
||||
@depends(target)
|
||||
def android_toolchain_prefix_base(target):
|
||||
if target.cpu == 'x86':
|
||||
# Ideally, the --target should just have the right x86 variant
|
||||
# in the first place.
|
||||
return 'i686-linux-android'
|
||||
return target.toolchain
|
||||
|
||||
@depends(android_toolchain_prefix_base, android_toolchain)
|
||||
def android_toolchain_prefix(prefix_base, toolchain):
|
||||
if toolchain:
|
||||
if target.cpu == 'x86':
|
||||
# Ideally, the --target should just have the right x86 variant
|
||||
# in the first place.
|
||||
return '%s/bin/i686-linux-android-' % toolchain
|
||||
return '%s/bin/%s-' % (toolchain, target.toolchain)
|
||||
return '%s/bin/%s-' % (toolchain, prefix_base)
|
||||
|
||||
imply_option('--with-toolchain-prefix', android_toolchain_prefix,
|
||||
reason='--with-android-ndk')
|
||||
|
@ -191,9 +197,9 @@ option(env='STLPORT_CPPFLAGS',
|
|||
nargs=1,
|
||||
help='Options compiler should pass for standard C++ library')
|
||||
|
||||
@depends('STLPORT_CPPFLAGS', ndk)
|
||||
@depends('STLPORT_CPPFLAGS', ndk, '--help')
|
||||
@imports(_from='os.path', _import='isdir')
|
||||
def stlport_cppflags(value, ndk):
|
||||
def stlport_cppflags(value, ndk, _):
|
||||
if value and len(value):
|
||||
return value
|
||||
if not ndk:
|
||||
|
@ -226,3 +232,19 @@ def stlport_cppflags(value, ndk):
|
|||
cxxabi_include)
|
||||
|
||||
add_old_configure_assignment('stlport_cppflags', stlport_cppflags)
|
||||
|
||||
@depends(stlport_cppflags, android_platform, android_toolchain,
|
||||
android_toolchain_prefix_base, '--help')
|
||||
def bindgen_cflags_defaults(stlport_cppflags, android_platform, toolchain,
|
||||
toolchain_prefix, _):
|
||||
if not stlport_cppflags:
|
||||
return
|
||||
|
||||
gcc_include = os.path.join(toolchain, 'lib', 'gcc', toolchain_prefix, '4.9')
|
||||
|
||||
cflags_format = "%s -isystem %s -gcc-toolchain %s -I%s -I%s"
|
||||
return cflags_format % (stlport_cppflags,
|
||||
os.path.join(android_platform, 'usr', 'include'),
|
||||
toolchain,
|
||||
os.path.join(gcc_include, 'include'),
|
||||
os.path.join(gcc_include, 'include-fixed'))
|
||||
|
|
|
@ -968,6 +968,7 @@ def check_have_64_bit(have_64_bit, compiler_have_64_bit):
|
|||
|
||||
option(env='BINDGEN_CFLAGS',
|
||||
nargs=1,
|
||||
default=bindgen_cflags_defaults,
|
||||
help='Options bindgen should pass to the C/C++ parser')
|
||||
|
||||
@depends('BINDGEN_CFLAGS')
|
||||
|
|
Загрузка…
Ссылка в новой задаче