Bug 1510897 - Separate Android C++ flags from the other Android toolchain flags. r=nalexander

We shouldn't pass those flags when building C. It doesn't matter /too/
much currently, but will in a subsequent change, which will introduce
a C++-only flag in stlport_cppflags.

Differential Revision: https://phabricator.services.mozilla.com/D25018

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Mike Hommey 2019-03-27 22:05:04 +00:00
parent abc25163d3
commit ee64e5bdec
3 changed files with 15 additions and 9 deletions

View File

@ -286,10 +286,9 @@ def stlport_cppflags(value, ndk):
add_old_configure_assignment('stlport_cppflags', stlport_cppflags)
@depends(android_system, android_sysroot, android_toolchain, android_version,
stlport_cppflags)
@depends(android_system, android_sysroot, android_toolchain, android_version)
def extra_toolchain_flags(android_system, android_sysroot, toolchain_dir,
android_version, stlport_cppflags):
android_version):
if not android_sysroot:
return []
flags = ['-isystem',
@ -299,7 +298,6 @@ def extra_toolchain_flags(android_system, android_sysroot, toolchain_dir,
'-gcc-toolchain',
toolchain_dir,
'-D__ANDROID_API__=%d' % android_version]
flags.extend(stlport_cppflags if stlport_cppflags else [])
return flags
@ -313,10 +311,11 @@ imply_option('--with-toolchain-prefix', android_toolchain_prefix,
reason='--with-android-ndk')
@depends(extra_toolchain_flags, android_toolchain,
@depends(extra_toolchain_flags, stlport_cppflags, android_toolchain,
android_toolchain_prefix_base)
@imports(_from='os.path', _import='isdir')
def bindgen_cflags_android(toolchain_flags, toolchain, toolchain_prefix):
def bindgen_cflags_android(toolchain_flags, stlport_flags, toolchain,
toolchain_prefix):
if not toolchain_flags:
return
@ -326,7 +325,7 @@ def bindgen_cflags_android(toolchain_flags, toolchain, toolchain_prefix):
gcc_include = os.path.join(
toolchain, 'lib', 'gcc', toolchain_prefix, '4.9')
return toolchain_flags + [
return toolchain_flags + stlport_flags + [
'-I%s' % os.path.join(gcc_include, 'include'),
'-I%s' % os.path.join(gcc_include, 'include-fixed'),
]

View File

@ -71,12 +71,15 @@ def compiler_class(compiler, host_or_target):
def checking_fn(fn):
return fn
@depends(self, dependable(flags), extra_toolchain_flags, dependable(header), when=when)
@depends(self, dependable(flags), extra_toolchain_flags,
stlport_cppflags, dependable(header), when=when)
@checking_fn
def func(compiler, flags, extra_flags, header):
def func(compiler, flags, extra_flags, stlport_flags, header):
flags = list(flags or [])
if is_target:
flags += extra_flags or []
if compiler.language == 'C++':
flags += stlport_flags or []
header = header or ''
if isinstance(header, (list, tuple)):
header = '\n'.join(header)

View File

@ -51,6 +51,10 @@ class BaseCompileChecks(unittest.TestCase):
def extra_toolchain_flags():
return []
@depends(when=True)
def stlport_cppflags():
return []
target = depends(when=True)(lambda: True)
include('%s/compilers-util.configure')