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

Side by Side Diff: build/toolchain/gcc_toolchain.gni

Issue 1128903005: Enable cross compile to android from mac. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
OLDNEW
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2013 The Chromium 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 # This value will be inherited in the toolchain below. 5 # This value will be inherited in the toolchain below.
6 concurrent_links = exec_script("get_concurrent_links.py", [], "value") 6 concurrent_links = exec_script("get_concurrent_links.py", [], "value")
7 7
8 # This template defines a toolchain for something that works like gcc 8 # This template defines a toolchain for something that works like gcc
9 # (including clang). 9 # (including clang).
10 # 10 #
11 # It requires the following variables specifying the executables to run: 11 # It requires the following variables specifying the executables to run:
12 # - cc 12 # - cc
13 # - cxx 13 # - cxx
14 # - ar 14 # - ar
15 # - ld 15 # - ld
16 # - readelf
17 # - nm
16 # and the following which is used in the toolchain_args 18 # and the following which is used in the toolchain_args
17 # - toolchain_cpu (What "current_cpu" should be set to when invoking a 19 # - toolchain_cpu (What "current_cpu" should be set to when invoking a
18 # build using this toolchain.) 20 # build using this toolchain.)
19 # - toolchain_os (What "current_os" should be set to when invoking a 21 # - toolchain_os (What "current_os" should be set to when invoking a
20 # build using this toolchain.) 22 # build using this toolchain.)
21 # 23 #
22 # Optional parameters: 24 # Optional parameters:
23 # - libs_section_prefix 25 # - libs_section_prefix
24 # - libs_section_postfix 26 # - libs_section_postfix
25 # The contents of these strings, if specified, will be placed around 27 # The contents of these strings, if specified, will be placed around
26 # the libs section of the linker line. It allows one to inject libraries 28 # the libs section of the linker line. It allows one to inject libraries
27 # at the beginning and end for all targets in a toolchain. 29 # at the beginning and end for all targets in a toolchain.
28 # - solink_libs_section_prefix 30 # - solink_libs_section_prefix
29 # - solink_libs_section_postfix 31 # - solink_libs_section_postfix
30 # Same as libs_section_{pre,post}fix except used for solink instead of link . 32 # Same as libs_section_{pre,post}fix except used for solink instead of link .
31 # - post_solink 33 # - post_solink
32 # The content of this string, if specified, will be appended to the solink 34 # The content of this string, if specified, will be appended to the solink
33 # command. 35 # command.
34 # - deps 36 # - deps
35 # Just forwarded to the toolchain definition. 37 # Just forwarded to the toolchain definition.
36 # - is_clang 38 # - is_clang
37 template("gcc_toolchain") { 39 template("gcc_toolchain") {
38 toolchain(target_name) { 40 toolchain(target_name) {
39 assert(defined(invoker.cc), "gcc_toolchain() must specify a \"cc\" value") 41 assert(defined(invoker.cc), "gcc_toolchain() must specify a \"cc\" value")
40 assert(defined(invoker.cxx), "gcc_toolchain() must specify a \"cxx\" value") 42 assert(defined(invoker.cxx), "gcc_toolchain() must specify a \"cxx\" value")
41 assert(defined(invoker.ar), "gcc_toolchain() must specify a \"ar\" value") 43 assert(defined(invoker.ar), "gcc_toolchain() must specify a \"ar\" value")
42 assert(defined(invoker.ld), "gcc_toolchain() must specify a \"ld\" value") 44 assert(defined(invoker.ld), "gcc_toolchain() must specify a \"ld\" value")
45 assert(defined(invoker.readelf),
46 "gcc_toolchain() must specify a \"readelf\" value")
47 assert(defined(invoker.nm), "gcc_toolchain() must specify a \"nm\" value")
43 assert(defined(invoker.toolchain_cpu), 48 assert(defined(invoker.toolchain_cpu),
44 "gcc_toolchain() must specify a \"toolchain_cpu\"") 49 "gcc_toolchain() must specify a \"toolchain_cpu\"")
45 assert(defined(invoker.toolchain_os), 50 assert(defined(invoker.toolchain_os),
46 "gcc_toolchain() must specify a \"toolchain_os\"") 51 "gcc_toolchain() must specify a \"toolchain_os\"")
47 52
48 # We can't do string interpolation ($ in strings) on things with dots in 53 # We can't do string interpolation ($ in strings) on things with dots in
49 # them. To allow us to use $cc below, for example, we create copies of 54 # them. To allow us to use $cc below, for example, we create copies of
50 # these values in our scope. 55 # these values in our scope.
51 cc = invoker.cc 56 cc = invoker.cc
52 cxx = invoker.cxx 57 cxx = invoker.cxx
53 ar = invoker.ar 58 ar = invoker.ar
54 ld = invoker.ld 59 ld = invoker.ld
60 readelf = invoker.readelf
61 nm = invoker.nm
55 62
56 # Bring these into our scope for string interpolation with default values. 63 # Bring these into our scope for string interpolation with default values.
57 if (defined(invoker.libs_section_prefix)) { 64 if (defined(invoker.libs_section_prefix)) {
58 libs_section_prefix = invoker.libs_section_prefix 65 libs_section_prefix = invoker.libs_section_prefix
59 } else { 66 } else {
60 libs_section_prefix = "" 67 libs_section_prefix = ""
61 } 68 }
62 69
63 if (defined(invoker.libs_section_postfix)) { 70 if (defined(invoker.libs_section_postfix)) {
64 libs_section_postfix = invoker.libs_section_postfix 71 libs_section_postfix = invoker.libs_section_postfix
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 rspfile = sofile + ".rsp" 138 rspfile = sofile + ".rsp"
132 139
133 # These variables are not built into GN but are helpers that implement 140 # These variables are not built into GN but are helpers that implement
134 # (1) linking to produce a .so, (2) extracting the symbols from that file 141 # (1) linking to produce a .so, (2) extracting the symbols from that file
135 # to a temporary file, (3) if the temporary file has differences from the 142 # to a temporary file, (3) if the temporary file has differences from the
136 # existing .TOC file, overwrite it, otherwise, don't change it. 143 # existing .TOC file, overwrite it, otherwise, don't change it.
137 tocfile = sofile + ".TOC" 144 tocfile = sofile + ".TOC"
138 temporary_tocname = sofile + ".tmp" 145 temporary_tocname = sofile + ".tmp"
139 link_command = 146 link_command =
140 "$ld -shared {{ldflags}} -o $sofile -Wl,-soname=$soname @$rspfile" 147 "$ld -shared {{ldflags}} -o $sofile -Wl,-soname=$soname @$rspfile"
141 toc_command = "{ readelf -d $sofile | grep SONAME ; nm -gD -f p $sofile | cut -f1-2 -d' '; } > $temporary_tocname" 148 toc_command = "{ $readelf -d $sofile | grep SONAME ; $nm -gD -f p $sofile | cut -f1-2 -d' '; } > $temporary_tocname"
142 replace_command = "if ! cmp -s $temporary_tocname $tocfile; then mv $tempo rary_tocname $tocfile; fi" 149 replace_command = "if ! cmp -s $temporary_tocname $tocfile; then mv $tempo rary_tocname $tocfile; fi"
143 150
144 command = "$link_command && $toc_command && $replace_command" 151 command = "$link_command && $toc_command && $replace_command"
145 if (defined(invoker.postsolink)) { 152 if (defined(invoker.postsolink)) {
146 command += " && " + invoker.postsolink 153 command += " && " + invoker.postsolink
147 } 154 }
148 rspfile_content = "-Wl,--whole-archive {{inputs}} {{solibs}} -Wl,--no-whol e-archive $solink_libs_section_prefix {{libs}} $solink_libs_section_postfix" 155 rspfile_content = "-Wl,--whole-archive {{inputs}} {{solibs}} -Wl,--no-whol e-archive $solink_libs_section_prefix {{libs}} $solink_libs_section_postfix"
149 156
150 description = "SOLINK $sofile" 157 description = "SOLINK $sofile"
151 158
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 if (defined(invoker.is_clang)) { 221 if (defined(invoker.is_clang)) {
215 is_clang = invoker.is_clang 222 is_clang = invoker.is_clang
216 } 223 }
217 } 224 }
218 225
219 if (defined(invoker.deps)) { 226 if (defined(invoker.deps)) {
220 deps = invoker.deps 227 deps = invoker.deps
221 } 228 }
222 } 229 }
223 } 230 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698