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 6 toolchain("x86_newlib") { 7 toolprefix = "gen/sdk/toolchain/linux_x86_newlib/bin/x86_64-nacl-" 8 cc = toolprefix + "gcc" 9 cxx = toolprefix + "g++" 10 ld = toolprefix + "g++" 11 12 tool("cc") { 13 command = "$cc -MMD -MF \$out.d \$defines \$includes \$cflags \$cflags_c -c \$in -o \$out" 14 description = "CC(NaCl x86 Newlib) \$out" 15 depfile = "\$out.d" 16 deps = "gcc" 17 } 18 tool("cxx") { 19 # cflags_pch_cc 20 command = "$cxx -MMD -MF \$out.d \$defines \$includes \$cflags \$cflags_cc -c \$in -o \$out" 21 description = "CXX(NaCl x86 Newlib) \$out" 22 depfile = "\$out.d" 23 deps = "gcc" 24 } 25 tool("alink") { 26 command = "rm -f \$out && ${toolprefix}ar rcs \$out \$in" 27 description = "AR(NaCl x86 Newlib) \$out" 28 } 29 tool("solink") { 30 command = "if [ ! -e \$lib -o ! -e \${lib}.TOC ]; then $ld -shared \$ldflags -o \$lib -Wl,-soname=\$soname -Wl,--whole-archive \$in \$solibs -Wl,--no-whole-archive \$libs && { readelf -d \${lib} | grep SONAME ; nm -gD -f p \${lib} | cut -f1-2 -d' '; } > \${lib}.TOC; else $ld -shared \$ldflags -o \$lib -Wl,-soname=\$soname -Wl,--whole-archive \$in \$solibs -Wl,--no-whole-archive \$libs && { readelf -d \${lib} | grep SONAME ; nm -gD -f p \${lib} | cut -f1-2 -d' '; } > \${lib}.tmp && if ! cmp -s \${lib}.tmp \${lib}.TOC; then mv \${lib}.tmp \${lib}.TOC ; fi; fi" 31 description = "SOLINK(NaCl x86 Newlib) \$lib" 32 #pool = "link_pool" 33 restat = "1" 34 } 35 tool("link") { 36 command = "$ld \$ldflags -o \$out -Wl,--start-group \$in \$solibs -Wl,--end-group \$libs" 37 description = "LINK(NaCl x86 Newlib) \$out" 38 #pool = "link_pool" 39 } 40 41 if (is_win) { 42 tool("stamp") { 43 command = "$python_path gyp-win-tool stamp \$out" 44 description = "STAMP \$out" 45 } 46 } else { 47 tool("stamp") { 48 command = "touch \$out" 49 description = "STAMP \$out" 50 } 51 } 52 53 toolchain_args() { 54 # Override the default OS detection. The build config will set the is_* 55 # flags accordingly. 56 os = "nacl" 57 58 # Component build not supported in NaCl, since it does not support shared 59 # libraries. 60 is_component_build = false 61 } 62 } 63