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 # On Mac, this is usefor everything except static libraries. 6 config("mac_dynamic_flags") { 7 ldflags = [ 8 "-Wl,-search_paths_first", 9 ] 10 } 11 12 13 cc = "../../third_party/llvm-build/Release+Asserts/bin/clang" 14 cxx = "../../third_party/llvm-build/Release+Asserts/bin/clang++" 15 ld = cxx 16 17 toolchain("clang") { 18 tool("cc") { 19 command = "$cc -MMD -MF \$out.d \$defines \$includes \$cflags \$cflags_c \$cflags_pch_c -c \$in -o \$out" 20 description = "CC \$out" 21 depfile = "\$out.d" 22 deps = "gcc" 23 } 24 tool("cxx") { 25 command = "$cxx -MMD -MF \$out.d \$defines \$includes \$cflags \$cflags_cc \$cflags_pch_cc -c \$in -o \$out" 26 description = "CXX \$out" 27 depfile = "\$out.d" 28 deps = "gcc" 29 } 30 tool("objc") { 31 command = "$cc -MMD -MF \$out.d \$defines \$includes \$cflags \$cflags_c \$cflags_objc \$cflags_pch_objc -c \$in -o \$out" 32 description = "OBJC \$out" 33 depfile = "\$out.d" 34 deps = "gcc" 35 } 36 tool("objcxx") { 37 command = "$cxx -MMD -MF \$out.d \$defines \$includes \$cflags \$cflags_cc \$cflags_objcc \$cflags_pch_objcc -c \$in -o \$out" 38 description = "OBJCXX \$out" 39 depfile = "\$out.d" 40 deps = "gcc" 41 } 42 tool("alink") { 43 command = "rm -f \$out && ./gyp-mac-tool filter-libtool libtool \$libtool_flags -static -o \$out \$in \$postbuilds" 44 description = "LIBTOOL-STATIC \$out, POSTBUILDS" 45 } 46 tool("solink") { 47 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 \$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}.tmp && if ! cmp -s \${lib}.tmp \${lib}.TOC; then mv \${lib}.tmp \${lib}.TOC ; fi; fi" 48 description = "SOLINK \$lib, POSTBUILDS" 49 #pool = "link_pool" 50 restat = "1" 51 } 52 tool("link") { 53 command = "$ld \$ldflags -o \$out \$in \$solibs \$libs \$postbuilds" 54 description = "LINK \$out, POSTBUILDS" 55 #pool = "link_pool" 56 } 57 #tool("infoplist") { 58 # command = "$cc -E -P -Wno-trigraphs -x c \$defines \$in -o \$out && plutil -convert xml1 \$out \$out" 59 # description = "INFOPLIST \$out" 60 #} 61 #tool("mac_tool") { 62 # command = "\$env ./gyp-mac-tool \$mactool_cmd \$in \$out" 63 # description = "MACTOOL \$mactool_cmd \$in" 64 #} 65 #tool("package_framework") { 66 # command = "./gyp-mac-tool package-framework \$out \$version \$postbuilds && touch \$out" 67 # description = "PACKAGE FRAMEWORK \$out, POSTBUILDS" 68 #} 69 tool("stamp") { 70 command = "\${postbuilds}touch \$out" 71 description = "STAMP \$out" 72 } 73 tool("copy") { 74 command = "ln -f \$in \$out 2>/dev/null || (rm -rf \$out && cp -af \$in \$out)" 75 description = "COPY \$in \$out" 76 } 77 } 78