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

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

Issue 1418653002: Synchronize GN build configuration with Chrome (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Review feedback addressed Created 5 years, 2 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/toolchain/mac/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) 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/toolchain/nacl_toolchain.gni") 7 import("//build/toolchain/nacl_toolchain.gni")
7 8
8 nacl_toolchain_dir = rebase_path("//native_client/toolchain", root_build_dir)
9 os_toolchain_dir = "${nacl_toolchain_dir}/${host_os}_x86"
10
11 # 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
12 # rebuilt when a toolchain is updated. 10 # rebuilt when a toolchain is updated.
13 # 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
14 # bugged and does not trigger a rebuild. 12 # bugged and does not trigger a rebuild.
15 # https://code.google.com/p/chromium/issues/detail?id=431880 13 # 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 14 # Calls to get the toolchain revision are relatively slow, so do them all in a
17 # single batch to amortize python startup, etc. 15 # single batch to amortize python startup, etc.
18 revisions = exec_script("//native_client/build/get_toolchain_revision.py", 16 revisions = exec_script("//native_client/build/get_toolchain_revision.py",
19 [ 17 [
20 "nacl_x86_glibc", 18 "nacl_x86_glibc",
21 "pnacl_newlib", 19 "pnacl_newlib",
22 ], 20 ],
23 "trim list lines") 21 "trim list lines")
24 nacl_x86_glibc_rev = revisions[0] 22 nacl_x86_glibc_rev = revisions[0]
25 pnacl_newlib_rev = revisions[1] 23 pnacl_newlib_rev = revisions[1]
26 24
27 nacl_toolchain("newlib_pnacl") { 25 nacl_toolchain("newlib_pnacl") {
28 toolchain_package = "pnacl_newlib" 26 toolchain_package = "pnacl_newlib"
29 toolchain_revision = pnacl_newlib_rev 27 toolchain_revision = pnacl_newlib_rev
30 toolchain_cpu = "pnacl" 28 toolchain_cpu = "pnacl"
31 toolprefix = "${os_toolchain_dir}/${toolchain_package}/bin/pnacl-" 29 toolprefix =
30 rebase_path("${nacl_toolchain_dir}/${toolchain_package}/bin/pnacl-",
31 root_build_dir)
32 32
33 cc = toolprefix + "clang" 33 cc = toolprefix + "clang"
34 cxx = toolprefix + "clang++" 34 cxx = toolprefix + "clang++"
35 ar = toolprefix + "ar" 35 ar = toolprefix + "ar"
36 ld = cxx 36 ld = cxx
37 executable_extension = ".pexe.debug" 37 executable_extension = ".pexe.debug"
38 38
39 finalize = toolprefix + "finalize" 39 finalize = toolprefix + "finalize"
40 nonfinal_file = 40 nonfinal_file =
41 "{{root_out_dir}}/{{target_output_name}}${executable_extension}" 41 "{{root_out_dir}}/{{target_output_name}}${executable_extension}"
42 finalized_file = "{{root_out_dir}}/{{target_output_name}}.pexe" 42 finalized_file = "{{root_out_dir}}/{{target_output_name}}.pexe"
43 postlink = "$finalize $nonfinal_file -o $finalized_file" 43 postlink = "$finalize $nonfinal_file -o $finalized_file"
44 link_outputs = [ finalized_file ] 44 link_outputs = [ finalized_file ]
45 } 45 }
46 46
47 nacl_toolchain("glibc_x86") { 47 nacl_toolchain("glibc_x86") {
48 toolchain_package = "nacl_x86_glibc" 48 toolchain_package = "nacl_x86_glibc"
49 toolchain_revision = nacl_x86_glibc_rev 49 toolchain_revision = nacl_x86_glibc_rev
50 toolchain_cpu = "x86" 50 toolchain_cpu = "x86"
51 toolprefix = "${os_toolchain_dir}/${toolchain_package}/bin/i686-nacl-" 51 toolprefix =
52 rebase_path("${nacl_toolchain_dir}/${toolchain_package}/bin/i686-nacl-",
53 root_build_dir)
52 is_clang = false 54 is_clang = false
53 is_nacl_glibc = true 55 is_nacl_glibc = true
54 56
55 cc = toolprefix + "gcc" 57 cc = toolprefix + "gcc"
56 cxx = toolprefix + "g++" 58 cxx = toolprefix + "g++"
57 ar = toolprefix + "ar" 59 ar = toolprefix + "ar"
58 ld = cxx 60 ld = cxx
59 } 61 }
60 62
61 nacl_toolchain("glibc_x64") { 63 nacl_toolchain("glibc_x64") {
62 toolchain_package = "nacl_x86_glibc" 64 toolchain_package = "nacl_x86_glibc"
63 toolchain_revision = nacl_x86_glibc_rev 65 toolchain_revision = nacl_x86_glibc_rev
64 toolchain_cpu = "x64" 66 toolchain_cpu = "x64"
65 toolprefix = "${os_toolchain_dir}/${toolchain_package}/bin/x86_64-nacl-" 67 toolprefix =
68 rebase_path("${nacl_toolchain_dir}/${toolchain_package}/bin/x86_64-nacl-",
69 root_build_dir)
66 is_clang = false 70 is_clang = false
67 is_nacl_glibc = true 71 is_nacl_glibc = true
68 72
69 cc = toolprefix + "gcc" 73 cc = toolprefix + "gcc"
70 cxx = toolprefix + "g++" 74 cxx = toolprefix + "g++"
71 ar = toolprefix + "ar" 75 ar = toolprefix + "ar"
72 ld = cxx 76 ld = cxx
73 } 77 }
74 78
75 template("nacl_clang_toolchain") { 79 template("nacl_clang_toolchain") {
76 toolchain_cpu = target_name 80 toolchain_cpu = target_name
77 assert(defined(invoker.toolchain_tuple), "Must define toolchain_tuple") 81 assert(defined(invoker.toolchain_tuple), "Must define toolchain_tuple")
78 82
79 toolchain_package = "pnacl_newlib" 83 toolchain_package = "pnacl_newlib"
80 toolchain_revision = pnacl_newlib_rev 84 toolchain_revision = pnacl_newlib_rev
81 toolprefix = "${os_toolchain_dir}/${toolchain_package}/bin/" + 85 toolprefix = rebase_path("${nacl_toolchain_dir}/${toolchain_package}/bin/" +
82 invoker.toolchain_tuple + "-" 86 invoker.toolchain_tuple + "-",
87 root_build_dir)
83 88
84 nacl_toolchain("clang_newlib_" + toolchain_cpu) { 89 nacl_toolchain("clang_newlib_" + toolchain_cpu) {
85 is_clang = true 90 is_clang = true
86 cc = toolprefix + "clang" 91 cc = toolprefix + "clang"
87 cxx = toolprefix + "clang++" 92 cxx = toolprefix + "clang++"
88 ar = toolprefix + "ar" 93 ar = toolprefix + "ar"
89 ld = cxx 94 ld = cxx
90 } 95 }
91 } 96 }
92 97
93 template("nacl_irt_toolchain") { 98 template("nacl_irt_toolchain") {
94 toolchain_cpu = target_name 99 toolchain_cpu = target_name
95 assert(defined(invoker.toolchain_tuple), "Must define toolchain_tuple") 100 assert(defined(invoker.toolchain_tuple), "Must define toolchain_tuple")
96 101
97 toolchain_package = "pnacl_newlib" 102 toolchain_package = "pnacl_newlib"
98 toolchain_revision = pnacl_newlib_rev 103 toolchain_revision = pnacl_newlib_rev
99 toolprefix = "${os_toolchain_dir}/${toolchain_package}/bin/" + 104 toolprefix = rebase_path("${nacl_toolchain_dir}/${toolchain_package}/bin/" +
100 invoker.toolchain_tuple + "-" 105 invoker.toolchain_tuple + "-",
106 root_build_dir)
101 107
102 link_irt = rebase_path("//native_client/build/link_irt.py", root_build_dir) 108 link_irt = rebase_path("//native_client/build/link_irt.py", root_build_dir)
103 109
104 tls_edit_label = 110 tls_edit_label =
105 "//native_client/src/tools/tls_edit:tls_edit($host_toolchain)" 111 "//native_client/src/tools/tls_edit:tls_edit($host_toolchain)"
106 host_toolchain_out_dir = 112 host_toolchain_out_dir =
107 rebase_path(get_label_info(tls_edit_label, "root_out_dir"), 113 rebase_path(get_label_info(tls_edit_label, "root_out_dir"),
108 root_build_dir) 114 root_build_dir)
109 tls_edit = "${host_toolchain_out_dir}/tls_edit" 115 tls_edit = "${host_toolchain_out_dir}/tls_edit"
110 116
111 nacl_toolchain("irt_" + toolchain_cpu) { 117 nacl_toolchain("irt_" + toolchain_cpu) {
112 is_clang = true 118 is_clang = true
113 cc = toolprefix + "clang" 119 cc = toolprefix + "clang"
114 cxx = toolprefix + "clang++" 120 cxx = toolprefix + "clang++"
115 ar = toolprefix + "ar" 121 ar = toolprefix + "ar"
116 readelf = toolprefix + "readelf" 122 readelf = toolprefix + "readelf"
117 123
124 # Always build the IRT with full debugging symbols, regardless of
125 # how Chromium itself is being built (or other NaCl executables).
126 symbol_level = 2
127
118 # Some IRT implementations (notably, Chromium's) contain C++ code, 128 # Some IRT implementations (notably, Chromium's) contain C++ code,
119 # so we need to link w/ the C++ linker. 129 # so we need to link w/ the C++ linker.
120 ld = "${python_path} ${link_irt} --tls-edit=${tls_edit} --link-cmd=${cxx} -- readelf-cmd=${readelf}" 130 ld = "${python_path} ${link_irt} --tls-edit=${tls_edit} --link-cmd=${cxx} -- readelf-cmd=${readelf}"
121 131
122 # TODO(ncbray): depend on link script 132 # TODO(ncbray): depend on link script
123 deps = [ 133 deps = [
124 tls_edit_label, 134 tls_edit_label,
125 ] 135 ]
126 } 136 }
127 } 137 }
(...skipping 12 matching lines...) Expand all
140 toolchain_tuple = "i686-nacl" 150 toolchain_tuple = "i686-nacl"
141 } 151 }
142 152
143 nacl_clang_toolchains("x64") { 153 nacl_clang_toolchains("x64") {
144 toolchain_tuple = "x86_64-nacl" 154 toolchain_tuple = "x86_64-nacl"
145 } 155 }
146 156
147 nacl_clang_toolchains("arm") { 157 nacl_clang_toolchains("arm") {
148 toolchain_tuple = "arm-nacl" 158 toolchain_tuple = "arm-nacl"
149 } 159 }
OLDNEW
« no previous file with comments | « build/toolchain/mac/BUILD.gn ('k') | build/toolchain/nacl_toolchain.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698