OLD | NEW |
| (Empty) |
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 | |
3 # found in the LICENSE file. | |
4 | |
5 # Should only be running on Mac. | |
6 assert(is_mac) | |
7 | |
8 cc = rebase_path("//third_party/llvm-build/Release+Asserts/bin/clang", ".", root
_build_dir) | |
9 cxx = rebase_path("//third_party/llvm-build/Release+Asserts/bin/clang++", ".", r
oot_build_dir) | |
10 ld = cxx | |
11 | |
12 # This will copy the gyp-mac-tool to the build directory. We pass in the source | |
13 # file of the win tool. | |
14 gyp_mac_tool_source = | |
15 rebase_path("//tools/gyp/pylib/gyp/mac_tool.py", ".", root_build_dir) | |
16 exec_script("setup_toolchain.py", [ gyp_mac_tool_source ], "value") | |
17 | |
18 toolchain("clang") { | |
19 # Make these apply to all tools below. | |
20 lib_prefix = "-l" | |
21 lib_dir_prefix="-L" | |
22 | |
23 tool("cc") { | |
24 command = "$cc -MMD -MF \$out.d \$defines \$includes \$cflags \$cflags_c \$c
flags_pch_c -c \$in -o \$out" | |
25 description = "CC \$out" | |
26 depfile = "\$out.d" | |
27 deps = "gcc" | |
28 } | |
29 tool("cxx") { | |
30 command = "$cxx -MMD -MF \$out.d \$defines \$includes \$cflags \$cflags_cc \
$cflags_pch_cc -c \$in -o \$out" | |
31 description = "CXX \$out" | |
32 depfile = "\$out.d" | |
33 deps = "gcc" | |
34 } | |
35 tool("objc") { | |
36 command = "$cc -MMD -MF \$out.d \$defines \$includes \$cflags \$cflags_c \$c
flags_objc \$cflags_pch_objc -c \$in -o \$out" | |
37 description = "OBJC \$out" | |
38 depfile = "\$out.d" | |
39 deps = "gcc" | |
40 } | |
41 tool("objcxx") { | |
42 command = "$cxx -MMD -MF \$out.d \$defines \$includes \$cflags \$cflags_cc \
$cflags_objcc \$cflags_pch_objcc -c \$in -o \$out" | |
43 description = "OBJCXX \$out" | |
44 depfile = "\$out.d" | |
45 deps = "gcc" | |
46 } | |
47 tool("alink") { | |
48 command = "rm -f \$out && ./gyp-mac-tool filter-libtool libtool \$libtool_fl
ags -static -o \$out \$in \$postbuilds" | |
49 description = "LIBTOOL-STATIC \$out, POSTBUILDS" | |
50 } | |
51 tool("solink") { | |
52 command = "if [ ! -e \$lib -o ! -e \${lib}.TOC ] || otool -l \$lib | grep -q
LC_REEXPORT_DYLIB ; then $ld -shared \$ldflags -o \$lib \$in \$solibs \$libs \$
postbuilds && { otool -l \$lib | grep LC_ID_DYLIB -A 5; nm -gP \$lib | cut -f1-2
-d' ' | grep -v U\$\$; true; } > \${lib}.TOC; else $ld -shared \$ldflags -o \$l
ib \$in \$solibs \$libs \$postbuilds && { otool -l \$lib | grep LC_ID_DYLIB -A 5
; nm -gP \$lib | cut -f1-2 -d' ' | grep -v U\$\$; true; } > \${lib}.tmp && if !
cmp -s \${lib}.tmp \${lib}.TOC; then mv \${lib}.tmp \${lib}.TOC ; fi; fi" | |
53 description = "SOLINK \$lib, POSTBUILDS" | |
54 #pool = "link_pool" | |
55 restat = "1" | |
56 } | |
57 tool("link") { | |
58 command = "$ld \$ldflags -o \$out \$in \$solibs \$libs \$postbuilds" | |
59 description = "LINK \$out, POSTBUILDS" | |
60 #pool = "link_pool" | |
61 } | |
62 #tool("infoplist") { | |
63 # command = "$cc -E -P -Wno-trigraphs -x c \$defines \$in -o \$out && plutil
-convert xml1 \$out \$out" | |
64 # description = "INFOPLIST \$out" | |
65 #} | |
66 #tool("mac_tool") { | |
67 # command = "\$env ./gyp-mac-tool \$mactool_cmd \$in \$out" | |
68 # description = "MACTOOL \$mactool_cmd \$in" | |
69 #} | |
70 #tool("package_framework") { | |
71 # command = "./gyp-mac-tool package-framework \$out \$version \$postbuilds &&
touch \$out" | |
72 # description = "PACKAGE FRAMEWORK \$out, POSTBUILDS" | |
73 #} | |
74 tool("stamp") { | |
75 command = "\${postbuilds}touch \$out" | |
76 description = "STAMP \$out" | |
77 } | |
78 tool("copy") { | |
79 command = "ln -f \$in \$out 2>/dev/null || (rm -rf \$out && cp -af \$in \$ou
t)" | |
80 description = "COPY \$in \$out" | |
81 } | |
82 } | |
OLD | NEW |