diff options
author | Brett Wilson <brettw@chromium.org> | 2014-08-26 10:39:58 -0700 |
---|---|---|
committer | Brett Wilson <brettw@chromium.org> | 2014-08-26 17:40:51 +0000 |
commit | d40ebfebd18d8fc41a0f5af61d28b6c252b66bea (patch) | |
tree | 52b6393c4c405fcfe33ab97e493f87dc9b8e768e /build | |
parent | 5f35ed44b90c99e00eb67f1a5fea4f81a78269fc (diff) | |
download | chromium_src-d40ebfebd18d8fc41a0f5af61d28b6c252b66bea.zip chromium_src-d40ebfebd18d8fc41a0f5af61d28b6c252b66bea.tar.gz chromium_src-d40ebfebd18d8fc41a0f5af61d28b6c252b66bea.tar.bz2 |
Fix GN toolchains to use proper out dir.
Previously it put all toolchains' main link output into the root build directory, which doesn't work when there are multiple toolchains generating the same targets.
BUG=405686
R=jamesr@chromium.org
Review URL: https://codereview.chromium.org/502163002
Cr-Commit-Position: refs/heads/master@{#291927}
Diffstat (limited to 'build')
-rw-r--r-- | build/toolchain/gcc_toolchain.gni | 29 | ||||
-rw-r--r-- | build/toolchain/mac/BUILD.gn | 4 | ||||
-rw-r--r-- | build/toolchain/win/BUILD.gn | 6 |
3 files changed, 20 insertions, 19 deletions
diff --git a/build/toolchain/gcc_toolchain.gni b/build/toolchain/gcc_toolchain.gni index 8f5445b..ea13aad 100644 --- a/build/toolchain/gcc_toolchain.gni +++ b/build/toolchain/gcc_toolchain.gni @@ -124,17 +124,18 @@ template("gcc_toolchain") { tool("solink") { soname = "{{target_output_name}}{{output_extension}}" # e.g. "libfoo.so". - rspfile = soname + ".rsp" + sofile = "{{root_out_dir}}/$soname" # Possibly including toolchain dir. + rspfile = sofile + ".rsp" # These variables are not built into GN but are helpers that implement # (1) linking to produce a .so, (2) extracting the symbols from that file # to a temporary file, (3) if the temporary file has differences from the # existing .TOC file, overwrite it, otherwise, don't change it. - tocname = soname + ".TOC" - temporary_tocname = soname + ".tmp" - link_command = "$ld -shared {{ldflags}} -o $soname -Wl,-soname=$soname @$rspfile" - toc_command = "{ readelf -d $soname | grep SONAME ; nm -gD -f p $soname | cut -f1-2 -d' '; } > $temporary_tocname" - replace_command = "if ! cmp -s $temporary_tocname $tocname; then mv $temporary_tocname $tocname; fi" + tocfile = sofile + ".TOC" + temporary_tocname = sofile + ".tmp" + link_command = "$ld -shared {{ldflags}} -o $sofile -Wl,-soname=$soname @$rspfile" + toc_command = "{ readelf -d $sofile | grep SONAME ; nm -gD -f p $soname | cut -f1-2 -d' '; } > $temporary_tocname" + replace_command = "if ! cmp -s $temporary_tocname $tocfile; then mv $temporary_tocname $tocfile; fi" command = "$link_command && $toc_command && $replace_command" if (defined(invoker.postsolink)) { @@ -142,7 +143,7 @@ template("gcc_toolchain") { } rspfile_content = "-Wl,--whole-archive {{inputs}} {{solibs}} -Wl,--no-whole-archive $solink_libs_section_prefix {{libs}} $solink_libs_section_postfix" - description = "SOLINK $soname" + description = "SOLINK $sofile" # Use this for {{output_extension}} expansions unless a target manually # overrides it (in which case {{output_extension}} will be what the target @@ -156,18 +157,18 @@ template("gcc_toolchain") { # dependencies should be recompiled. restat = true - # Tell GN about the output files. It will link to the soname but use the - # tocname for dependency management. + # Tell GN about the output files. It will link to the sofile but use the + # tocfile for dependency management. outputs = [ - soname, - tocname, + sofile, + tocfile, ] - link_output = soname - depend_output = tocname + link_output = sofile + depend_output = tocfile } tool("link") { - outfile = "{{target_output_name}}{{output_extension}}" + outfile = "{{root_out_dir}}/{{target_output_name}}{{output_extension}}" rspfile = "$outfile.rsp" command = "$ld {{ldflags}} -o $outfile -Wl,--start-group @$rspfile {{solibs}} -Wl,--end-group $libs_section_prefix {{libs}} $libs_section_postfix" description = "LINK $outfile" diff --git a/build/toolchain/mac/BUILD.gn b/build/toolchain/mac/BUILD.gn index 65fb7c6..b1cd36b 100644 --- a/build/toolchain/mac/BUILD.gn +++ b/build/toolchain/mac/BUILD.gn @@ -117,7 +117,7 @@ template("mac_clang_toolchain") { } tool("solink") { - dylib = "{{target_output_name}}{{output_extension}}" # eg "libfoo.dylib" + dylib = "{{root_out_dir}}/{{target_output_name}}{{output_extension}}" # eg "./libfoo.dylib" rspfile = dylib + ".rsp" # These variables are not build into GN but are helpers that implement @@ -165,7 +165,7 @@ template("mac_clang_toolchain") { } tool("link") { - outfile = "{{target_output_name}}{{output_extension}}" + outfile = "{{root_out_dir}}/{{target_output_name}}{{output_extension}}" rspfile = "$outfile.rsp" command = "$ld {{ldflags}} -o $outfile -Wl,-filelist,$rspfile {{solibs}} {{libs}}" description = "LINK $outfile" diff --git a/build/toolchain/win/BUILD.gn b/build/toolchain/win/BUILD.gn index 0a5cf87..87688ef 100644 --- a/build/toolchain/win/BUILD.gn +++ b/build/toolchain/win/BUILD.gn @@ -87,8 +87,8 @@ template("msvc_toolchain") { } tool("solink") { - dllname = "{{target_output_name}}{{output_extension}}" # e.g. foo.dll - libname = "{{target_output_name}}{{output_extension}}.lib" # e.g. foo.dll.lib + dllname = "{{root_out_dir}}/{{target_output_name}}{{output_extension}}" # e.g. foo.dll + libname = "{{root_out_dir}}/{{target_output_name}}{{output_extension}}.lib" # e.g. foo.dll.lib rspfile = "${dllname}.rsp" link_command = "$python_path gyp-win-tool link-wrapper $env False link.exe /nologo /IMPLIB:$libname /DLL /OUT:$dllname /PDB:${dllname}.pdb @$rspfile" @@ -122,7 +122,7 @@ template("msvc_toolchain") { default_output_extension = ".exe" description = "LINK {{output}}" outputs = [ - "{{target_output_name}}{{output_extension}}", + "{{root_out_dir}}/{{target_output_name}}{{output_extension}}", ] # The use of inputs_newline is to work around a fixed per-line buffer # size in the linker. |