summaryrefslogtreecommitdiffstats
path: root/chromium/build/toolchain/linux/BUILD.gn
blob: ffb378beb8814a339572a0948f23be869cc0afde (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

cc = "gcc"
cxx = "g++"
ar = "ar"
ld = cxx

# The toolchains below all issue the same commands with some different flags.
# TODO(brettw) it would be nice to have a different way to express this without
# so much duplication.
cc_command = "$cc -MMD -MF \$out.d \$defines \$includes \$cflags \$cflags_c -c \$in -o \$out"
cxx_command = "$cxx -MMD -MF \$out.d \$defines \$includes \$cflags \$cflags_cc -c \$in -o \$out"
alink_command = "rm -f \$out && $ar rcs \$out \$in"
solink_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"
link_command = "$ld \$ldflags -o \$out -Wl,--start-group \$in \$solibs -Wl,--end-group \$libs"
stamp_command = "\${postbuilds}touch \$out"
copy_command = "ln -f \$in \$out 2>/dev/null || (rm -rf \$out && cp -af \$in \$out)"

# ARM --------------------------------------------------------------------------

cc = "arm-linux-gnueabi-gcc"
cxx = "arm-linux-gnueabi-g++"
ar = "arm-linux-gnueabi-ar"
ld = cxx

toolchain("arm") {
  # Make these apply to all tools below.
  lib_prefix = "-l"
  lib_dir_prefix="-L"

  tool("cc") {
    # cflags_pch_c
    command = cc_command
    description = "CC \$out"
    depfile = "\$out.d"
    deps = "gcc"
  }
  tool("cxx") {
    # cflags_pch_cc
    command = cxx_command
    description = "CXX \$out"
    depfile = "\$out.d"
    deps = "gcc"
  }
  tool("alink") {
    command = alink_command
    description = "AR \$out"
  }
  tool("solink") {
    command = solink_command
    description = "SOLINK \$lib"
    #pool = "link_pool"
    restat = "1"
  }
  tool("link") {
    command = link_command
    description = "LINK \$out"
    #pool = "link_pool"
  }
  tool("stamp") {
    command = stamp_command
    description = "STAMP \$out"
  }
  tool("copy") {
    command = copy_command
    description = "COPY \$in \$out"
  }

  # When invoking this toolchain not as the default one, these args will be
  # passed to the build. They are ignored when this is the default toolchain.
  toolchain_args() {
    cpu_arch = "arm"
  }
}

# 32-bit -----------------------------------------------------------------------

toolchain("32") {
  # Make these apply to all tools below.
  lib_prefix = "-l"
  lib_dir_prefix="-L"

  tool("cc") {
    # cflags_pch_c
    command = cc_command
    description = "CC \$out"
    depfile = "\$out.d"
    deps = "gcc"
  }
  tool("cxx") {
    # cflags_pch_cc
    command = cxx_command
    description = "CXX \$out"
    depfile = "\$out.d"
    deps = "gcc"
  }
  tool("alink") {
    command = alink_command
    description = "AR \$out"
  }
  tool("solink") {
    command = solink_command
    description = "SOLINK \$lib"
    #pool = "link_pool"
    restat = "1"
  }
  tool("link") {
    command = link_command
    description = "LINK \$out"
    #pool = "link_pool"
  }
  tool("stamp") {
    command = stamp_command
    description = "STAMP \$out"
  }
  tool("copy") {
    command = copy_command
    description = "COPY \$in \$out"
  }

  # When invoking this toolchain not as the default one, these args will be
  # passed to the build. They are ignored when this is the default toolchain.
  toolchain_args() {
    cpu_arch = "x32"
  }
}

# 64-bit -----------------------------------------------------------------------

toolchain("64") {
  # Make these apply to all tools below.
  lib_prefix = "-l"
  lib_dir_prefix="-L"

  tool("cc") {
    # cflags_pch_c
    command = cc_command
    description = "CC \$out"
    depfile = "\$out.d"
    deps = "gcc"
  }
  tool("cxx") {
    # cflags_pch_cc
    command = cxx_command
    description = "CXX \$out"
    depfile = "\$out.d"
    deps = "gcc"
  }
  tool("alink") {
    command = alink_command
    description = "AR \$out"
  }
  tool("solink") {
    command = solink_command
    description = "SOLINK \$lib"
    #pool = "link_pool"
    restat = "1"
  }
  tool("link") {
    command = link_command
    description = "LINK \$out"
    #pool = "link_pool"
  }
  tool("stamp") {
    command = stamp_command
    description = "STAMP \$out"
  }
  tool("copy") {
    command = copy_command
    description = "COPY \$in \$out"
  }

  # When invoking this toolchain not as the default one, these args will be
  # passed to the build. They are ignored when this is the default toolchain.
  toolchain_args() {
    cpu_arch = "x64"
  }
}