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

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: merge to #346439 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
« no previous file with comments | « build/config/nacl/BUILD.gn ('k') | build/toolchain/nacl_toolchain.gni » ('j') | 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) 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")
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 nacl_toolchain_dir = rebase_path("//native_client/toolchain", root_build_dir)
9 ld = toolprefix + "g++" 9 os_toolchain_dir = "${nacl_toolchain_dir}/${current_os}_x86"
10 10
11 tool("cc") { 11 # Add the toolchain revision as a preprocessor define so that sources are
12 command = "$cc -MMD -MF \$out.d \$defines \$includes \$cflags \$cflags_c -c \$in -o \$out" 12 # rebuilt when a toolchain is updated.
13 description = "CC(NaCl x86 Newlib) \$out" 13 # Idea we could use the toolchain deps feature, but currently that feature is
14 depfile = "\$out.d" 14 # bugged and does not trigger a rebuild.
15 depsformat = "gcc" 15 # https://code.google.com/p/chromium/issues/detail?id=431880
16 } 16 # Calls to get the toolchain revision are relatively slow, so do them all in a
17 tool("cxx") { 17 # single batch to amortize python startup, etc.
18 # cflags_pch_cc 18 revisions = exec_script("//native_client/build/get_toolchain_revision.py",
19 command = "$cxx -MMD -MF \$out.d \$defines \$includes \$cflags \$cflags_cc - c \$in -o \$out" 19 [
20 description = "CXX(NaCl x86 Newlib) \$out" 20 "nacl_arm_newlib",
21 depfile = "\$out.d" 21 "nacl_x86_newlib",
22 depsformat = "gcc" 22 "nacl_x86_glibc",
23 } 23 "pnacl_newlib",
24 tool("alink") { 24 ],
25 command = "rm -f \$out && ${toolprefix}ar rcs \$out \$in" 25 "trim list lines")
26 description = "AR(NaCl x86 Newlib) \$out" 26 nacl_arm_newlib_rev = revisions[0]
27 } 27 nacl_x86_newlib_rev = revisions[1]
28 tool("solink") { 28 nacl_x86_glibc_rev = revisions[2]
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 pnacl_newlib_rev = revisions[3]
30 description = "SOLINK(NaCl x86 Newlib) \$lib" 30
31 31 nacl_toolchain("newlib_arm") {
32 #pool = "link_pool" 32 toolchain_package = "nacl_arm_newlib"
33 restat = "1" 33 toolchain_revision = nacl_arm_newlib_rev
34 } 34 toolchain_cpu = "arm"
35 tool("link") { 35 toolprefix = "${os_toolchain_dir}/${toolchain_package}/bin/arm-nacl-"
36 command = "$ld \$ldflags -o \$out -Wl,--start-group \$in \$solibs -Wl,--end- group \$libs" 36
37 description = "LINK(NaCl x86 Newlib) \$out" 37 cc = toolprefix + "gcc"
38 38 cxx = toolprefix + "g++"
39 #pool = "link_pool" 39 ar = toolprefix + "ar"
40 } 40 ld = cxx
41 41 }
42 if (is_win) { 42
43 tool("stamp") { 43 nacl_toolchain("newlib_x86") {
44 command = "$python_path gyp-win-tool stamp \$out" 44 toolchain_package = "nacl_x86_newlib"
45 description = "STAMP \$out" 45 toolchain_revision = nacl_x86_newlib_rev
46 } 46 toolchain_cpu = "x86"
47 } else { 47 toolprefix = "${os_toolchain_dir}/${toolchain_package}/bin/i686-nacl-"
48 tool("stamp") { 48
49 command = "touch \$out" 49 cc = toolprefix + "gcc"
50 description = "STAMP \$out" 50 cxx = toolprefix + "g++"
51 } 51 ar = toolprefix + "ar"
52 } 52 ld = cxx
53 53 }
54 toolchain_args() { 54
55 # Override the default OS detection. The build config will set the is_* 55 nacl_toolchain("newlib_x64") {
56 # flags accordingly. 56 toolchain_package = "nacl_x86_newlib"
57 current_os = "nacl" 57 toolchain_revision = nacl_x86_newlib_rev
58 58 toolchain_cpu = "x64"
59 # Component build not supported in NaCl, since it does not support shared 59 toolprefix = "${os_toolchain_dir}/${toolchain_package}/bin/x86_64-nacl-"
60 # libraries. 60
61 is_component_build = false 61 cc = toolprefix + "gcc"
62 } 62 cxx = toolprefix + "g++"
63 } 63 ar = toolprefix + "ar"
64 ld = cxx
65 }
66
67 nacl_toolchain("newlib_pnacl") {
68 toolchain_package = "pnacl_newlib"
69 toolchain_revision = pnacl_newlib_rev
70 toolchain_cpu = "pnacl"
71 toolprefix = "${os_toolchain_dir}/${toolchain_package}/bin/pnacl-"
72
73 cc = toolprefix + "clang"
74 cxx = toolprefix + "clang++"
75 ar = toolprefix + "ar"
76 ld = cxx
77 executable_extension = ".pexe-debug"
78
79 finalize = toolprefix + "finalize"
80 nonfinal_file =
81 "{{root_out_dir}}/{{target_output_name}}${executable_extension}"
82 finalized_file = "{{root_out_dir}}/{{target_output_name}}.pexe"
83 postlink = "$finalize $nonfinal_file -o $finalized_file"
84 link_outputs = [ finalized_file ]
85 }
86
87 nacl_toolchain("glibc_x86") {
88 toolchain_package = "nacl_x86_glibc"
89 toolchain_revision = nacl_x86_glibc_rev
90 toolchain_cpu = "x86"
91 toolprefix = "${os_toolchain_dir}/${toolchain_package}/bin/i686-nacl-"
92
93 cc = toolprefix + "gcc"
94 cxx = toolprefix + "g++"
95 ar = toolprefix + "ar"
96 ld = cxx
97 }
98
99 nacl_toolchain("glibc_x64") {
100 toolchain_package = "nacl_x86_glibc"
101 toolchain_revision = nacl_x86_glibc_rev
102 toolchain_cpu = "x64"
103 toolprefix = "${os_toolchain_dir}/${toolchain_package}/bin/x86_64-nacl-"
104
105 cc = toolprefix + "gcc"
106 cxx = toolprefix + "g++"
107 ar = toolprefix + "ar"
108 ld = cxx
109 }
110
111 nacl_toolchain("clang_newlib_x86") {
112 toolchain_package = "pnacl_newlib"
113 toolchain_revision = pnacl_newlib_rev
114 toolchain_cpu = "x86"
115 toolprefix = "${os_toolchain_dir}/${toolchain_package}/bin/i686-nacl-"
116 is_clang = true
117
118 cc = toolprefix + "clang"
119 cxx = toolprefix + "clang++"
120 ar = toolprefix + "ar"
121 ld = cxx
122 }
123
124 nacl_toolchain("clang_newlib_x64") {
125 toolchain_package = "pnacl_newlib"
126 toolchain_revision = pnacl_newlib_rev
127 toolchain_cpu = "x64"
128 toolprefix = "${os_toolchain_dir}/${toolchain_package}/bin/x86_64-nacl-"
129 is_clang = true
130
131 cc = toolprefix + "clang"
132 cxx = toolprefix + "clang++"
133 ar = toolprefix + "ar"
134 ld = cxx
135 }
136
137 link_irt = rebase_path("//native_client/build/link_irt.py", root_build_dir)
138
139 nacl_toolchain("irt_x86") {
140 toolchain_package = "pnacl_newlib"
141 toolchain_revision = pnacl_newlib_rev
142 toolchain_cpu = "x86"
143 toolprefix = "${os_toolchain_dir}/${toolchain_package}/bin/i686-nacl-"
144 is_clang = true
145
146 cc = toolprefix + "clang"
147 cxx = toolprefix + "clang++"
148 ar = toolprefix + "ar"
149 readelf = toolprefix + "readelf"
150
151 # Some IRT implementations (notably, Chromium's) contain C++ code,
152 # so we need to link w/ the C++ linker.
153 ld = "${python_path} ${link_irt} --tls-edit=tls_edit --link-cmd=${cxx} --reade lf-cmd=${readelf}"
154
155 # TODO(ncbray): depend on link script
156 deps = [
157 "//native_client/src/tools/tls_edit:tls_edit($host_toolchain)",
158 ]
159 }
160
161 nacl_toolchain("irt_x64") {
162 toolchain_package = "pnacl_newlib"
163 toolchain_revision = pnacl_newlib_rev
164 toolchain_cpu = "x64"
165 toolprefix = "${os_toolchain_dir}/${toolchain_package}/bin/x86_64-nacl-"
166 is_clang = true
167
168 cc = toolprefix + "clang"
169 cxx = toolprefix + "clang++"
170 ar = toolprefix + "ar"
171 readelf = toolprefix + "readelf"
172
173 # Some IRT implementations (notably, Chromium's) contain C++ code,
174 # so we need to link w/ the C++ linker.
175 ld = "${python_path} ${link_irt} --tls-edit=tls_edit --link-cmd=${cxx} --reade lf-cmd=${readelf}"
176
177 # TODO(ncbray): depend on link script
178 deps = [
179 "//native_client/src/tools/tls_edit:tls_edit($host_toolchain)",
180 ]
181 }
182
183 # Uses newlib to match the Chrome build.
184 nacl_toolchain("irt_arm") {
185 toolchain_package = "nacl_arm_newlib"
186 toolchain_revision = nacl_arm_newlib_rev
187 toolchain_cpu = "arm"
188 toolprefix = "${os_toolchain_dir}/${toolchain_package}/bin/arm-nacl-"
189
190 cc = toolprefix + "gcc"
191 cxx = toolprefix + "g++"
192 ar = toolprefix + "ar"
193 readelf = toolprefix + "readelf"
194
195 # Some IRT implementations (notably, Chromium's) contain C++ code,
196 # so we need to link w/ the C++ linker.
197 ld = "${python_path} ${link_irt} --tls-edit=tls_edit --link-cmd=${cxx} --reade lf-cmd=${readelf}"
198
199 # TODO(ncbray): depend on link script
200 deps = [
201 "//native_client/src/tools/tls_edit:tls_edit($host_toolchain)",
202 ]
203 }
OLDNEW
« no previous file with comments | « build/config/nacl/BUILD.gn ('k') | build/toolchain/nacl_toolchain.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698