Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(139)

Side by Side Diff: build/toolchain/mac/BUILD.gn

Issue 1386783003: [GN]: Support for loadable modules (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: unit tests Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/ios/ios_sdk.gni") 10 import("//build/config/ios/ios_sdk.gni")
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 ] 111 ]
112 default_output_extension = ".a" 112 default_output_extension = ".a"
113 output_prefix = "lib" 113 output_prefix = "lib"
114 } 114 }
115 115
116 tool("solink") { 116 tool("solink") {
117 dylib = "{{root_out_dir}}/{{target_output_name}}{{output_extension}}" # e g "./libfoo.dylib" 117 dylib = "{{root_out_dir}}/{{target_output_name}}{{output_extension}}" # e g "./libfoo.dylib"
118 rspfile = dylib + ".rsp" 118 rspfile = dylib + ".rsp"
119 119
120 # These variables are not built into GN but are helpers that implement 120 # These variables are not built into GN but are helpers that implement
121 # (1) linking to produce a .so, (2) extracting the symbols from that file 121 # (1) linking to produce a .dylib, (2) extracting the symbols from that
122 # to a temporary file, (3) if the temporary file has differences from the 122 # file to a temporary file, (3) if the temporary file has differences from
123 # existing .TOC file, overwrite it, otherwise, don't change it. 123 # the existing .TOC file, overwrite it, otherwise, don't change it.
124 # 124 #
125 # As a special case, if the library reexports symbols from other dynamic 125 # As a special case, if the library reexports symbols from other dynamic
126 # libraries, we always update the .TOC and skip the temporary file and 126 # libraries, we always update the .TOC and skip the temporary file and
127 # diffing steps, since that library always needs to be re-linked. 127 # diffing steps, since that library always needs to be re-linked.
128 tocname = dylib + ".TOC" 128 tocname = dylib + ".TOC"
129 temporary_tocname = dylib + ".tmp" 129 temporary_tocname = dylib + ".tmp"
130 130
131 does_reexport_command = "[ ! -e $dylib -o ! -e $tocname ] || otool -l $dyl ib | grep -q LC_REEXPORT_DYLIB" 131 does_reexport_command = "[ ! -e $dylib -o ! -e $tocname ] || otool -l $dyl ib | grep -q LC_REEXPORT_DYLIB"
132 132
133 link_command = "$ld -shared {{ldflags}} -o $dylib -Wl,-filelist,$rspfile" 133 link_command = "$ld -shared {{ldflags}} -o $dylib -Wl,-filelist,$rspfile"
(...skipping 26 matching lines...) Expand all
160 # Tell GN about the output files. It will link to the dylib but use the 160 # Tell GN about the output files. It will link to the dylib but use the
161 # tocname for dependency management. 161 # tocname for dependency management.
162 outputs = [ 162 outputs = [
163 dylib, 163 dylib,
164 tocname, 164 tocname,
165 ] 165 ]
166 link_output = dylib 166 link_output = dylib
167 depend_output = tocname 167 depend_output = tocname
168 } 168 }
169 169
170 tool("solink_module") {
171 sofile = "{{root_out_dir}}/{{target_output_name}}{{output_extension}}" # eg "./libfoo.so"
172 rspfile = sofile + ".rsp"
173
174 link_command = "$ld -bundle {{ldflags}} -o $sofile -Wl,-filelist,$rspfile"
175 if (is_component_build) {
176 link_command += " -Wl,-install_name,@rpath/{{target_output_name}}{{outpu t_extension}}"
177 }
178 link_command += " {{solibs}} {{libs}}"
179 command = link_command
180
181 rspfile_content = "{{inputs_newline}}"
182
183 description = "SOLINK_MODULE {{output}}"
184
185 # Use this for {{output_extension}} expansions unless a target manually
186 # overrides it (in which case {{output_extension}} will be what the target
187 # specifies).
188 default_output_extension = ".so"
189
190 output_prefix = "lib"
191
192 outputs = [
193 sofile,
194 ]
195 }
196
170 tool("link") { 197 tool("link") {
171 outfile = "{{root_out_dir}}/{{target_output_name}}{{output_extension}}" 198 outfile = "{{root_out_dir}}/{{target_output_name}}{{output_extension}}"
172 rspfile = "$outfile.rsp" 199 rspfile = "$outfile.rsp"
173 command = "$ld {{ldflags}} -o $outfile -Wl,-filelist,$rspfile {{solibs}} { {libs}}" 200 command = "$ld {{ldflags}} -o $outfile -Wl,-filelist,$rspfile {{solibs}} { {libs}}"
174 description = "LINK $outfile" 201 description = "LINK $outfile"
175 rspfile_content = "{{inputs_newline}}" 202 rspfile_content = "{{inputs_newline}}"
176 outputs = [ 203 outputs = [
177 outfile, 204 outfile,
178 ] 205 ]
179 } 206 }
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 } 277 }
251 278
252 mac_toolchain("x64") { 279 mac_toolchain("x64") {
253 toolchain_cpu = "x64" 280 toolchain_cpu = "x64"
254 toolchain_os = "mac" 281 toolchain_os = "mac"
255 cc = "${goma_prefix}/gcc" 282 cc = "${goma_prefix}/gcc"
256 cxx = "${goma_prefix}/g++" 283 cxx = "${goma_prefix}/g++"
257 ld = cxx 284 ld = cxx
258 is_clang = false 285 is_clang = false
259 } 286 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698