OLD | NEW |
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 "pnacl_newlib", | 20 "pnacl_newlib", |
20 ], | 21 ], |
21 "trim list lines") | 22 "trim list lines") |
22 nacl_x86_glibc_rev = revisions[0] | 23 nacl_x86_glibc_rev = revisions[0] |
23 pnacl_newlib_rev = revisions[1] | 24 nacl_arm_glibc_rev = revisions[1] |
| 25 pnacl_newlib_rev = revisions[2] |
24 | 26 |
25 nacl_toolchain("newlib_pnacl") { | 27 nacl_toolchain("newlib_pnacl") { |
26 toolchain_package = "pnacl_newlib" | 28 toolchain_package = "pnacl_newlib" |
27 toolchain_revision = pnacl_newlib_rev | 29 toolchain_revision = pnacl_newlib_rev |
28 toolchain_cpu = "pnacl" | 30 toolchain_cpu = "pnacl" |
29 toolprefix = | 31 toolprefix = |
30 rebase_path("${nacl_toolchain_dir}/${toolchain_package}/bin/pnacl-", | 32 rebase_path("${nacl_toolchain_dir}/${toolchain_package}/bin/pnacl-", |
31 root_build_dir) | 33 root_build_dir) |
32 | 34 |
33 cc = toolprefix + "clang" | 35 cc = toolprefix + "clang" |
34 cxx = toolprefix + "clang++" | 36 cxx = toolprefix + "clang++" |
35 ar = toolprefix + "ar" | 37 ar = toolprefix + "ar" |
36 ld = cxx | 38 ld = cxx |
37 executable_extension = ".pexe.debug" | 39 executable_extension = ".pexe.debug" |
38 | 40 |
39 finalize = toolprefix + "finalize" | 41 finalize = toolprefix + "finalize" |
40 nonfinal_file = | 42 nonfinal_file = |
41 "{{root_out_dir}}/{{target_output_name}}${executable_extension}" | 43 "{{root_out_dir}}/{{target_output_name}}${executable_extension}" |
42 finalized_file = "{{root_out_dir}}/{{target_output_name}}.pexe" | 44 finalized_file = "{{root_out_dir}}/{{target_output_name}}.pexe" |
43 postlink = "$finalize $nonfinal_file -o $finalized_file" | 45 postlink = "$finalize $nonfinal_file -o $finalized_file" |
44 link_outputs = [ finalized_file ] | 46 link_outputs = [ finalized_file ] |
45 } | 47 } |
46 | 48 |
47 nacl_toolchain("glibc_x86") { | 49 template("nacl_glibc_toolchain") { |
| 50 toolchain_cpu = target_name |
| 51 assert(defined(invoker.toolchain_tuple), "Must define toolchain_tuple") |
| 52 assert(defined(invoker.toolchain_package), "Must define toolchain_package") |
| 53 assert(defined(invoker.toolchain_revision), "Must define toolchain_revision") |
| 54 forward_variables_from(invoker, |
| 55 [ |
| 56 "toolchain_package", |
| 57 "toolchain_revision", |
| 58 ]) |
| 59 |
| 60 toolprefix = rebase_path("${nacl_toolchain_dir}/${toolchain_package}/bin/" + |
| 61 invoker.toolchain_tuple + "-", |
| 62 root_build_dir) |
| 63 |
| 64 nacl_toolchain("glibc_" + toolchain_cpu) { |
| 65 is_clang = false |
| 66 is_nacl_glibc = true |
| 67 |
| 68 cc = toolprefix + "gcc" |
| 69 cxx = toolprefix + "g++" |
| 70 ar = toolprefix + "ar" |
| 71 ld = cxx |
| 72 } |
| 73 } |
| 74 |
| 75 nacl_glibc_toolchain("x86") { |
48 toolchain_package = "nacl_x86_glibc" | 76 toolchain_package = "nacl_x86_glibc" |
49 toolchain_revision = nacl_x86_glibc_rev | 77 toolchain_revision = nacl_x86_glibc_rev |
50 toolchain_cpu = "x86" | 78 toolchain_tuple = "i686-nacl" |
51 toolprefix = | |
52 rebase_path("${nacl_toolchain_dir}/${toolchain_package}/bin/i686-nacl-", | |
53 root_build_dir) | |
54 is_clang = false | |
55 is_nacl_glibc = true | |
56 | |
57 cc = toolprefix + "gcc" | |
58 cxx = toolprefix + "g++" | |
59 ar = toolprefix + "ar" | |
60 ld = cxx | |
61 } | 79 } |
62 | 80 |
63 nacl_toolchain("glibc_x64") { | 81 nacl_glibc_toolchain("x64") { |
64 toolchain_package = "nacl_x86_glibc" | 82 toolchain_package = "nacl_x86_glibc" |
65 toolchain_revision = nacl_x86_glibc_rev | 83 toolchain_revision = nacl_x86_glibc_rev |
66 toolchain_cpu = "x64" | 84 toolchain_tuple = "x86_64-nacl" |
67 toolprefix = | 85 } |
68 rebase_path("${nacl_toolchain_dir}/${toolchain_package}/bin/x86_64-nacl-", | |
69 root_build_dir) | |
70 is_clang = false | |
71 is_nacl_glibc = true | |
72 | 86 |
73 cc = toolprefix + "gcc" | 87 nacl_glibc_toolchain("arm") { |
74 cxx = toolprefix + "g++" | 88 toolchain_package = "nacl_arm_glibc" |
75 ar = toolprefix + "ar" | 89 toolchain_revision = nacl_arm_glibc_rev |
76 ld = cxx | 90 toolchain_tuple = "arm-nacl" |
77 } | 91 } |
78 | 92 |
79 template("nacl_clang_toolchain") { | 93 template("nacl_clang_toolchain") { |
80 toolchain_cpu = target_name | 94 toolchain_cpu = target_name |
81 assert(defined(invoker.toolchain_tuple), "Must define toolchain_tuple") | 95 assert(defined(invoker.toolchain_tuple), "Must define toolchain_tuple") |
82 | 96 |
83 toolchain_package = "pnacl_newlib" | 97 toolchain_package = "pnacl_newlib" |
84 toolchain_revision = pnacl_newlib_rev | 98 toolchain_revision = pnacl_newlib_rev |
85 toolprefix = rebase_path("${nacl_toolchain_dir}/${toolchain_package}/bin/" + | 99 toolprefix = rebase_path("${nacl_toolchain_dir}/${toolchain_package}/bin/" + |
86 invoker.toolchain_tuple + "-", | 100 invoker.toolchain_tuple + "-", |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 toolchain_tuple = "i686-nacl" | 164 toolchain_tuple = "i686-nacl" |
151 } | 165 } |
152 | 166 |
153 nacl_clang_toolchains("x64") { | 167 nacl_clang_toolchains("x64") { |
154 toolchain_tuple = "x86_64-nacl" | 168 toolchain_tuple = "x86_64-nacl" |
155 } | 169 } |
156 | 170 |
157 nacl_clang_toolchains("arm") { | 171 nacl_clang_toolchains("arm") { |
158 toolchain_tuple = "arm-nacl" | 172 toolchain_tuple = "arm-nacl" |
159 } | 173 } |
OLD | NEW |