Update V8 to version 4.7.53.
[chromium-blink-merge.git] / build / toolchain / nacl / BUILD.gn
blobc3dcaf17c9e363dde3092257a62b72c8c544dde3
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",
19                         [
20                           "nacl_arm_newlib",
21                           "nacl_x86_newlib",
22                           "nacl_x86_glibc",
23                           "pnacl_newlib",
24                         ],
25                         "trim list lines")
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
34   toolchain_cpu = "arm"
35   toolprefix = "${os_toolchain_dir}/${toolchain_package}/bin/arm-nacl-"
36   is_clang = false
38   cc = toolprefix + "gcc"
39   cxx = toolprefix + "g++"
40   ar = toolprefix + "ar"
41   ld = cxx
44 nacl_toolchain("newlib_x86") {
45   toolchain_package = "nacl_x86_newlib"
46   toolchain_revision = nacl_x86_newlib_rev
47   toolchain_cpu = "x86"
48   toolprefix = "${os_toolchain_dir}/${toolchain_package}/bin/i686-nacl-"
49   is_clang = false
51   cc = toolprefix + "gcc"
52   cxx = toolprefix + "g++"
53   ar = toolprefix + "ar"
54   ld = cxx
57 nacl_toolchain("newlib_x64") {
58   toolchain_package = "nacl_x86_newlib"
59   toolchain_revision = nacl_x86_newlib_rev
60   toolchain_cpu = "x64"
61   toolprefix = "${os_toolchain_dir}/${toolchain_package}/bin/x86_64-nacl-"
62   is_clang = false
64   cc = toolprefix + "gcc"
65   cxx = toolprefix + "g++"
66   ar = toolprefix + "ar"
67   ld = cxx
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"
79   ld = cxx
80   executable_extension = ".pexe.debug"
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 ]
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   is_clang = false
97   cc = toolprefix + "gcc"
98   cxx = toolprefix + "g++"
99   ar = toolprefix + "ar"
100   ld = cxx
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-"
108   is_clang = false
110   cc = toolprefix + "gcc"
111   cxx = toolprefix + "g++"
112   ar = toolprefix + "ar"
113   ld = cxx
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-"
121   is_clang = true
123   cc = toolprefix + "clang"
124   cxx = toolprefix + "clang++"
125   ar = toolprefix + "ar"
126   ld = cxx
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-"
134   is_clang = true
136   cc = toolprefix + "clang"
137   cxx = toolprefix + "clang++"
138   ar = toolprefix + "ar"
139   ld = cxx
142 template("nacl_irt_toolchain") {
143   toolchain_cpu = target_name
144   assert(defined(invoker.toolchain_tuple), "Must define toolchain_tuple")
146   toolchain_package = "pnacl_newlib"
147   toolchain_revision = pnacl_newlib_rev
148   toolprefix = "${os_toolchain_dir}/${toolchain_package}/bin/" +
149                invoker.toolchain_tuple + "-"
151   link_irt = rebase_path("//native_client/build/link_irt.py", root_build_dir)
153   tls_edit_label =
154       "//native_client/src/tools/tls_edit:tls_edit($host_toolchain)"
155   host_toolchain_out_dir =
156       rebase_path(get_label_info(tls_edit_label, "root_out_dir"),
157                   root_build_dir)
158   tls_edit = "${host_toolchain_out_dir}/tls_edit"
160   nacl_toolchain("irt_" + toolchain_cpu) {
161     is_clang = true
162     cc = toolprefix + "clang"
163     cxx = toolprefix + "clang++"
164     ar = toolprefix + "ar"
165     readelf = toolprefix + "readelf"
167     # Some IRT implementations (notably, Chromium's) contain C++ code,
168     # so we need to link w/ the C++ linker.
169     ld = "${python_path} ${link_irt} --tls-edit=${tls_edit} --link-cmd=${cxx} --readelf-cmd=${readelf}"
171     # TODO(ncbray): depend on link script
172     deps = [
173       tls_edit_label,
174     ]
175   }
178 nacl_irt_toolchain("x86") {
179   toolchain_tuple = "i686-nacl"
182 nacl_irt_toolchain("x64") {
183   toolchain_tuple = "x86_64-nacl"
186 nacl_irt_toolchain("arm") {
187   toolchain_tuple = "arm-nacl"