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
3 # found in the LICENSE file.
5 import("//build/config/sysroot.gni")
6 import("//build/toolchain/nacl_toolchain.gni")
8 nacl_toolchain_dir = rebase_path("//native_client/toolchain", root_build_dir)
9 os_toolchain_dir = "${nacl_toolchain_dir}/${current_os}_x86"
11 # Add the toolchain revision as a preprocessor define so that sources are
12 # rebuilt when a toolchain is updated.
13 # Idea we could use the toolchain deps feature, but currently that feature is
14 # bugged and does not trigger a rebuild.
15 # https://code.google.com/p/chromium/issues/detail?id=431880
16 # Calls to get the toolchain revision are relatively slow, so do them all in a
17 # single batch to amortize python startup, etc.
18 revisions = exec_script("//native_client/build/get_toolchain_revision.py",
26 nacl_arm_newlib_rev = revisions[0]
27 nacl_x86_newlib_rev = revisions[1]
28 nacl_x86_glibc_rev = revisions[2]
29 pnacl_newlib_rev = revisions[3]
31 nacl_toolchain("newlib_arm") {
32 toolchain_package = "nacl_arm_newlib"
33 toolchain_revision = nacl_arm_newlib_rev
35 toolprefix = "${os_toolchain_dir}/${toolchain_package}/bin/arm-nacl-"
38 cc = toolprefix + "gcc"
39 cxx = toolprefix + "g++"
40 ar = toolprefix + "ar"
44 nacl_toolchain("newlib_x86") {
45 toolchain_package = "nacl_x86_newlib"
46 toolchain_revision = nacl_x86_newlib_rev
48 toolprefix = "${os_toolchain_dir}/${toolchain_package}/bin/i686-nacl-"
51 cc = toolprefix + "gcc"
52 cxx = toolprefix + "g++"
53 ar = toolprefix + "ar"
57 nacl_toolchain("newlib_x64") {
58 toolchain_package = "nacl_x86_newlib"
59 toolchain_revision = nacl_x86_newlib_rev
61 toolprefix = "${os_toolchain_dir}/${toolchain_package}/bin/x86_64-nacl-"
64 cc = toolprefix + "gcc"
65 cxx = toolprefix + "g++"
66 ar = toolprefix + "ar"
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-"
76 cc = toolprefix + "clang"
77 cxx = toolprefix + "clang++"
78 ar = toolprefix + "ar"
80 executable_extension = ".pexe.debug"
82 finalize = toolprefix + "finalize"
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 ]
90 nacl_toolchain("glibc_x86") {
91 toolchain_package = "nacl_x86_glibc"
92 toolchain_revision = nacl_x86_glibc_rev
94 toolprefix = "${os_toolchain_dir}/${toolchain_package}/bin/i686-nacl-"
97 cc = toolprefix + "gcc"
98 cxx = toolprefix + "g++"
99 ar = toolprefix + "ar"
103 nacl_toolchain("glibc_x64") {
104 toolchain_package = "nacl_x86_glibc"
105 toolchain_revision = nacl_x86_glibc_rev
106 toolchain_cpu = "x64"
107 toolprefix = "${os_toolchain_dir}/${toolchain_package}/bin/x86_64-nacl-"
110 cc = toolprefix + "gcc"
111 cxx = toolprefix + "g++"
112 ar = toolprefix + "ar"
116 nacl_toolchain("clang_newlib_x86") {
117 toolchain_package = "pnacl_newlib"
118 toolchain_revision = pnacl_newlib_rev
119 toolchain_cpu = "x86"
120 toolprefix = "${os_toolchain_dir}/${toolchain_package}/bin/i686-nacl-"
123 cc = toolprefix + "clang"
124 cxx = toolprefix + "clang++"
125 ar = toolprefix + "ar"
129 nacl_toolchain("clang_newlib_x64") {
130 toolchain_package = "pnacl_newlib"
131 toolchain_revision = pnacl_newlib_rev
132 toolchain_cpu = "x64"
133 toolprefix = "${os_toolchain_dir}/${toolchain_package}/bin/x86_64-nacl-"
136 cc = toolprefix + "clang"
137 cxx = toolprefix + "clang++"
138 ar = toolprefix + "ar"
142 link_irt = rebase_path("//native_client/build/link_irt.py", root_build_dir)
144 nacl_toolchain("irt_x86") {
145 toolchain_package = "pnacl_newlib"
146 toolchain_revision = pnacl_newlib_rev
147 toolchain_cpu = "x86"
148 toolprefix = "${os_toolchain_dir}/${toolchain_package}/bin/i686-nacl-"
151 cc = toolprefix + "clang"
152 cxx = toolprefix + "clang++"
153 ar = toolprefix + "ar"
154 readelf = toolprefix + "readelf"
156 # Some IRT implementations (notably, Chromium's) contain C++ code,
157 # so we need to link w/ the C++ linker.
158 ld = "${python_path} ${link_irt} --tls-edit=tls_edit --link-cmd=${cxx} --readelf-cmd=${readelf}"
160 # TODO(ncbray): depend on link script
162 "//native_client/src/tools/tls_edit:tls_edit($host_toolchain)",
166 nacl_toolchain("irt_x64") {
167 toolchain_package = "pnacl_newlib"
168 toolchain_revision = pnacl_newlib_rev
169 toolchain_cpu = "x64"
170 toolprefix = "${os_toolchain_dir}/${toolchain_package}/bin/x86_64-nacl-"
173 cc = toolprefix + "clang"
174 cxx = toolprefix + "clang++"
175 ar = toolprefix + "ar"
176 readelf = toolprefix + "readelf"
178 # Some IRT implementations (notably, Chromium's) contain C++ code,
179 # so we need to link w/ the C++ linker.
180 ld = "${python_path} ${link_irt} --tls-edit=tls_edit --link-cmd=${cxx} --readelf-cmd=${readelf}"
182 # TODO(ncbray): depend on link script
184 "//native_client/src/tools/tls_edit:tls_edit($host_toolchain)",
188 # Uses newlib to match the Chrome build.
189 nacl_toolchain("irt_arm") {
190 toolchain_package = "nacl_arm_newlib"
191 toolchain_revision = nacl_arm_newlib_rev
192 toolchain_cpu = "arm"
193 toolprefix = "${os_toolchain_dir}/${toolchain_package}/bin/arm-nacl-"
196 cc = toolprefix + "gcc"
197 cxx = toolprefix + "g++"
198 ar = toolprefix + "ar"
199 readelf = toolprefix + "readelf"
201 # Some IRT implementations (notably, Chromium's) contain C++ code,
202 # so we need to link w/ the C++ linker.
203 ld = "${python_path} ${link_irt} --tls-edit=tls_edit --link-cmd=${cxx} --readelf-cmd=${readelf}"
205 # TODO(ncbray): depend on link script
207 "//native_client/src/tools/tls_edit:tls_edit($host_toolchain)",