Bug 1536529 - Re-factor variables for android runtimes in build-clang.py r=glandium
authorChris Manchester <cmanchester@mozilla.com>
Thu, 28 Mar 2019 00:28:03 +0000
changeset 466482 2b0b4377cc2bf358d49240bdf0b776276c760849
parent 466481 14cc1eeac1e1107e1779d3804d40211ef0bade6d
child 466483 7d40ca9aee44642578636744d9f44d298031ff8c
push id35768
push useropoprus@mozilla.com
push dateThu, 28 Mar 2019 09:55:54 +0000
treeherdermozilla-central@c045dd97faf2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs1536529
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1536529 - Re-factor variables for android runtimes in build-clang.py r=glandium Differential Revision: https://phabricator.services.mozilla.com/D24435
build/build-clang/build-clang.py
--- a/build/build-clang/build-clang.py
+++ b/build/build-clang/build-clang.py
@@ -292,40 +292,38 @@ def build_one_stage(cc, cxx, asm, ld, ar
 
             # Our flags go last to override any --gcc-toolchain that may have
             # been set earlier.
             rt_c_flags = " ".join(cc[1:] + android_flags)
             rt_cxx_flags = " ".join(cxx[1:] + android_flags)
             rt_asm_flags = " ".join(asm[1:] + android_flags)
 
             cmake_args += [
-                "-DBUILTINS_%s_ANDROID=1" % target,
-                "-DBUILTINS_%s_CMAKE_ASM_FLAGS=%s" % (target, rt_asm_flags),
-                "-DBUILTINS_%s_CMAKE_CXX_FLAGS=%s" % (target, rt_cxx_flags),
-                "-DBUILTINS_%s_CMAKE_C_FLAGS=%s" % (target, rt_c_flags),
-                "-DBUILTINS_%s_CMAKE_EXE_LINKER_FLAGS=%s" % (target, android_link_flags),
-                "-DBUILTINS_%s_CMAKE_SHARED_LINKER_FLAGS=%s" % (target, android_link_flags),
-                "-DBUILTINS_%s_CMAKE_SYSROOT=%s" % (target, sysroot_dir),
-                "-DRUNTIMES_%s_ANDROID=1" % target,
-                "-DRUNTIMES_%s_CMAKE_ASM_FLAGS=%s" % (target, rt_asm_flags),
-                "-DRUNTIMES_%s_CMAKE_CXX_FLAGS=%s" % (target, rt_cxx_flags),
-                "-DRUNTIMES_%s_CMAKE_C_FLAGS=%s" % (target, rt_c_flags),
-                "-DRUNTIMES_%s_CMAKE_EXE_LINKER_FLAGS=%s" % (target, android_link_flags),
-                "-DRUNTIMES_%s_CMAKE_SHARED_LINKER_FLAGS=%s" % (target, android_link_flags),
-                "-DRUNTIMES_%s_CMAKE_SYSROOT=%s" % (target, sysroot_dir),
                 "-DRUNTIMES_%s_COMPILER_RT_BUILD_PROFILE=ON" % target,
                 "-DRUNTIMES_%s_COMPILER_RT_BUILD_SANITIZERS=ON" % target,
                 "-DRUNTIMES_%s_SANITIZER_ALLOW_CXXABI=OFF" % target,
                 "-DRUNTIMES_%s_COMPILER_RT_BUILD_LIBFUZZER=OFF" % target,
                 "-DRUNTIMES_%s_COMPILER_RT_INCLUDE_TESTS=OFF" % target,
                 "-DRUNTIMES_%s_LLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF" % target,
                 "-DRUNTIMES_%s_LLVM_INCLUDE_TESTS=OFF" % target,
-                "-DRUNTIMES_%s_ANDROID_NATIVE_API_LEVEL=%s" % (target, api_level),
             ]
 
+            for kind in ('BUILTINS', 'RUNTIMES'):
+                for var, arg in (
+                        ('ANDROID', '1'),
+                        ('CMAKE_ASM_FLAGS', rt_asm_flags),
+                        ('CMAKE_CXX_FLAGS', rt_cxx_flags),
+                        ('CMAKE_C_FLAGS', rt_c_flags),
+                        ('CMAKE_EXE_LINKER_FLAGS', android_link_flags),
+                        ('CMAKE_SHARED_LINKER_FLAGS', android_link_flags),
+                        ('CMAKE_SYSROOT', sysroot_dir),
+                        ('ANDROID_NATIVE_API_LEVEL', api_level),
+                ):
+                    cmake_args += ['-D%s_%s_%s=%s' % (kind, target, var, arg)]
+
     cmake_args += cmake_base_args(
         cc, cxx, asm, ld, ar, ranlib, libtool, inst_dir)
     cmake_args += [
         src_dir
     ]
     build_package(build_dir, cmake_args)
 
     if is_linux():