summaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authormcgrathr <mcgrathr@chromium.org>2015-11-13 13:15:55 -0800
committerCommit bot <commit-bot@chromium.org>2015-11-13 21:16:51 +0000
commit8b3b31d64338c7eadb59b433da6a933f9ad1c0ca (patch)
tree30366b92078b4162b9afe3a63cd5954bb5c3cbbf /build
parent8f1314f6d90ebcc24506cd036e76f98c3881e8ba (diff)
downloadchromium_src-8b3b31d64338c7eadb59b433da6a933f9ad1c0ca.zip
chromium_src-8b3b31d64338c7eadb59b433da6a933f9ad1c0ca.tar.gz
chromium_src-8b3b31d64338c7eadb59b433da6a933f9ad1c0ca.tar.bz2
GN: Refactor PNaCl toolchain definitions to use a template
This reduces duplicated code by using a template. Ironically, some extra duplication is necessitated by GN bug 555724. The variable definition can be hoisted back up when that bug is fixed. BUG= none R=dpranke@chromium.org, phosek@chromium.org Review URL: https://codereview.chromium.org/1450453002 Cr-Commit-Position: refs/heads/master@{#359643}
Diffstat (limited to 'build')
-rw-r--r--build/toolchain/nacl/BUILD.gn68
1 files changed, 40 insertions, 28 deletions
diff --git a/build/toolchain/nacl/BUILD.gn b/build/toolchain/nacl/BUILD.gn
index 23f1027..a159118 100644
--- a/build/toolchain/nacl/BUILD.gn
+++ b/build/toolchain/nacl/BUILD.gn
@@ -22,23 +22,39 @@ revisions = exec_script("//native_client/build/get_toolchain_revision.py",
"trim list lines")
nacl_x86_glibc_rev = revisions[0]
nacl_arm_glibc_rev = revisions[1]
-pnacl_newlib_rev = revisions[2]
-nacl_toolchain("newlib_pnacl") {
- toolchain_package = "pnacl_newlib"
- toolchain_revision = pnacl_newlib_rev
- toolchain_cpu = "pnacl"
- toolprefix =
- rebase_path("${nacl_toolchain_dir}/${toolchain_package}/bin/pnacl-",
- root_build_dir)
+# TODO(mcgrathr): Uncomment this when
+# https://code.google.com/p/chromium/issues/detail?id=555724 is fixed.
+#pnacl_newlib_rev = revisions[2]
- executable_extension = ".pexe"
+template("pnacl_toolchain") {
+ assert(defined(invoker.strip), "Must define strip")
+ assert(defined(invoker.executable_extension),
+ "Must define executable_extension")
+
+ # TODO(mcgrathr): See above.
+ pnacl_newlib_rev = revisions[2]
+
+ nacl_toolchain(target_name) {
+ toolchain_package = "pnacl_newlib"
+ toolchain_revision = pnacl_newlib_rev
+ toolchain_cpu = "pnacl"
+ toolprefix =
+ rebase_path("${nacl_toolchain_dir}/${toolchain_package}/bin/pnacl-",
+ root_build_dir)
+
+ is_clang = true
+ cc = toolprefix + "clang"
+ cxx = toolprefix + "clang++"
+ ar = toolprefix + "ar"
+ ld = cxx
+ strip = toolprefix + invoker.strip
+ executable_extension = invoker.executable_extension
+ }
+}
- is_clang = true
- cc = toolprefix + "clang"
- cxx = toolprefix + "clang++"
- ar = toolprefix + "ar"
- ld = cxx
+pnacl_toolchain("newlib_pnacl") {
+ executable_extension = ".pexe"
# The pnacl-finalize tool turns a .pexe.debug file into a .pexe file.
# It's very similar in purpose to the traditional "strip" utility: it
@@ -47,23 +63,13 @@ nacl_toolchain("newlib_pnacl") {
# you ever actually want to use other than pnacl-finalize, so just
# make pnacl-finalize the strip tool rather than adding an additional
# step like "postlink" to run pnacl-finalize.
- strip = toolprefix + "finalize"
+ strip = "finalize"
}
-nacl_toolchain("newlib_pnacl_nonsfi") {
- toolchain_package = "pnacl_newlib"
- toolchain_revision = pnacl_newlib_rev
- toolchain_cpu = "pnacl"
- toolprefix =
- rebase_path("${nacl_toolchain_dir}/${toolchain_package}/bin/pnacl-",
- root_build_dir)
-
- is_clang = true
- cc = toolprefix + "clang"
- cxx = toolprefix + "clang++"
- ar = toolprefix + "ar"
- ld = cxx
+pnacl_toolchain("newlib_pnacl_nonsfi") {
executable_extension = ""
+
+ strip = "strip"
}
template("nacl_glibc_toolchain") {
@@ -114,6 +120,9 @@ template("nacl_clang_toolchain") {
toolchain_cpu = target_name
assert(defined(invoker.toolchain_tuple), "Must define toolchain_tuple")
+ # TODO(mcgrathr): See above.
+ pnacl_newlib_rev = revisions[2]
+
toolchain_package = "pnacl_newlib"
toolchain_revision = pnacl_newlib_rev
toolprefix = rebase_path("${nacl_toolchain_dir}/${toolchain_package}/bin/" +
@@ -133,6 +142,9 @@ template("nacl_irt_toolchain") {
toolchain_cpu = target_name
assert(defined(invoker.toolchain_tuple), "Must define toolchain_tuple")
+ # TODO(mcgrathr): See above.
+ pnacl_newlib_rev = revisions[2]
+
toolchain_package = "pnacl_newlib"
toolchain_revision = pnacl_newlib_rev
toolprefix = rebase_path("${nacl_toolchain_dir}/${toolchain_package}/bin/" +