Commit d40ebfeb authored by Brett Wilson's avatar Brett Wilson

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}
parent 5f35ed44
......@@ -10,17 +10,6 @@
import("//build/config/ui.gni")
# Android GN build has some bugs: http://crbug.com/405686
if (is_android) {
group("root") {
deps = [
"//base",
]
}
} else {
# In GN, a "group" is a dummy target that just lists other targets.
group("root") {
# Note that some dependencies are commented out. These are things that are
......@@ -248,5 +237,3 @@ group("root") {
]
}
}
}
\ No newline at end of file
......@@ -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"
......
......@@ -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"
......
......@@ -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.
......
......@@ -94,6 +94,7 @@
'includes': [ '../build/java.gypi' ],
},
{
# GN version: //components/variations:variations_java
'target_name': 'variations_jni_headers',
'type': 'none',
'sources': [
......
......@@ -2,6 +2,10 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
if (is_android) {
import("//build/config/android/rules.gni")
}
static_library("variations") {
sources = [
"active_field_trials.cc",
......@@ -41,4 +45,17 @@ static_library("variations") {
"//components/variations/proto",
"//third_party/mt19937ar",
]
if (is_android) {
deps += [ ":jni" ]
}
}
if (is_android) {
generate_jni("jni") {
sources = [
"android/java/src/org/chromium/components/variations/VariationsAssociatedData.java",
]
jni_package = "variations"
}
}
......@@ -27,5 +27,7 @@ shared_library("surfaces") {
"surfaces_impl.h",
"surfaces_service_application.cc",
"surfaces_service_application.h",
"surfaces_service_impl.cc",
"surfaces_service_impl.h",
]
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment