Move gn goma setup to gcc_toolchain R=jamesr@chromium.org Review URL: https://codereview.chromium.org/1373923004 .
diff --git a/build/toolchain/android/BUILD.gn b/build/toolchain/android/BUILD.gn index f7f47ff..24c9c29 100644 --- a/build/toolchain/android/BUILD.gn +++ b/build/toolchain/android/BUILD.gn
@@ -3,9 +3,7 @@ # found in the LICENSE file. import("//build/config/sysroot.gni") # Imports android/config.gni. -import("//build/toolchain/ccache.gni") import("//build/toolchain/clang.gni") -import("//build/toolchain/goma.gni") import("//build/toolchain/gcc_toolchain.gni") # The Android GCC toolchains share most of the same parameters, so we have this @@ -36,21 +34,12 @@ # The tools should be run relative to the build dir. tool_prefix = rebase_path(invoker.tool_prefix, root_build_dir) - if (use_goma) { - assert(!use_ccache, "Goma and ccache can't be used together.") - compiler_prefix = "$goma_dir/gomacc " - } else if (use_ccache) { - compiler_prefix = "ccache " - } else { - compiler_prefix = "" - } - - cc = compiler_prefix + tool_prefix + "gcc" - cxx = compiler_prefix + tool_prefix + "g++" + cc = tool_prefix + "gcc" + cxx = tool_prefix + "g++" ar = tool_prefix + "ar" ld = cxx - readelf = compiler_prefix + tool_prefix + "readelf" - nm = compiler_prefix + tool_prefix + "nm" + readelf = tool_prefix + "readelf" + nm = tool_prefix + "nm" toolchain_os = "android" toolchain_cpu = invoker.toolchain_cpu
diff --git a/build/toolchain/cros/BUILD.gn b/build/toolchain/cros/BUILD.gn index 140958b..9174161 100644 --- a/build/toolchain/cros/BUILD.gn +++ b/build/toolchain/cros/BUILD.gn
@@ -32,4 +32,6 @@ toolchain_cpu = "${target_cpu}" toolchain_os = "linux" is_clang = is_clang + use_ccache = false + use_goma = false }
diff --git a/build/toolchain/fnl/BUILD.gn b/build/toolchain/fnl/BUILD.gn index 1e4a075..b66c639 100644 --- a/build/toolchain/fnl/BUILD.gn +++ b/build/toolchain/fnl/BUILD.gn
@@ -21,4 +21,7 @@ toolchain_cpu = "${target_cpu}" toolchain_os = "linux" is_clang = is_clang + use_ccache = false + use_goma = false + }
diff --git a/build/toolchain/gcc_toolchain.gni b/build/toolchain/gcc_toolchain.gni index 13cfba1..f2045e1 100644 --- a/build/toolchain/gcc_toolchain.gni +++ b/build/toolchain/gcc_toolchain.gni
@@ -3,6 +3,8 @@ # found in the LICENSE file. import("//build/config/nacl/config.gni") +import("//build/toolchain/ccache.gni") +import("//build/toolchain/goma.gni") # This value will be inherited in the toolchain below. concurrent_links = exec_script("get_concurrent_links.py", [], "value") @@ -58,6 +60,21 @@ assert(defined(invoker.toolchain_os), "gcc_toolchain() must specify a \"toolchain_os\"") + if (defined(invoker.use_ccache)) { + use_ccache = invoker.use_ccache + } + if (defined(invoker.use_goma)) { + use_goma = invoker.use_goma + } + if (use_goma) { + assert(!use_ccache, "Goma and ccache can't be used together.") + compiler_prefix = "$goma_dir/gomacc " + } else if (use_ccache) { + compiler_prefix = "ccache " + } else { + compiler_prefix = "" + } + # This define changes when the toolchain changes, forcing a rebuild. # Nothing should ever use this define. if (defined(invoker.rebuild_define)) { @@ -69,8 +86,8 @@ # We can't do string interpolation ($ in strings) on things with dots in # them. To allow us to use $cc below, for example, we create copies of # these values in our scope. - cc = invoker.cc - cxx = invoker.cxx + cc = compiler_prefix + invoker.cc + cxx = compiler_prefix + invoker.cxx ar = invoker.ar ld = invoker.ld if (defined(invoker.readelf)) {
diff --git a/build/toolchain/linux/BUILD.gn b/build/toolchain/linux/BUILD.gn index 9145284..51768df 100644 --- a/build/toolchain/linux/BUILD.gn +++ b/build/toolchain/linux/BUILD.gn
@@ -3,23 +3,12 @@ # found in the LICENSE file. import("//build/config/sysroot.gni") -import("//build/toolchain/ccache.gni") import("//build/toolchain/clang.gni") import("//build/toolchain/gcc_toolchain.gni") -import("//build/toolchain/goma.gni") - -if (use_goma) { - assert(!use_ccache, "Goma and ccache can't be used together.") - compiler_prefix = "$goma_dir/gomacc " -} else if (use_ccache) { - compiler_prefix = "ccache " -} else { - compiler_prefix = "" -} gcc_toolchain("arm") { - cc = "${compiler_prefix}arm-linux-gnueabi-gcc" - cxx = "${compiler_prefix}arm-linux-gnueabi-g++" + cc = "arm-linux-gnueabi-gcc" + cxx = "arm-linux-gnueabi-g++" ar = "arm-linux-gnueabi-ar" ld = cxx @@ -39,8 +28,8 @@ prefix = rebase_path("//third_party/llvm-build/Release+Asserts/bin", root_build_dir) } - cc = "${compiler_prefix}$prefix/clang" - cxx = "${compiler_prefix}$prefix/clang++" + cc = "$prefix/clang" + cxx = "$prefix/clang++" readelf = "readelf" nm = "nm" ar = "ar" @@ -52,8 +41,8 @@ } gcc_toolchain("x86") { - cc = "${compiler_prefix}gcc" - cxx = "${compiler_prefix}g++" + cc = "gcc" + cxx = "g++" readelf = "readelf" nm = "nm" @@ -73,8 +62,8 @@ prefix = rebase_path("//third_party/llvm-build/Release+Asserts/bin", root_build_dir) } - cc = "${compiler_prefix}$prefix/clang" - cxx = "${compiler_prefix}$prefix/clang++" + cc = "$prefix/clang" + cxx = "$prefix/clang++" readelf = "readelf" nm = "nm" @@ -87,8 +76,8 @@ } gcc_toolchain("x64") { - cc = "${compiler_prefix}gcc" - cxx = "${compiler_prefix}g++" + cc = "gcc" + cxx = "g++" readelf = "readelf" nm = "nm" @@ -111,4 +100,6 @@ toolchain_cpu = "mipsel" toolchain_os = "linux" is_clang = false + use_ccache = false + use_goma = false }