mirror of
https://github.com/dart-lang/sdk
synced 2024-09-15 22:00:09 +00:00
Add an --os=fuchsia option to build.py:
tools/build.py --os=fuchsia runtime create_sdk This is analogous to --os=android. It cross compiles from Linux x64 to Fuchsia. A lot of the build rules are just slightly different between the existing Fuchsia build rules used by Flutter, and the ones added by GN SDK. For example "$fuchsia_sdk_root/pkg:fdio" is now "$fuchsia_sdk_root/pkg/fdio". So to support this I had to add a new variable, using_fuchsia_gn_sdk, analogous to using_fuchsia_sdk. Flutter will need to set this to false. Change-Id: Ief275d65f30a42a801607de93cf2d27a1fe825dd Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150689 Reviewed-by: Ryan Macnak <rmacnak@google.com> Commit-Queue: Liam Appelbe <liama@google.com>
This commit is contained in:
parent
d2543e32f4
commit
4ce18ab931
11
DEPS
11
DEPS
|
@ -470,6 +470,17 @@ deps = {
|
||||||
"dep_type": "cipd",
|
"dep_type": "cipd",
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Var("dart_root") + "/third_party/fuchsia/sdk/linux": {
|
||||||
|
"packages": [
|
||||||
|
{
|
||||||
|
"package": "fuchsia/sdk/gn/linux-amd64",
|
||||||
|
"version": "git_revision:8d5242d4f6ff8b7634b492700e60b0fd09abefa3"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"condition": 'host_os == "linux" and host_cpu == "x64"',
|
||||||
|
"dep_type": "cipd",
|
||||||
|
},
|
||||||
|
|
||||||
Var("dart_root") + "/pkg/front_end/test/fasta/types/benchmark_data": {
|
Var("dart_root") + "/pkg/front_end/test/fasta/types/benchmark_data": {
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
|
|
|
@ -196,6 +196,16 @@ if (current_os == "win") {
|
||||||
is_nacl = false
|
is_nacl = false
|
||||||
is_posix = true
|
is_posix = true
|
||||||
is_win = false
|
is_win = false
|
||||||
|
} else if (current_os == "fuchsia") {
|
||||||
|
is_android = false
|
||||||
|
is_chromeos = false
|
||||||
|
is_fuchsia = true
|
||||||
|
is_ios = false
|
||||||
|
is_linux = false
|
||||||
|
is_mac = false
|
||||||
|
is_nacl = false
|
||||||
|
is_posix = true
|
||||||
|
is_win = false
|
||||||
}
|
}
|
||||||
|
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
|
@ -384,6 +394,11 @@ if (is_win) {
|
||||||
} else if (is_mac) {
|
} else if (is_mac) {
|
||||||
host_toolchain = "//build/toolchain/mac:clang_x64"
|
host_toolchain = "//build/toolchain/mac:clang_x64"
|
||||||
set_default_toolchain(host_toolchain)
|
set_default_toolchain(host_toolchain)
|
||||||
|
} else if (is_fuchsia) {
|
||||||
|
assert(host_os == "linux")
|
||||||
|
assert(host_cpu == "x64")
|
||||||
|
host_toolchain = "//build/toolchain/linux:clang_$host_cpu"
|
||||||
|
set_default_toolchain("//build/toolchain/fuchsia")
|
||||||
}
|
}
|
||||||
|
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
|
|
|
@ -243,7 +243,7 @@ config("compiler") {
|
||||||
# 3. When using the sanitizers.
|
# 3. When using the sanitizers.
|
||||||
# Otherwise there is a performance hit, in particular on ia32.
|
# Otherwise there is a performance hit, in particular on ia32.
|
||||||
if (is_android || is_asan || is_lsan || is_msan || is_tsan || is_ubsan ||
|
if (is_android || is_asan || is_lsan || is_msan || is_tsan || is_ubsan ||
|
||||||
(is_linux && current_cpu != "x86")) {
|
(is_linux && current_cpu != "x86") || is_fuchsia) {
|
||||||
cflags += [ "-fPIC" ]
|
cflags += [ "-fPIC" ]
|
||||||
ldflags += [ "-fPIC" ]
|
ldflags += [ "-fPIC" ]
|
||||||
}
|
}
|
||||||
|
@ -276,6 +276,8 @@ config("compiler") {
|
||||||
if (is_win) {
|
if (is_win) {
|
||||||
# Up-to-date toolchain MSVC doesn't support c++11 flag any longer.
|
# Up-to-date toolchain MSVC doesn't support c++11 flag any longer.
|
||||||
cc_std = [ "/std:c++14" ]
|
cc_std = [ "/std:c++14" ]
|
||||||
|
} else if (is_fuchsia) {
|
||||||
|
cc_std = [ "-std=c++17" ]
|
||||||
} else {
|
} else {
|
||||||
cc_std = [ "-std=c++11" ]
|
cc_std = [ "-std=c++11" ]
|
||||||
}
|
}
|
||||||
|
|
10
build/fuchsia/sdk.gni
Normal file
10
build/fuchsia/sdk.gni
Normal file
|
@ -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"
|
||||||
|
}
|
164
build/toolchain/fuchsia/BUILD.gn
Normal file
164
build/toolchain/fuchsia/BUILD.gn
Normal file
|
@ -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
|
||||||
|
}
|
||||||
|
}
|
|
@ -136,7 +136,10 @@ config("dart_config") {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_fuchsia) {
|
if (is_fuchsia) {
|
||||||
if (using_fuchsia_sdk) {
|
if (using_fuchsia_gn_sdk) {
|
||||||
|
lib_dirs = [ "../out/DebugFuchsiaX64/lib" ]
|
||||||
|
}
|
||||||
|
if (using_fuchsia_gn_sdk || using_fuchsia_sdk) {
|
||||||
# TODO(chinmaygarde): Currenty these targets need to be build in the
|
# TODO(chinmaygarde): Currenty these targets need to be build in the
|
||||||
# Fuchsia tree as well as outside it using the SDK. However, not all
|
# Fuchsia tree as well as outside it using the SDK. However, not all
|
||||||
# Fuchsia features are available in the SDK. As these features are added,
|
# Fuchsia features are available in the SDK. As these features are added,
|
||||||
|
@ -223,7 +226,12 @@ library_for_all_configs("libdart") {
|
||||||
defines = [ "DART_ENABLE_WASM" ]
|
defines = [ "DART_ENABLE_WASM" ]
|
||||||
}
|
}
|
||||||
if (is_fuchsia) {
|
if (is_fuchsia) {
|
||||||
if (using_fuchsia_sdk) {
|
if (using_fuchsia_gn_sdk) {
|
||||||
|
extra_deps += [
|
||||||
|
"$fuchsia_sdk_root/pkg/fdio",
|
||||||
|
"$fuchsia_sdk_root/pkg/trace-engine",
|
||||||
|
]
|
||||||
|
} else if (using_fuchsia_sdk) {
|
||||||
extra_deps += [
|
extra_deps += [
|
||||||
"$fuchsia_sdk_root/pkg:fdio",
|
"$fuchsia_sdk_root/pkg:fdio",
|
||||||
"$fuchsia_sdk_root/pkg:trace-engine",
|
"$fuchsia_sdk_root/pkg:trace-engine",
|
||||||
|
|
|
@ -42,7 +42,9 @@ template("build_libdart_builtin") {
|
||||||
public_configs = [ ":libdart_builtin_config" ]
|
public_configs = [ ":libdart_builtin_config" ]
|
||||||
deps = []
|
deps = []
|
||||||
if (is_fuchsia) {
|
if (is_fuchsia) {
|
||||||
if (using_fuchsia_sdk) {
|
if (using_fuchsia_gn_sdk) {
|
||||||
|
public_deps = [ "$fuchsia_sdk_root/pkg/fdio" ]
|
||||||
|
} else if (using_fuchsia_sdk) {
|
||||||
public_deps = [ "$fuchsia_sdk_root/pkg:fdio" ]
|
public_deps = [ "$fuchsia_sdk_root/pkg:fdio" ]
|
||||||
} else {
|
} else {
|
||||||
public_deps = [ "//zircon/public/lib/fdio" ]
|
public_deps = [ "//zircon/public/lib/fdio" ]
|
||||||
|
@ -318,7 +320,13 @@ template("build_gen_snapshot_dart_io") {
|
||||||
deps = []
|
deps = []
|
||||||
|
|
||||||
if (is_fuchsia) {
|
if (is_fuchsia) {
|
||||||
if (using_fuchsia_sdk) {
|
if (using_fuchsia_gn_sdk) {
|
||||||
|
deps += [
|
||||||
|
"$fuchsia_sdk_root/fidl/fuchsia.netstack",
|
||||||
|
"$fuchsia_sdk_root/pkg/sys_cpp",
|
||||||
|
]
|
||||||
|
public_deps = [ "$fuchsia_sdk_root/pkg/fdio" ]
|
||||||
|
} else if (using_fuchsia_sdk) {
|
||||||
deps += [
|
deps += [
|
||||||
"$fuchsia_sdk_root/fidl:fuchsia.netstack",
|
"$fuchsia_sdk_root/fidl:fuchsia.netstack",
|
||||||
"$fuchsia_sdk_root/pkg:sys_cpp",
|
"$fuchsia_sdk_root/pkg:sys_cpp",
|
||||||
|
@ -454,7 +462,13 @@ template("dart_io") {
|
||||||
deps += [ "//third_party/boringssl" ]
|
deps += [ "//third_party/boringssl" ]
|
||||||
|
|
||||||
if (is_fuchsia) {
|
if (is_fuchsia) {
|
||||||
if (using_fuchsia_sdk) {
|
if (using_fuchsia_gn_sdk) {
|
||||||
|
deps += [
|
||||||
|
"$fuchsia_sdk_root/fidl/fuchsia.netstack",
|
||||||
|
"$fuchsia_sdk_root/pkg/sys_cpp",
|
||||||
|
]
|
||||||
|
public_deps = [ "$fuchsia_sdk_root/pkg/fdio" ]
|
||||||
|
} else if (using_fuchsia_sdk) {
|
||||||
deps += [
|
deps += [
|
||||||
"$fuchsia_sdk_root/fidl:fuchsia.netstack",
|
"$fuchsia_sdk_root/fidl:fuchsia.netstack",
|
||||||
"$fuchsia_sdk_root/pkg:sys_cpp",
|
"$fuchsia_sdk_root/pkg:sys_cpp",
|
||||||
|
@ -788,7 +802,9 @@ template("dart_executable") {
|
||||||
# have them. They are needed for running Fuchsia binaries built for the
|
# have them. They are needed for running Fuchsia binaries built for the
|
||||||
# host.
|
# host.
|
||||||
if (is_linux) {
|
if (is_linux) {
|
||||||
configs += [ "../../build/config/gcc:executable_ldconfig" ]
|
# TODO(liama): Commenting this line out because it causes problems for
|
||||||
|
# --os=fuchsia. If no one complains, remove it.
|
||||||
|
# configs += [ "../../build/config/gcc:executable_ldconfig" ]
|
||||||
} else if (is_mac) {
|
} else if (is_mac) {
|
||||||
configs += [ "../../build/config/mac:mac_dynamic_flags" ]
|
configs += [ "../../build/config/mac:mac_dynamic_flags" ]
|
||||||
}
|
}
|
||||||
|
@ -1012,7 +1028,11 @@ executable("run_vm_tests") {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_fuchsia) {
|
if (is_fuchsia) {
|
||||||
if (!using_fuchsia_sdk) {
|
if (using_fuchsia_gn_sdk) {
|
||||||
|
include_dirs += [ "$fuchsia_sdk_path/pkg/trace-engine/include" ]
|
||||||
|
libs = [ "zircon" ]
|
||||||
|
}
|
||||||
|
if (!using_fuchsia_gn_sdk && !using_fuchsia_sdk) {
|
||||||
deps += [ "//zircon/system/ulib/trace" ]
|
deps += [ "//zircon/system/ulib/trace" ]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -744,7 +744,9 @@ class ProcessStarter {
|
||||||
}
|
}
|
||||||
actions[3] = {
|
actions[3] = {
|
||||||
.action = FDIO_SPAWN_ACTION_SET_NAME,
|
.action = FDIO_SPAWN_ACTION_SET_NAME,
|
||||||
.name.data = program_arguments_[0],
|
.name = {
|
||||||
|
.data = program_arguments_[0],
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
// Then fill in the namespace actions.
|
// Then fill in the namespace actions.
|
||||||
|
@ -752,8 +754,10 @@ class ProcessStarter {
|
||||||
for (size_t i = 0; i < flat_ns->count; i++) {
|
for (size_t i = 0; i < flat_ns->count; i++) {
|
||||||
actions[fixed_actions_cnt + i] = {
|
actions[fixed_actions_cnt + i] = {
|
||||||
.action = FDIO_SPAWN_ACTION_ADD_NS_ENTRY,
|
.action = FDIO_SPAWN_ACTION_ADD_NS_ENTRY,
|
||||||
.ns.prefix = flat_ns->path[i],
|
.ns = {
|
||||||
.ns.handle = flat_ns->handle[i],
|
.prefix = flat_ns->path[i],
|
||||||
|
.handle = flat_ns->handle[i],
|
||||||
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
free(flat_ns);
|
free(flat_ns);
|
||||||
|
|
|
@ -201,7 +201,9 @@ static AppSnapshot* TryReadAppSnapshotElf(
|
||||||
*isolate_data_buffer = nullptr,
|
*isolate_data_buffer = nullptr,
|
||||||
*isolate_instructions_buffer = nullptr;
|
*isolate_instructions_buffer = nullptr;
|
||||||
Dart_LoadedElf* handle = nullptr;
|
Dart_LoadedElf* handle = nullptr;
|
||||||
|
#if !defined(HOST_OS_FUCHSIA)
|
||||||
if (force_load_elf_from_memory) {
|
if (force_load_elf_from_memory) {
|
||||||
|
#endif
|
||||||
File* const file =
|
File* const file =
|
||||||
File::Open(/*namespc=*/nullptr, script_name, File::kRead);
|
File::Open(/*namespc=*/nullptr, script_name, File::kRead);
|
||||||
if (file == nullptr) return nullptr;
|
if (file == nullptr) return nullptr;
|
||||||
|
@ -216,11 +218,13 @@ static AppSnapshot* TryReadAppSnapshotElf(
|
||||||
&isolate_data_buffer, &isolate_instructions_buffer);
|
&isolate_data_buffer, &isolate_instructions_buffer);
|
||||||
delete memory;
|
delete memory;
|
||||||
file->Release();
|
file->Release();
|
||||||
|
#if !defined(HOST_OS_FUCHSIA)
|
||||||
} else {
|
} else {
|
||||||
handle = Dart_LoadELF(script_name, file_offset, &error, &vm_data_buffer,
|
handle = Dart_LoadELF(script_name, file_offset, &error, &vm_data_buffer,
|
||||||
&vm_instructions_buffer, &isolate_data_buffer,
|
&vm_instructions_buffer, &isolate_data_buffer,
|
||||||
&isolate_instructions_buffer);
|
&isolate_instructions_buffer);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if (handle == nullptr) {
|
if (handle == nullptr) {
|
||||||
Syslog::PrintErr("Loading failed: %s\n", error);
|
Syslog::PrintErr("Loading failed: %s\n", error);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
|
@ -17,7 +17,9 @@ library_for_all_configs("libdart_platform") {
|
||||||
extra_deps = []
|
extra_deps = []
|
||||||
|
|
||||||
if (is_fuchsia) {
|
if (is_fuchsia) {
|
||||||
if (using_fuchsia_sdk) {
|
if (using_fuchsia_gn_sdk) {
|
||||||
|
extra_deps += [ "$fuchsia_sdk_root/pkg/sys_cpp" ]
|
||||||
|
} else if (using_fuchsia_sdk) {
|
||||||
extra_deps += [ "$fuchsia_sdk_root/pkg:sys_cpp" ]
|
extra_deps += [ "$fuchsia_sdk_root/pkg:sys_cpp" ]
|
||||||
} else {
|
} else {
|
||||||
extra_deps += [ "//sdk/lib/sys/cpp" ]
|
extra_deps += [ "//sdk/lib/sys/cpp" ]
|
||||||
|
|
|
@ -72,7 +72,16 @@ library_for_all_configs("libdart_vm") {
|
||||||
"//third_party/icu:icuuc",
|
"//third_party/icu:icuuc",
|
||||||
]
|
]
|
||||||
if (is_fuchsia) {
|
if (is_fuchsia) {
|
||||||
if (using_fuchsia_sdk) {
|
if (using_fuchsia_gn_sdk) {
|
||||||
|
extra_deps += [
|
||||||
|
"$fuchsia_sdk_root/fidl/fuchsia.intl",
|
||||||
|
"$fuchsia_sdk_root/pkg/inspect",
|
||||||
|
"$fuchsia_sdk_root/pkg/inspect_service_cpp",
|
||||||
|
"$fuchsia_sdk_root/pkg/sys_cpp",
|
||||||
|
"$fuchsia_sdk_root/pkg/sys_inspect_cpp",
|
||||||
|
"$fuchsia_sdk_root/pkg/trace-engine",
|
||||||
|
]
|
||||||
|
} else if (using_fuchsia_sdk) {
|
||||||
extra_deps += [
|
extra_deps += [
|
||||||
"$fuchsia_sdk_root/fidl:fuchsia.deprecatedtimezone",
|
"$fuchsia_sdk_root/fidl:fuchsia.deprecatedtimezone",
|
||||||
"$fuchsia_sdk_root/pkg:inspect",
|
"$fuchsia_sdk_root/pkg:inspect",
|
||||||
|
@ -114,7 +123,9 @@ library_for_all_configs_with_compiler("libdart_compiler") {
|
||||||
sources = rebase_path(compiler_sources, ".", "./compiler/")
|
sources = rebase_path(compiler_sources, ".", "./compiler/")
|
||||||
include_dirs = [ ".." ]
|
include_dirs = [ ".." ]
|
||||||
if (is_fuchsia) {
|
if (is_fuchsia) {
|
||||||
if (using_fuchsia_sdk) {
|
if (using_fuchsia_gn_sdk) {
|
||||||
|
extra_deps = [ "$fuchsia_sdk_root/pkg/trace-engine" ]
|
||||||
|
} else if (using_fuchsia_sdk) {
|
||||||
extra_deps = [ "$fuchsia_sdk_root/pkg:trace-engine" ]
|
extra_deps = [ "$fuchsia_sdk_root/pkg:trace-engine" ]
|
||||||
} else {
|
} else {
|
||||||
extra_deps = [
|
extra_deps = [
|
||||||
|
@ -128,7 +139,9 @@ library_for_all_configs_with_compiler("libdart_compiler") {
|
||||||
library_for_all_configs("libdart_lib") {
|
library_for_all_configs("libdart_lib") {
|
||||||
target_type = "source_set"
|
target_type = "source_set"
|
||||||
if (is_fuchsia) {
|
if (is_fuchsia) {
|
||||||
if (using_fuchsia_sdk) {
|
if (using_fuchsia_gn_sdk) {
|
||||||
|
extra_deps = [ "$fuchsia_sdk_root/pkg/trace-engine" ]
|
||||||
|
} else if (using_fuchsia_sdk) {
|
||||||
extra_deps = [ "$fuchsia_sdk_root/pkg:trace-engine" ]
|
extra_deps = [ "$fuchsia_sdk_root/pkg:trace-engine" ]
|
||||||
} else {
|
} else {
|
||||||
extra_deps = [
|
extra_deps = [
|
||||||
|
|
|
@ -332,7 +332,7 @@ if (target_cpu == "x64") {
|
||||||
ignore_patterns = "{}"
|
ignore_patterns = "{}"
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
if (is_linux || is_android) {
|
if (is_linux || is_android || is_fuchsia) {
|
||||||
copy_tree_specs += [
|
copy_tree_specs += [
|
||||||
{
|
{
|
||||||
target = "copy_libtensorflowlite_c"
|
target = "copy_libtensorflowlite_c"
|
||||||
|
|
|
@ -332,7 +332,7 @@ if (target_cpu == "x64") {
|
||||||
ignore_patterns = "{}"
|
ignore_patterns = "{}"
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
if (is_linux || is_android) {
|
if (is_linux || is_android || is_fuchsia) {
|
||||||
copy_tree_specs += [
|
copy_tree_specs += [
|
||||||
{
|
{
|
||||||
target = "copy_libtensorflowlite_c"
|
target = "copy_libtensorflowlite_c"
|
||||||
|
|
|
@ -59,7 +59,7 @@ def BuildOptions():
|
||||||
result.add_option(
|
result.add_option(
|
||||||
"--os",
|
"--os",
|
||||||
help='Target OSs (comma-separated).',
|
help='Target OSs (comma-separated).',
|
||||||
metavar='[all,host,android]',
|
metavar='[all,host,android,fuchsia]',
|
||||||
default='host')
|
default='host')
|
||||||
result.add_option(
|
result.add_option(
|
||||||
"--sanitizer",
|
"--sanitizer",
|
||||||
|
@ -96,7 +96,7 @@ def ProcessOptions(options, args):
|
||||||
if options.mode == 'all':
|
if options.mode == 'all':
|
||||||
options.mode = 'debug,release,product'
|
options.mode = 'debug,release,product'
|
||||||
if options.os == 'all':
|
if options.os == 'all':
|
||||||
options.os = 'host,android'
|
options.os = 'host,android,fuchsia'
|
||||||
if options.sanitizer == 'all':
|
if options.sanitizer == 'all':
|
||||||
options.sanitizer = 'none,asan,lsan,msan,tsan,ubsan'
|
options.sanitizer = 'none,asan,lsan,msan,tsan,ubsan'
|
||||||
options.mode = options.mode.split(',')
|
options.mode = options.mode.split(',')
|
||||||
|
@ -118,13 +118,12 @@ def ProcessOptions(options, args):
|
||||||
return False
|
return False
|
||||||
options.os = [ProcessOsOption(os_name) for os_name in options.os]
|
options.os = [ProcessOsOption(os_name) for os_name in options.os]
|
||||||
for os_name in options.os:
|
for os_name in options.os:
|
||||||
if not os_name in ['android', 'freebsd', 'linux', 'macos', 'win32']:
|
if not os_name in [
|
||||||
|
'android', 'freebsd', 'linux', 'macos', 'win32', 'fuchsia'
|
||||||
|
]:
|
||||||
print("Unknown os %s" % os_name)
|
print("Unknown os %s" % os_name)
|
||||||
return False
|
return False
|
||||||
if os_name != HOST_OS:
|
if os_name == 'android':
|
||||||
if os_name != 'android':
|
|
||||||
print("Unsupported target os %s" % os_name)
|
|
||||||
return False
|
|
||||||
if not HOST_OS in ['linux', 'macos']:
|
if not HOST_OS in ['linux', 'macos']:
|
||||||
print("Cross-compilation to %s is not supported on host os %s."
|
print("Cross-compilation to %s is not supported on host os %s."
|
||||||
% (os_name, HOST_OS))
|
% (os_name, HOST_OS))
|
||||||
|
@ -143,6 +142,19 @@ def ProcessOptions(options, args):
|
||||||
"For android builds you must specify a target, such as 'runtime'."
|
"For android builds you must specify a target, such as 'runtime'."
|
||||||
)
|
)
|
||||||
return False
|
return False
|
||||||
|
elif os_name == 'fuchsia':
|
||||||
|
if HOST_OS != 'linux':
|
||||||
|
print("Cross-compilation to %s is not supported on host os %s."
|
||||||
|
% (os_name, HOST_OS))
|
||||||
|
return False
|
||||||
|
if arch != 'x64':
|
||||||
|
print(
|
||||||
|
"Cross-compilation to %s is not supported for architecture %s."
|
||||||
|
% (os_name, arch))
|
||||||
|
return False
|
||||||
|
elif os_name != HOST_OS:
|
||||||
|
print("Unsupported target os %s" % os_name)
|
||||||
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
|
26
tools/gn.py
26
tools/gn.py
|
@ -288,7 +288,7 @@ def ProcessOptions(args):
|
||||||
if args.mode == 'all':
|
if args.mode == 'all':
|
||||||
args.mode = 'debug,release,product'
|
args.mode = 'debug,release,product'
|
||||||
if args.os == 'all':
|
if args.os == 'all':
|
||||||
args.os = 'host,android'
|
args.os = 'host,android,fuchsia'
|
||||||
if args.sanitizer == 'all':
|
if args.sanitizer == 'all':
|
||||||
args.sanitizer = 'none,asan,lsan,msan,tsan,ubsan'
|
args.sanitizer = 'none,asan,lsan,msan,tsan,ubsan'
|
||||||
args.mode = args.mode.split(',')
|
args.mode = args.mode.split(',')
|
||||||
|
@ -309,13 +309,12 @@ def ProcessOptions(args):
|
||||||
return False
|
return False
|
||||||
oses = [ProcessOsOption(os_name) for os_name in args.os]
|
oses = [ProcessOsOption(os_name) for os_name in args.os]
|
||||||
for os_name in oses:
|
for os_name in oses:
|
||||||
if not os_name in ['android', 'freebsd', 'linux', 'macos', 'win32']:
|
if not os_name in [
|
||||||
|
'android', 'freebsd', 'linux', 'macos', 'win32', 'fuchsia'
|
||||||
|
]:
|
||||||
print("Unknown os %s" % os_name)
|
print("Unknown os %s" % os_name)
|
||||||
return False
|
return False
|
||||||
if os_name != HOST_OS:
|
if os_name == 'android':
|
||||||
if os_name != 'android':
|
|
||||||
print("Unsupported target os %s" % os_name)
|
|
||||||
return False
|
|
||||||
if not HOST_OS in ['linux', 'macos']:
|
if not HOST_OS in ['linux', 'macos']:
|
||||||
print("Cross-compilation to %s is not supported on host os %s."
|
print("Cross-compilation to %s is not supported on host os %s."
|
||||||
% (os_name, HOST_OS))
|
% (os_name, HOST_OS))
|
||||||
|
@ -327,6 +326,19 @@ def ProcessOptions(args):
|
||||||
"Cross-compilation to %s is not supported for architecture %s."
|
"Cross-compilation to %s is not supported for architecture %s."
|
||||||
% (os_name, arch))
|
% (os_name, arch))
|
||||||
return False
|
return False
|
||||||
|
elif os_name == 'fuchsia':
|
||||||
|
if HOST_OS != 'linux':
|
||||||
|
print("Cross-compilation to %s is not supported on host os %s."
|
||||||
|
% (os_name, HOST_OS))
|
||||||
|
return False
|
||||||
|
if arch != 'x64':
|
||||||
|
print(
|
||||||
|
"Cross-compilation to %s is not supported for architecture %s."
|
||||||
|
% (os_name, arch))
|
||||||
|
return False
|
||||||
|
elif os_name != HOST_OS:
|
||||||
|
print("Unsupported target os %s" % os_name)
|
||||||
|
return False
|
||||||
if HOST_OS != 'win' and args.use_crashpad:
|
if HOST_OS != 'win' and args.use_crashpad:
|
||||||
print("Crashpad is only supported on Windows")
|
print("Crashpad is only supported on Windows")
|
||||||
return False
|
return False
|
||||||
|
@ -373,7 +385,7 @@ def parse_args(args):
|
||||||
'--os',
|
'--os',
|
||||||
type=str,
|
type=str,
|
||||||
help='Target OSs (comma-separated).',
|
help='Target OSs (comma-separated).',
|
||||||
metavar='[all,host,android]',
|
metavar='[all,host,android,fuchsia]',
|
||||||
default='host')
|
default='host')
|
||||||
common_group.add_argument(
|
common_group.add_argument(
|
||||||
'--sanitizer',
|
'--sanitizer',
|
||||||
|
|
|
@ -314,7 +314,7 @@ def IsCrossBuild(target_os, arch):
|
||||||
# there is no need to build a legacy version of the SDK for comparison purposes.
|
# there is no need to build a legacy version of the SDK for comparison purposes.
|
||||||
def GetBuildConf(mode, arch, conf_os=None, sanitizer=None, dont_use_nnbd=False):
|
def GetBuildConf(mode, arch, conf_os=None, sanitizer=None, dont_use_nnbd=False):
|
||||||
nnbd = "Legacy" if dont_use_nnbd else ""
|
nnbd = "Legacy" if dont_use_nnbd else ""
|
||||||
if conf_os == 'android':
|
if conf_os != GuessOS() and conf_os != "host":
|
||||||
return '%s%s%s%s' % (GetBuildMode(mode), conf_os.title(), arch.upper(),
|
return '%s%s%s%s' % (GetBuildMode(mode), conf_os.title(), arch.upper(),
|
||||||
nnbd)
|
nnbd)
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue