Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(593)

Side by Side Diff: build/toolchain/nacl/BUILD.gn

Issue 1450453002: GN: Refactor PNaCl toolchain definitions to use a template (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2014 The Native Client Authors. All rights reserved. 1 # Copyright (c) 2014 The Native Client Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import("//build/config/sysroot.gni") 5 import("//build/config/sysroot.gni")
6 import("//build/config/nacl/config.gni") 6 import("//build/config/nacl/config.gni")
7 import("//build/toolchain/nacl_toolchain.gni") 7 import("//build/toolchain/nacl_toolchain.gni")
8 8
9 # Add the toolchain revision as a preprocessor define so that sources are 9 # Add the toolchain revision as a preprocessor define so that sources are
10 # rebuilt when a toolchain is updated. 10 # rebuilt when a toolchain is updated.
11 # Idea we could use the toolchain deps feature, but currently that feature is 11 # Idea we could use the toolchain deps feature, but currently that feature is
12 # bugged and does not trigger a rebuild. 12 # bugged and does not trigger a rebuild.
13 # https://code.google.com/p/chromium/issues/detail?id=431880 13 # https://code.google.com/p/chromium/issues/detail?id=431880
14 # Calls to get the toolchain revision are relatively slow, so do them all in a 14 # Calls to get the toolchain revision are relatively slow, so do them all in a
15 # single batch to amortize python startup, etc. 15 # single batch to amortize python startup, etc.
16 revisions = exec_script("//native_client/build/get_toolchain_revision.py", 16 revisions = exec_script("//native_client/build/get_toolchain_revision.py",
17 [ 17 [
18 "nacl_x86_glibc", 18 "nacl_x86_glibc",
19 "nacl_arm_glibc", 19 "nacl_arm_glibc",
20 "pnacl_newlib", 20 "pnacl_newlib",
21 ], 21 ],
22 "trim list lines") 22 "trim list lines")
23 nacl_x86_glibc_rev = revisions[0] 23 nacl_x86_glibc_rev = revisions[0]
24 nacl_arm_glibc_rev = revisions[1] 24 nacl_arm_glibc_rev = revisions[1]
25 pnacl_newlib_rev = revisions[2]
26 25
27 nacl_toolchain("newlib_pnacl") { 26 # TODO(mcgrathr): Uncomment this when
28 toolchain_package = "pnacl_newlib" 27 # https://code.google.com/p/chromium/issues/detail?id=555724 is fixed.
29 toolchain_revision = pnacl_newlib_rev 28 #pnacl_newlib_rev = revisions[2]
30 toolchain_cpu = "pnacl"
31 toolprefix =
32 rebase_path("${nacl_toolchain_dir}/${toolchain_package}/bin/pnacl-",
33 root_build_dir)
34 29
30 template("pnacl_toolchain") {
31 assert(defined(invoker.strip), "Must define strip")
32 assert(defined(invoker.executable_extension),
33 "Must define executable_extension")
34
35 # TODO(mcgrathr): See above.
36 pnacl_newlib_rev = revisions[2]
37
38 nacl_toolchain(target_name) {
39 toolchain_package = "pnacl_newlib"
40 toolchain_revision = pnacl_newlib_rev
41 toolchain_cpu = "pnacl"
42 toolprefix =
43 rebase_path("${nacl_toolchain_dir}/${toolchain_package}/bin/pnacl-",
44 root_build_dir)
45
46 is_clang = true
47 cc = toolprefix + "clang"
48 cxx = toolprefix + "clang++"
49 ar = toolprefix + "ar"
50 ld = cxx
51 strip = toolprefix + invoker.strip
52 executable_extension = invoker.executable_extension
53 }
54 }
55
56 pnacl_toolchain("newlib_pnacl") {
35 executable_extension = ".pexe" 57 executable_extension = ".pexe"
36 58
37 is_clang = true
38 cc = toolprefix + "clang"
39 cxx = toolprefix + "clang++"
40 ar = toolprefix + "ar"
41 ld = cxx
42
43 # The pnacl-finalize tool turns a .pexe.debug file into a .pexe file. 59 # The pnacl-finalize tool turns a .pexe.debug file into a .pexe file.
44 # It's very similar in purpose to the traditional "strip" utility: it 60 # It's very similar in purpose to the traditional "strip" utility: it
45 # turns what comes out of the linker into what you actually want to 61 # turns what comes out of the linker into what you actually want to
46 # distribute and run. PNaCl doesn't have a "strip"-like utility that 62 # distribute and run. PNaCl doesn't have a "strip"-like utility that
47 # you ever actually want to use other than pnacl-finalize, so just 63 # you ever actually want to use other than pnacl-finalize, so just
48 # make pnacl-finalize the strip tool rather than adding an additional 64 # make pnacl-finalize the strip tool rather than adding an additional
49 # step like "postlink" to run pnacl-finalize. 65 # step like "postlink" to run pnacl-finalize.
50 strip = toolprefix + "finalize" 66 strip = "finalize"
51 } 67 }
52 68
53 nacl_toolchain("newlib_pnacl_nonsfi") { 69 pnacl_toolchain("newlib_pnacl_nonsfi") {
54 toolchain_package = "pnacl_newlib" 70 executable_extension = ""
55 toolchain_revision = pnacl_newlib_rev
56 toolchain_cpu = "pnacl"
57 toolprefix =
58 rebase_path("${nacl_toolchain_dir}/${toolchain_package}/bin/pnacl-",
59 root_build_dir)
60 71
61 is_clang = true 72 strip = "strip"
62 cc = toolprefix + "clang"
63 cxx = toolprefix + "clang++"
64 ar = toolprefix + "ar"
65 ld = cxx
66 executable_extension = ""
67 } 73 }
68 74
69 template("nacl_glibc_toolchain") { 75 template("nacl_glibc_toolchain") {
70 toolchain_cpu = target_name 76 toolchain_cpu = target_name
71 assert(defined(invoker.toolchain_tuple), "Must define toolchain_tuple") 77 assert(defined(invoker.toolchain_tuple), "Must define toolchain_tuple")
72 assert(defined(invoker.toolchain_package), "Must define toolchain_package") 78 assert(defined(invoker.toolchain_package), "Must define toolchain_package")
73 assert(defined(invoker.toolchain_revision), "Must define toolchain_revision") 79 assert(defined(invoker.toolchain_revision), "Must define toolchain_revision")
74 forward_variables_from(invoker, 80 forward_variables_from(invoker,
75 [ 81 [
76 "toolchain_package", 82 "toolchain_package",
(...skipping 30 matching lines...) Expand all
107 nacl_glibc_toolchain("arm") { 113 nacl_glibc_toolchain("arm") {
108 toolchain_package = "nacl_arm_glibc" 114 toolchain_package = "nacl_arm_glibc"
109 toolchain_revision = nacl_arm_glibc_rev 115 toolchain_revision = nacl_arm_glibc_rev
110 toolchain_tuple = "arm-nacl" 116 toolchain_tuple = "arm-nacl"
111 } 117 }
112 118
113 template("nacl_clang_toolchain") { 119 template("nacl_clang_toolchain") {
114 toolchain_cpu = target_name 120 toolchain_cpu = target_name
115 assert(defined(invoker.toolchain_tuple), "Must define toolchain_tuple") 121 assert(defined(invoker.toolchain_tuple), "Must define toolchain_tuple")
116 122
123 # TODO(mcgrathr): See above.
124 pnacl_newlib_rev = revisions[2]
125
117 toolchain_package = "pnacl_newlib" 126 toolchain_package = "pnacl_newlib"
118 toolchain_revision = pnacl_newlib_rev 127 toolchain_revision = pnacl_newlib_rev
119 toolprefix = rebase_path("${nacl_toolchain_dir}/${toolchain_package}/bin/" + 128 toolprefix = rebase_path("${nacl_toolchain_dir}/${toolchain_package}/bin/" +
120 invoker.toolchain_tuple + "-", 129 invoker.toolchain_tuple + "-",
121 root_build_dir) 130 root_build_dir)
122 131
123 nacl_toolchain("clang_newlib_" + toolchain_cpu) { 132 nacl_toolchain("clang_newlib_" + toolchain_cpu) {
124 is_clang = true 133 is_clang = true
125 cc = toolprefix + "clang" 134 cc = toolprefix + "clang"
126 cxx = toolprefix + "clang++" 135 cxx = toolprefix + "clang++"
127 ar = toolprefix + "ar" 136 ar = toolprefix + "ar"
128 ld = cxx 137 ld = cxx
129 } 138 }
130 } 139 }
131 140
132 template("nacl_irt_toolchain") { 141 template("nacl_irt_toolchain") {
133 toolchain_cpu = target_name 142 toolchain_cpu = target_name
134 assert(defined(invoker.toolchain_tuple), "Must define toolchain_tuple") 143 assert(defined(invoker.toolchain_tuple), "Must define toolchain_tuple")
135 144
145 # TODO(mcgrathr): See above.
146 pnacl_newlib_rev = revisions[2]
147
136 toolchain_package = "pnacl_newlib" 148 toolchain_package = "pnacl_newlib"
137 toolchain_revision = pnacl_newlib_rev 149 toolchain_revision = pnacl_newlib_rev
138 toolprefix = rebase_path("${nacl_toolchain_dir}/${toolchain_package}/bin/" + 150 toolprefix = rebase_path("${nacl_toolchain_dir}/${toolchain_package}/bin/" +
139 invoker.toolchain_tuple + "-", 151 invoker.toolchain_tuple + "-",
140 root_build_dir) 152 root_build_dir)
141 153
142 link_irt = rebase_path("//native_client/build/link_irt.py", root_build_dir) 154 link_irt = rebase_path("//native_client/build/link_irt.py", root_build_dir)
143 155
144 tls_edit_label = 156 tls_edit_label =
145 "//native_client/src/tools/tls_edit:tls_edit($host_toolchain)" 157 "//native_client/src/tools/tls_edit:tls_edit($host_toolchain)"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 toolchain_tuple = "i686-nacl" 197 toolchain_tuple = "i686-nacl"
186 } 198 }
187 199
188 nacl_clang_toolchains("x64") { 200 nacl_clang_toolchains("x64") {
189 toolchain_tuple = "x86_64-nacl" 201 toolchain_tuple = "x86_64-nacl"
190 } 202 }
191 203
192 nacl_clang_toolchains("arm") { 204 nacl_clang_toolchains("arm") {
193 toolchain_tuple = "arm-nacl" 205 toolchain_tuple = "arm-nacl"
194 } 206 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698