From ee64e5bdecd0c3405009d93d8bc39c893d489c7d Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Wed, 27 Mar 2019 22:05:04 +0000 Subject: [PATCH] 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 --- build/moz.configure/android-ndk.configure | 13 ++++++------- build/moz.configure/compilers-util.configure | 7 +++++-- .../mozbuild/test/configure/test_compile_checks.py | 4 ++++ 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/build/moz.configure/android-ndk.configure b/build/moz.configure/android-ndk.configure index 9daf59f2e09c..1288540da7d5 100644 --- a/build/moz.configure/android-ndk.configure +++ b/build/moz.configure/android-ndk.configure @@ -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'), ] diff --git a/build/moz.configure/compilers-util.configure b/build/moz.configure/compilers-util.configure index f628bc1b841b..501855c5c841 100644 --- a/build/moz.configure/compilers-util.configure +++ b/build/moz.configure/compilers-util.configure @@ -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) diff --git a/python/mozbuild/mozbuild/test/configure/test_compile_checks.py b/python/mozbuild/mozbuild/test/configure/test_compile_checks.py index b5be3bf2e9f1..618a30bdd868 100644 --- a/python/mozbuild/mozbuild/test/configure/test_compile_checks.py +++ b/python/mozbuild/mozbuild/test/configure/test_compile_checks.py @@ -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')