OLD | NEW |
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 # TODO(brettw) Use "gcc_toolchain.gni" like the Linux toolchains. This requires | 5 # TODO(brettw) Use "gcc_toolchain.gni" like the Linux toolchains. This requires |
6 # some enhancements since the commands on Mac are slightly different than on | 6 # some enhancements since the commands on Mac are slightly different than on |
7 # Linux. | 7 # Linux. |
8 | 8 |
9 import("../goma.gni") | 9 import("../goma.gni") |
10 import("//build/config/mac/mac_sdk.gni") | 10 import("//build/config/mac/mac_sdk.gni") |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 # tocname for dependency management. | 164 # tocname for dependency management. |
165 outputs = [ | 165 outputs = [ |
166 dylib, | 166 dylib, |
167 tocname, | 167 tocname, |
168 ] | 168 ] |
169 link_output = dylib | 169 link_output = dylib |
170 depend_output = tocname | 170 depend_output = tocname |
171 } | 171 } |
172 | 172 |
173 tool("link") { | 173 tool("link") { |
174 outfile = "{{root_out_dir}}/{{target_output_name}}{{output_extension}}" | 174 exename = "{{target_output_name}}{{output_extension}}" |
| 175 outfile = "{{root_out_dir}}/$exename" |
175 rspfile = "$outfile.rsp" | 176 rspfile = "$outfile.rsp" |
176 | 177 |
| 178 if (defined(invoker.strip)) { |
| 179 stripped_outfile = "{{root_out_dir}}/exe.stripped/$exename" |
| 180 } |
| 181 |
177 command = "$ld $sysroot_flags $toolchain_flags {{ldflags}} -Xlinker -rpath
-Xlinker @executable_path/Frameworks -o $outfile -Wl,-filelist,$rspfile {{solib
s}} {{libs}}" | 182 command = "$ld $sysroot_flags $toolchain_flags {{ldflags}} -Xlinker -rpath
-Xlinker @executable_path/Frameworks -o $outfile -Wl,-filelist,$rspfile {{solib
s}} {{libs}}" |
| 183 if (defined(invoker.strip)) { |
| 184 strip = invoker.strip |
| 185 strip_command = "${strip} -x -o $stripped_outfile $outfile" |
| 186 command += " && " + strip_command |
| 187 } |
| 188 |
178 description = "LINK $outfile" | 189 description = "LINK $outfile" |
179 rspfile_content = "{{inputs_newline}}" | 190 rspfile_content = "{{inputs_newline}}" |
180 outputs = [ | 191 outputs = [ |
181 outfile, | 192 outfile, |
182 ] | 193 ] |
| 194 if (defined(invoker.strip)) { |
| 195 outputs += [ stripped_outfile ] |
| 196 } |
183 } | 197 } |
184 | 198 |
185 tool("stamp") { | 199 tool("stamp") { |
186 command = "touch {{output}}" | 200 command = "touch {{output}}" |
187 description = "STAMP {{output}}" | 201 description = "STAMP {{output}}" |
188 } | 202 } |
189 | 203 |
190 tool("copy") { | 204 tool("copy") { |
191 command = "ln -f {{source}} {{output}} 2>/dev/null || (rm -rf {{output}} &
& cp -af {{source}} {{output}})" | 205 command = "ln -f {{source}} {{output}} 2>/dev/null || (rm -rf {{output}} &
& cp -af {{source}} {{output}})" |
192 description = "COPY {{source}} {{output}}" | 206 description = "COPY {{source}} {{output}}" |
(...skipping 16 matching lines...) Expand all Loading... |
209 | 223 |
210 # Toolchain used for Mac host targets. | 224 # Toolchain used for Mac host targets. |
211 mac_toolchain("clang_x64") { | 225 mac_toolchain("clang_x64") { |
212 toolchain_cpu = "x64" | 226 toolchain_cpu = "x64" |
213 toolchain_os = "mac" | 227 toolchain_os = "mac" |
214 prefix = rebase_path("//buildtools/toolchain/clang+llvm-x86_64-darwin/bin", | 228 prefix = rebase_path("//buildtools/toolchain/clang+llvm-x86_64-darwin/bin", |
215 root_build_dir) | 229 root_build_dir) |
216 cc = "${goma_prefix}$prefix/clang" | 230 cc = "${goma_prefix}$prefix/clang" |
217 cxx = "${goma_prefix}$prefix/clang++" | 231 cxx = "${goma_prefix}$prefix/clang++" |
218 ld = cxx | 232 ld = cxx |
| 233 strip = "${prefix}/strip" |
219 is_clang = true | 234 is_clang = true |
220 sysroot_flags = "-isysroot $mac_sdk_path -mmacosx-version-min=$mac_sdk_min" | 235 sysroot_flags = "-isysroot $mac_sdk_path -mmacosx-version-min=$mac_sdk_min" |
221 } | 236 } |
222 | 237 |
223 # Toolchain used for Mac host (i386) targets. | 238 # Toolchain used for Mac host (i386) targets. |
224 mac_toolchain("clang_x86") { | 239 mac_toolchain("clang_x86") { |
225 toolchain_cpu = "i386" | 240 toolchain_cpu = "i386" |
226 toolchain_os = "mac" | 241 toolchain_os = "mac" |
227 prefix = rebase_path("//buildtools/toolchain/clang+llvm-x86_64-darwin/bin", | 242 prefix = rebase_path("//buildtools/toolchain/clang+llvm-x86_64-darwin/bin", |
228 root_build_dir) | 243 root_build_dir) |
229 cc = "${goma_prefix}$prefix/clang" | 244 cc = "${goma_prefix}$prefix/clang" |
230 cxx = "${goma_prefix}$prefix/clang++" | 245 cxx = "${goma_prefix}$prefix/clang++" |
231 ld = cxx | 246 ld = cxx |
| 247 strip = "${prefix}/strip" |
232 is_clang = true | 248 is_clang = true |
233 sysroot_flags = "-isysroot $mac_sdk_path -mmacosx-version-min=$mac_sdk_min" | 249 sysroot_flags = "-isysroot $mac_sdk_path -mmacosx-version-min=$mac_sdk_min" |
234 } | 250 } |
OLD | NEW |