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

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

Issue 1312813003: add nacl_toolchain to //build and flip to using it in the GN build. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@build_changes
Patch Set: rebase Created 5 years, 3 months 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
OLDNEW
1 # Copyright (c) 2013 The Chromium 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 toolchain("x86_newlib") { 5 import("//build/config/sysroot.gni")
Dirk Pranke 2015/08/28 02:29:41 The old version of this file was way out of date a
6 toolprefix = "gen/sdk/toolchain/linux_x86_newlib/bin/x86_64-nacl-" 6 import("//build/toolchain/nacl_toolchain.gni")
7 cc = toolprefix + "gcc" 7
8 cxx = toolprefix + "g++" 8 declare_args() {
9 ld = toolprefix + "g++" 9 nacl_toolchain_dir = rebase_path("//native_client/toolchain", root_build_dir)
brettw 2015/08/28 18:25:52 Is this ever set outside of the build today? I can
Dirk Pranke 2015/08/28 20:08:32 I'd defer this one to the NaCl folks ...
Dirk Pranke 2015/08/28 20:37:07 ok, after checking with them, we think that we wil
10 10 }
11 tool("cc") { 11
12 command = "$cc -MMD -MF \$out.d \$defines \$includes \$cflags \$cflags_c -c \$in -o \$out" 12 os_toolchain_dir = "${nacl_toolchain_dir}/${current_os}_x86"
13 description = "CC(NaCl x86 Newlib) \$out" 13
14 depfile = "\$out.d" 14 # Add the toolchain revision as a preprocessor define so that sources are
15 depsformat = "gcc" 15 # rebuilt when a toolchain is updated.
16 } 16 # Idea we could use the toolchain deps feature, but currently that feature is
17 tool("cxx") { 17 # bugged and does not trigger a rebuild.
18 # cflags_pch_cc 18 # https://code.google.com/p/chromium/issues/detail?id=431880
19 command = "$cxx -MMD -MF \$out.d \$defines \$includes \$cflags \$cflags_cc - c \$in -o \$out" 19 # Calls to get the toolchain revision are relatively slow, so do them all in a
20 description = "CXX(NaCl x86 Newlib) \$out" 20 # single batch to amortize python startup, etc.
21 depfile = "\$out.d" 21 revisions = exec_script("//native_client/build/get_toolchain_revision.py",
22 depsformat = "gcc" 22 [
23 } 23 "nacl_arm_newlib",
24 tool("alink") { 24 "nacl_x86_newlib",
25 command = "rm -f \$out && ${toolprefix}ar rcs \$out \$in" 25 "nacl_x86_glibc",
26 description = "AR(NaCl x86 Newlib) \$out" 26 "pnacl_newlib",
27 } 27 ],
28 tool("solink") { 28 "trim list lines")
29 command = "if [ ! -e \$lib -o ! -e \${lib}.TOC ]; then $ld -shared \$ldflags -o \$lib -Wl,-soname=\$soname -Wl,--whole-archive \$in \$solibs -Wl,--no-whole- archive \$libs && { readelf -d \${lib} | grep SONAME ; nm -gD -f p \${lib} | cut -f1-2 -d' '; } > \${lib}.TOC; else $ld -shared \$ldflags -o \$lib -Wl,-soname=\ $soname -Wl,--whole-archive \$in \$solibs -Wl,--no-whole-archive \$libs && { rea delf -d \${lib} | grep SONAME ; nm -gD -f p \${lib} | cut -f1-2 -d' '; } > \${li b}.tmp && if ! cmp -s \${lib}.tmp \${lib}.TOC; then mv \${lib}.tmp \${lib}.TOC ; fi; fi" 29 nacl_arm_newlib_rev = revisions[0]
30 description = "SOLINK(NaCl x86 Newlib) \$lib" 30 nacl_x86_newlib_rev = revisions[1]
31 31 nacl_x86_glibc_rev = revisions[2]
32 #pool = "link_pool" 32 pnacl_newlib_rev = revisions[3]
33 restat = "1" 33
34 } 34 nacl_toolchain("newlib_arm") {
Roland McGrath 2015/08/28 20:58:40 When I started hacking on this stuff, I made nacl_
Dirk Pranke 2015/08/28 21:17:05 Acknowledged.
35 tool("link") { 35 toolchain_package = "nacl_arm_newlib"
36 command = "$ld \$ldflags -o \$out -Wl,--start-group \$in \$solibs -Wl,--end- group \$libs" 36 toolchain_revision = nacl_arm_newlib_rev
37 description = "LINK(NaCl x86 Newlib) \$out" 37 toolchain_cpu = "arm"
38 38 toolprefix = "${os_toolchain_dir}/${toolchain_package}/bin/arm-nacl-"
39 #pool = "link_pool" 39
40 } 40 cc = toolprefix + "gcc"
41 41 cxx = toolprefix + "g++"
42 if (is_win) { 42 ar = toolprefix + "ar"
43 tool("stamp") { 43 ld = cxx
44 command = "$python_path gyp-win-tool stamp \$out" 44 }
45 description = "STAMP \$out" 45
46 } 46 nacl_toolchain("newlib_x86") {
47 } else { 47 toolchain_package = "nacl_x86_newlib"
48 tool("stamp") { 48 toolchain_revision = nacl_x86_newlib_rev
49 command = "touch \$out" 49 toolchain_cpu = "x86"
50 description = "STAMP \$out" 50 toolprefix = "${os_toolchain_dir}/${toolchain_package}/bin/i686-nacl-"
51 } 51
52 } 52 cc = toolprefix + "gcc"
53 53 cxx = toolprefix + "g++"
54 toolchain_args() { 54 ar = toolprefix + "ar"
55 # Override the default OS detection. The build config will set the is_* 55 ld = cxx
56 # flags accordingly. 56 }
57 current_os = "nacl" 57
58 58 nacl_toolchain("newlib_x64") {
59 # Component build not supported in NaCl, since it does not support shared 59 toolchain_package = "nacl_x86_newlib"
60 # libraries. 60 toolchain_revision = nacl_x86_newlib_rev
61 is_component_build = false 61 toolchain_cpu = "x64"
62 } 62 toolprefix = "${os_toolchain_dir}/${toolchain_package}/bin/x86_64-nacl-"
63 } 63
64 cc = toolprefix + "gcc"
65 cxx = toolprefix + "g++"
66 ar = toolprefix + "ar"
67 ld = cxx
68 }
69
70 nacl_toolchain("newlib_pnacl") {
71 toolchain_package = "pnacl_newlib"
72 toolchain_revision = pnacl_newlib_rev
73 toolchain_cpu = "pnacl"
74 toolprefix = "${os_toolchain_dir}/${toolchain_package}/bin/pnacl-"
75
76 cc = toolprefix + "clang"
77 cxx = toolprefix + "clang++"
78 ar = toolprefix + "ar"
79 ld = cxx
80 executable_extension = ".pexe-debug"
81
82 finalize = toolprefix + "finalize"
83 nonfinal_file =
84 "{{root_out_dir}}/{{target_output_name}}${executable_extension}"
85 finalized_file = "{{root_out_dir}}/{{target_output_name}}.pexe"
86 postlink = "$finalize $nonfinal_file -o $finalized_file"
87 link_outputs = [ finalized_file ]
88 }
89
90 nacl_toolchain("glibc_x86") {
91 toolchain_package = "nacl_x86_glibc"
92 toolchain_revision = nacl_x86_glibc_rev
93 toolchain_cpu = "x86"
94 toolprefix = "${os_toolchain_dir}/${toolchain_package}/bin/i686-nacl-"
95
96 cc = toolprefix + "gcc"
97 cxx = toolprefix + "g++"
98 ar = toolprefix + "ar"
99 ld = cxx
100 }
101
102 nacl_toolchain("glibc_x64") {
103 toolchain_package = "nacl_x86_glibc"
104 toolchain_revision = nacl_x86_glibc_rev
105 toolchain_cpu = "x64"
106 toolprefix = "${os_toolchain_dir}/${toolchain_package}/bin/x86_64-nacl-"
107
108 cc = toolprefix + "gcc"
109 cxx = toolprefix + "g++"
110 ar = toolprefix + "ar"
111 ld = cxx
112 }
113
114 nacl_toolchain("clang_newlib_x86") {
115 toolchain_package = "pnacl_newlib"
116 toolchain_revision = pnacl_newlib_rev
117 toolchain_cpu = "x86"
118 toolprefix = "${os_toolchain_dir}/${toolchain_package}/bin/i686-nacl-"
119 is_clang = true
120
121 cc = toolprefix + "clang"
122 cxx = toolprefix + "clang++"
123 ar = toolprefix + "ar"
124 ld = cxx
125 }
126
127 nacl_toolchain("clang_newlib_x64") {
128 toolchain_package = "pnacl_newlib"
129 toolchain_revision = pnacl_newlib_rev
130 toolchain_cpu = "x64"
131 toolprefix = "${os_toolchain_dir}/${toolchain_package}/bin/x86_64-nacl-"
132 is_clang = true
133
134 cc = toolprefix + "clang"
135 cxx = toolprefix + "clang++"
136 ar = toolprefix + "ar"
137 ld = cxx
138 }
139
140 link_irt = rebase_path("//native_client/build/link_irt.py", root_build_dir)
Roland McGrath 2015/08/28 20:58:40 This needs comments about what it is and why it ex
Dirk Pranke 2015/08/28 21:17:05 Acknowledged. I would prefer it if you can make th
141
142 nacl_toolchain("irt_x86") {
143 toolchain_package = "pnacl_newlib"
144 toolchain_revision = pnacl_newlib_rev
145 toolchain_cpu = "x86"
146 toolprefix = "${os_toolchain_dir}/${toolchain_package}/bin/i686-nacl-"
147 is_clang = true
148
149 cc = toolprefix + "clang"
150 cxx = toolprefix + "clang++"
151 ar = toolprefix + "ar"
152 readelf = toolprefix + "readelf"
153
154 # Some IRT implementations (notably, Chromium's) contain C++ code,
155 # so we need to link w/ the C++ linker.
156 ld = "${python_path} ${link_irt} --tls-edit=tls_edit --link-cmd=${cxx} --reade lf-cmd=${readelf}"
157
158 # TODO(ncbray): depend on link script
159 deps = [
160 "//native_client/src/tools/tls_edit:tls_edit($host_toolchain)",
161 ]
162 }
163
164 nacl_toolchain("irt_x64") {
165 toolchain_package = "pnacl_newlib"
166 toolchain_revision = pnacl_newlib_rev
167 toolchain_cpu = "x64"
168 toolprefix = "${os_toolchain_dir}/${toolchain_package}/bin/x86_64-nacl-"
169 is_clang = true
170
171 cc = toolprefix + "clang"
172 cxx = toolprefix + "clang++"
173 ar = toolprefix + "ar"
174 readelf = toolprefix + "readelf"
175
176 # Some IRT implementations (notably, Chromium's) contain C++ code,
177 # so we need to link w/ the C++ linker.
178 ld = "${python_path} ${link_irt} --tls-edit=tls_edit --link-cmd=${cxx} --reade lf-cmd=${readelf}"
179
180 # TODO(ncbray): depend on link script
181 deps = [
182 "//native_client/src/tools/tls_edit:tls_edit($host_toolchain)",
183 ]
184 }
185
186 # Uses newlib to match the Chrome build.
187 nacl_toolchain("irt_arm") {
188 toolchain_package = "nacl_arm_newlib"
189 toolchain_revision = nacl_arm_newlib_rev
190 toolchain_cpu = "arm"
191 toolprefix = "${os_toolchain_dir}/${toolchain_package}/bin/arm-nacl-"
192
193 cc = toolprefix + "gcc"
194 cxx = toolprefix + "g++"
195 ar = toolprefix + "ar"
196 readelf = toolprefix + "readelf"
197
198 # Some IRT implementations (notably, Chromium's) contain C++ code,
199 # so we need to link w/ the C++ linker.
200 ld = "${python_path} ${link_irt} --tls-edit=tls_edit --link-cmd=${cxx} --reade lf-cmd=${readelf}"
201
202 # TODO(ncbray): depend on link script
203 deps = [
204 "//native_client/src/tools/tls_edit:tls_edit($host_toolchain)",
205 ]
206 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698