-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reland "Revert "Add an --os=fuchsia option to build.py:""
This reverts commit d39d4d0. Reason for revert: Relanding with fix Change-Id: I6d6911b6cdc578a3b576b237db94c7f1db9824b9 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151600 Reviewed-by: Siva Annamalai <asiva@google.com> Commit-Queue: Liam Appelbe <liama@google.com>
- Loading branch information
1 parent
ae6a489
commit 764e728
Showing
15 changed files
with
308 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file | ||
# for details. All rights reserved. Use of this source code is governed by a | ||
# BSD-style license that can be found in the LICENSE file. | ||
|
||
declare_args() { | ||
using_fuchsia_gn_sdk = true | ||
fuchsia_sdk_root = "//third_party/fuchsia/sdk/$host_os" | ||
fuchsia_sdk_path = "//third_party/fuchsia/sdk/$host_os" | ||
fuchsia_toolchain_path = "//third_party/fuchsia/toolchain/$host_os" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,164 @@ | ||
# Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file | ||
# for details. All rights reserved. Use of this source code is governed by a | ||
# BSD-style license that can be found in the LICENSE file. | ||
|
||
import("//build/config/sysroot.gni") | ||
import("//build/toolchain/ccache.gni") | ||
import("//build/toolchain/gcc_toolchain.gni") | ||
import("//build/toolchain/goma.gni") | ||
|
||
if (use_goma) { | ||
assert(!use_ccache, "Goma and ccache can't be used together.") | ||
compiler_prefix = "$goma_dir/gomacc " | ||
} else if (use_ccache) { | ||
compiler_prefix = "ccache " | ||
} else { | ||
compiler_prefix = "" | ||
} | ||
|
||
toolchain("fuchsia") { | ||
assert(target_cpu == "x64", "We currently only support 'x64' for fuchsia.") | ||
toolchain_bin = | ||
rebase_path("//buildtools/$host_os-$target_cpu/clang/bin", root_out_dir) | ||
fuchsia_sdk = rebase_path("//third_party/fuchsia/sdk/$host_os", root_out_dir) | ||
|
||
# We can't do string interpolation ($ in strings) on things with dots in | ||
# them. To allow us to use $cc below, for example, we create copies of | ||
# these values in our scope. | ||
cc = "${toolchain_bin}/clang" | ||
cxx = "${toolchain_bin}/clang++" | ||
ar = "${toolchain_bin}/llvm-ar" | ||
ld = "${toolchain_bin}/clang++" | ||
readelf = "${toolchain_bin}/llvm-readelf" | ||
nm = "${toolchain_bin}/llvm-nm" | ||
strip = "${toolchain_bin}/llvm-strip" | ||
|
||
target_triple_flags = "--target=x86_64-fuchsia" | ||
sysroot_flags = "--sysroot ${fuchsia_sdk}/arch/${target_cpu}/sysroot" | ||
lto_flags = "" | ||
|
||
# These library switches can apply to all tools below. | ||
lib_switch = "-l" | ||
lib_dir_switch = "-L" | ||
|
||
tool("cc") { | ||
depfile = "{{output}}.d" | ||
command = "$compiler_prefix $cc -MD -MF $depfile $target_triple_flags $sysroot_flags $lto_flags {{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} -c {{source}} -o {{output}}" | ||
depsformat = "gcc" | ||
description = "CC {{output}}" | ||
outputs = | ||
[ "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o" ] | ||
} | ||
|
||
tool("cxx") { | ||
depfile = "{{output}}.d" | ||
command = "$compiler_prefix $cxx -MD -MF $depfile $target_triple_flags $sysroot_flags $lto_flags {{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}} -c {{source}} -o {{output}}" | ||
depsformat = "gcc" | ||
description = "CXX {{output}}" | ||
outputs = | ||
[ "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o" ] | ||
} | ||
|
||
tool("asm") { | ||
depfile = "{{output}}.d" | ||
command = "$compiler_prefix $cc -MD -MF $depfile $target_triple_flags $sysroot_flags $lto_flags {{defines}} {{include_dirs}} {{asmflags}} {{cflags}} {{cflags_c}} -c {{source}} -o {{output}}" | ||
depsformat = "gcc" | ||
description = "ASM {{output}}" | ||
outputs = | ||
[ "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o" ] | ||
} | ||
|
||
tool("alink") { | ||
rspfile = "{{output}}.rsp" | ||
command = "rm -f {{output}} && $ar rcs {{output}} @$rspfile" | ||
description = "AR {{output}}" | ||
rspfile_content = "{{inputs}}" | ||
outputs = | ||
[ "{{target_out_dir}}/{{target_output_name}}{{output_extension}}" ] | ||
default_output_extension = ".a" | ||
output_prefix = "lib" | ||
} | ||
|
||
tool("solink") { | ||
soname = "{{target_output_name}}{{output_extension}}" # e.g. "libfoo.so". | ||
sofile = "{{root_out_dir}}/$soname" # Possibly including toolchain dir. | ||
unstripped_sofile = | ||
"{{root_out_dir}}/so.unstripped/$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. | ||
tocfile = sofile + ".TOC" | ||
temporary_tocname = sofile + ".tmp" | ||
link_command = "$compiler_prefix $ld $target_triple_flags $sysroot_flags $lto_flags -shared {{ldflags}} -o $unstripped_sofile -Wl,--build-id -Wl,-soname=$soname @$rspfile" | ||
toc_command = "{ $readelf -d $unstripped_sofile | grep SONAME ; $nm -gD -f posix $unstripped_sofile | cut -f1-2 -d' '; } > $temporary_tocname" | ||
replace_command = "if ! cmp -s $temporary_tocname $tocfile; then mv $temporary_tocname $tocfile; fi" | ||
strip_command = "$strip -o $sofile $unstripped_sofile" | ||
|
||
command = | ||
"$link_command && $toc_command && $replace_command && $strip_command" | ||
rspfile_content = "-Wl,--whole-archive {{inputs}} {{solibs}} -Wl,--no-whole-archive {{libs}}" | ||
|
||
description = "SOLINK $sofile" | ||
|
||
default_output_extension = ".so" | ||
|
||
output_prefix = "lib" | ||
|
||
# Since the above commands only updates the .TOC file when it changes, ask | ||
# Ninja to check if the timestamp actually changed to know if downstream | ||
# dependencies should be recompiled. | ||
restat = true | ||
|
||
# Tell GN about the output files. It will link to the sofile but use the | ||
# tocfile for dependency management. | ||
outputs = [ | ||
sofile, | ||
unstripped_sofile, | ||
tocfile, | ||
] | ||
|
||
link_output = sofile | ||
depend_output = tocfile | ||
} | ||
|
||
tool("link") { | ||
exename = "{{target_output_name}}{{output_extension}}" | ||
outfile = "{{root_out_dir}}/$exename" | ||
rspfile = "$outfile.rsp" | ||
unstripped_outfile = "{{root_out_dir}}/exe.stripped/$exename" | ||
command = "$compiler_prefix $ld $target_triple_flags $sysroot_flags $lto_flags {{ldflags}} -o $unstripped_outfile -Wl,--build-id -Wl,--start-group @$rspfile {{solibs}} -Wl,--end-group {{libs}} && ${strip} -o $outfile $unstripped_outfile" | ||
description = "LINK $outfile" | ||
rspfile_content = "{{inputs}}" | ||
outputs = [ | ||
unstripped_outfile, | ||
outfile, | ||
] | ||
} | ||
|
||
tool("stamp") { | ||
command = "touch {{output}}" | ||
description = "STAMP {{output}}" | ||
} | ||
|
||
tool("copy") { | ||
command = "ln -f {{source}} {{output}} 2>/dev/null || (rm -rf {{output}} && cp -af {{source}} {{output}})" | ||
description = "COPY {{source}} {{output}}" | ||
} | ||
|
||
# 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 = { | ||
current_cpu = target_cpu | ||
current_os = target_os | ||
|
||
# These values need to be passed through unchanged. | ||
target_os = target_os | ||
target_cpu = target_cpu | ||
|
||
is_clang = true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.