Index: build/toolchain/android/BUILD.gn |
diff --git a/build/toolchain/android/BUILD.gn b/build/toolchain/android/BUILD.gn |
index 9ae22183407865cf7c77e65380351f10797ddf8d..e074333cd32a0eb8e99947eac801e4603ba4657f 100644 |
--- a/build/toolchain/android/BUILD.gn |
+++ b/build/toolchain/android/BUILD.gn |
@@ -3,6 +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") |
@@ -23,8 +24,8 @@ template("android_gcc_toolchain") { |
gcc_toolchain(target_name) { |
# Make our manually injected libs relative to the build dir. |
android_ndk_lib = rebase_path( |
- invoker.android_ndk_sysroot + "/" + invoker.android_ndk_lib_dir, |
- root_build_dir) |
+ invoker.android_ndk_sysroot + "/" + invoker.android_ndk_lib_dir, |
+ root_build_dir) |
libs_section_prefix = "$android_ndk_lib/crtbegin_dynamic.o" |
libs_section_postfix = "$android_ndk_lib/crtend_android.o" |
@@ -36,13 +37,16 @@ template("android_gcc_toolchain") { |
tool_prefix = rebase_path(invoker.tool_prefix, root_build_dir) |
if (use_goma) { |
- goma_prefix = "$goma_dir/gomacc " |
+ assert(!use_ccache, "Goma and ccache can't be used together.") |
+ compiler_prefix = "$goma_dir/gomacc " |
+ } else if (use_ccache) { |
+ compiler_prefix = "ccache " |
} else { |
- goma_prefix = "" |
+ compiler_prefix = "" |
} |
- cc = goma_prefix + tool_prefix + "gcc" |
- cxx = goma_prefix + tool_prefix + "g++" |
+ cc = compiler_prefix + tool_prefix + "gcc" |
+ cxx = compiler_prefix + tool_prefix + "g++" |
ar = tool_prefix + "ar" |
ld = cxx |
@@ -59,8 +63,10 @@ template("android_gcc_toolchain") { |
android_strip = "${tool_prefix}strip" |
mkdir_command = "mkdir -p lib.stripped" |
- strip_command = "$android_strip --strip-unneeded -o $temp_stripped_soname $soname" |
- replace_command = "if ! cmp -s $temp_stripped_soname $stripped_soname; then mv $temp_stripped_soname $stripped_soname; fi" |
+ strip_command = |
+ "$android_strip --strip-unneeded -o $temp_stripped_soname $soname" |
+ replace_command = |
+ "if ! cmp -s $temp_stripped_soname $stripped_soname; then mv $temp_stripped_soname $stripped_soname; fi" |
postsolink = "$mkdir_command && $strip_command && $replace_command" |
solink_outputs = [ stripped_soname ] |