mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 00:13:50 +00:00
Reland "Revert "Add an --os=fuchsia option to build.py:""
This reverts commit d39d4d0d55
.
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>
This commit is contained in:
parent
ae6a489dfb
commit
764e72800f
11
DEPS
11
DEPS
|
@ -470,6 +470,17 @@ deps = {
|
|||
"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": {
|
||||
"packages": [
|
||||
{
|
||||
|
|
|
@ -196,6 +196,16 @@ if (current_os == "win") {
|
|||
is_nacl = false
|
||||
is_posix = true
|
||||
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) {
|
||||
host_toolchain = "//build/toolchain/mac:clang_x64"
|
||||
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.
|
||||
# Otherwise there is a performance hit, in particular on ia32.
|
||||
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" ]
|
||||
ldflags += [ "-fPIC" ]
|
||||
}
|
||||
|
@ -276,6 +276,8 @@ config("compiler") {
|
|||
if (is_win) {
|
||||
# Up-to-date toolchain MSVC doesn't support c++11 flag any longer.
|
||||
cc_std = [ "/std:c++14" ]
|
||||
} else if (is_fuchsia) {
|
||||
cc_std = [ "-std=c++17" ]
|
||||
} else {
|
||||
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 (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
|
||||
# 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,
|
||||
|
@ -223,7 +226,12 @@ library_for_all_configs("libdart") {
|
|||
defines = [ "DART_ENABLE_WASM" ]
|
||||
}
|
||||
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 += [
|
||||
"$fuchsia_sdk_root/pkg:fdio",
|
||||
"$fuchsia_sdk_root/pkg:trace-engine",
|
||||
|
|
|
@ -42,7 +42,9 @@ template("build_libdart_builtin") {
|
|||
public_configs = [ ":libdart_builtin_config" ]
|
||||
deps = []
|
||||
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" ]
|
||||
} else {
|
||||
public_deps = [ "//zircon/public/lib/fdio" ]
|
||||
|
@ -314,7 +316,13 @@ template("build_gen_snapshot_dart_io") {
|
|||
deps = []
|
||||
|
||||
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 += [
|
||||
"$fuchsia_sdk_root/fidl:fuchsia.netstack",
|
||||
"$fuchsia_sdk_root/pkg:sys_cpp",
|
||||
|
@ -450,7 +458,13 @@ template("dart_io") {
|
|||
deps += [ "//third_party/boringssl" ]
|
||||
|
||||
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 += [
|
||||
"$fuchsia_sdk_root/fidl:fuchsia.netstack",
|
||||
"$fuchsia_sdk_root/pkg:sys_cpp",
|
||||
|
@ -779,7 +793,9 @@ template("dart_executable") {
|
|||
# have them. They are needed for running Fuchsia binaries built for the
|
||||
# host.
|
||||
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) {
|
||||
configs += [ "../../build/config/mac:mac_dynamic_flags" ]
|
||||
}
|
||||
|
@ -1007,7 +1023,11 @@ executable("run_vm_tests") {
|
|||
}
|
||||
|
||||
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" ]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -744,7 +744,9 @@ class ProcessStarter {
|
|||
}
|
||||
actions[3] = {
|
||||
.action = FDIO_SPAWN_ACTION_SET_NAME,
|
||||
.name.data = program_arguments_[0],
|
||||
.name = {
|
||||
.data = program_arguments_[0],
|
||||
},
|
||||
};
|
||||
|
||||
// Then fill in the namespace actions.
|
||||
|
@ -752,8 +754,10 @@ class ProcessStarter {
|
|||
for (size_t i = 0; i < flat_ns->count; i++) {
|
||||
actions[fixed_actions_cnt + i] = {
|
||||
.action = FDIO_SPAWN_ACTION_ADD_NS_ENTRY,
|
||||
.ns.prefix = flat_ns->path[i],
|
||||
.ns.handle = flat_ns->handle[i],
|
||||
.ns = {
|
||||
.prefix = flat_ns->path[i],
|
||||
.handle = flat_ns->handle[i],
|
||||
},
|
||||
};
|
||||
}
|
||||
free(flat_ns);
|
||||
|
|
|
@ -201,7 +201,9 @@ static AppSnapshot* TryReadAppSnapshotElf(
|
|||
*isolate_data_buffer = nullptr,
|
||||
*isolate_instructions_buffer = nullptr;
|
||||
Dart_LoadedElf* handle = nullptr;
|
||||
#if !defined(HOST_OS_FUCHSIA)
|
||||
if (force_load_elf_from_memory) {
|
||||
#endif
|
||||
File* const file =
|
||||
File::Open(/*namespc=*/nullptr, script_name, File::kRead);
|
||||
if (file == nullptr) return nullptr;
|
||||
|
@ -216,11 +218,13 @@ static AppSnapshot* TryReadAppSnapshotElf(
|
|||
&isolate_data_buffer, &isolate_instructions_buffer);
|
||||
delete memory;
|
||||
file->Release();
|
||||
#if !defined(HOST_OS_FUCHSIA)
|
||||
} else {
|
||||
handle = Dart_LoadELF(script_name, file_offset, &error, &vm_data_buffer,
|
||||
&vm_instructions_buffer, &isolate_data_buffer,
|
||||
&isolate_instructions_buffer);
|
||||
}
|
||||
#endif
|
||||
if (handle == nullptr) {
|
||||
Syslog::PrintErr("Loading failed: %s\n", error);
|
||||
return nullptr;
|
||||
|
|
|
@ -17,7 +17,9 @@ library_for_all_configs("libdart_platform") {
|
|||
extra_deps = []
|
||||
|
||||
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" ]
|
||||
} else {
|
||||
extra_deps += [ "//sdk/lib/sys/cpp" ]
|
||||
|
|
|
@ -72,7 +72,16 @@ library_for_all_configs("libdart_vm") {
|
|||
"//third_party/icu:icuuc",
|
||||
]
|
||||
if (is_fuchsia) {
|
||||
if (using_fuchsia_sdk) {
|
||||
if (using_fuchsia_gn_sdk) {
|
||||
extra_deps = [
|
||||
"$fuchsia_sdk_root/fidl/fuchsia.deprecatedtimezone",
|
||||
"$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 = [
|
||||
"$fuchsia_sdk_root/fidl:fuchsia.deprecatedtimezone",
|
||||
"$fuchsia_sdk_root/pkg:inspect",
|
||||
|
@ -114,7 +123,9 @@ library_for_all_configs_with_compiler("libdart_compiler") {
|
|||
sources = rebase_path(compiler_sources, ".", "./compiler/")
|
||||
include_dirs = [ ".." ]
|
||||
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" ]
|
||||
} else {
|
||||
extra_deps = [
|
||||
|
@ -128,7 +139,9 @@ library_for_all_configs_with_compiler("libdart_compiler") {
|
|||
library_for_all_configs("libdart_lib") {
|
||||
target_type = "source_set"
|
||||
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" ]
|
||||
} else {
|
||||
extra_deps = [
|
||||
|
|
|
@ -332,7 +332,7 @@ if (target_cpu == "x64") {
|
|||
ignore_patterns = "{}"
|
||||
},
|
||||
]
|
||||
if (is_linux || is_android) {
|
||||
if (is_linux || is_android || is_fuchsia) {
|
||||
copy_tree_specs += [
|
||||
{
|
||||
target = "copy_libtensorflowlite_c"
|
||||
|
|
|
@ -59,7 +59,7 @@ def BuildOptions():
|
|||
result.add_option(
|
||||
"--os",
|
||||
help='Target OSs (comma-separated).',
|
||||
metavar='[all,host,android]',
|
||||
metavar='[all,host,android,fuchsia]',
|
||||
default='host')
|
||||
result.add_option(
|
||||
"--sanitizer",
|
||||
|
@ -88,7 +88,7 @@ def ProcessOptions(options, args):
|
|||
if options.mode == 'all':
|
||||
options.mode = 'debug,release,product'
|
||||
if options.os == 'all':
|
||||
options.os = 'host,android'
|
||||
options.os = 'host,android,fuchsia'
|
||||
if options.sanitizer == 'all':
|
||||
options.sanitizer = 'none,asan,lsan,msan,tsan,ubsan'
|
||||
options.mode = options.mode.split(',')
|
||||
|
@ -110,13 +110,12 @@ def ProcessOptions(options, args):
|
|||
return False
|
||||
options.os = [ProcessOsOption(os_name) 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)
|
||||
return False
|
||||
if os_name != HOST_OS:
|
||||
if os_name != 'android':
|
||||
print("Unsupported target os %s" % os_name)
|
||||
return False
|
||||
if os_name == 'android':
|
||||
if not HOST_OS in ['linux', 'macos']:
|
||||
print("Cross-compilation to %s is not supported on host os %s."
|
||||
% (os_name, HOST_OS))
|
||||
|
@ -135,6 +134,19 @@ def ProcessOptions(options, args):
|
|||
"For android builds you must specify a target, such as 'runtime'."
|
||||
)
|
||||
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
|
||||
|
||||
|
||||
|
|
26
tools/gn.py
26
tools/gn.py
|
@ -281,7 +281,7 @@ def ProcessOptions(args):
|
|||
if args.mode == 'all':
|
||||
args.mode = 'debug,release,product'
|
||||
if args.os == 'all':
|
||||
args.os = 'host,android'
|
||||
args.os = 'host,android,fuchsia'
|
||||
if args.sanitizer == 'all':
|
||||
args.sanitizer = 'none,asan,lsan,msan,tsan,ubsan'
|
||||
args.mode = args.mode.split(',')
|
||||
|
@ -302,13 +302,12 @@ def ProcessOptions(args):
|
|||
return False
|
||||
oses = [ProcessOsOption(os_name) for os_name in args.os]
|
||||
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)
|
||||
return False
|
||||
if os_name != HOST_OS:
|
||||
if os_name != 'android':
|
||||
print("Unsupported target os %s" % os_name)
|
||||
return False
|
||||
if os_name == 'android':
|
||||
if not HOST_OS in ['linux', 'macos']:
|
||||
print("Cross-compilation to %s is not supported on host os %s."
|
||||
% (os_name, HOST_OS))
|
||||
|
@ -320,6 +319,19 @@ def ProcessOptions(args):
|
|||
"Cross-compilation to %s is not supported for architecture %s."
|
||||
% (os_name, arch))
|
||||
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:
|
||||
print("Crashpad is only supported on Windows")
|
||||
return False
|
||||
|
@ -366,7 +378,7 @@ def parse_args(args):
|
|||
'--os',
|
||||
type=str,
|
||||
help='Target OSs (comma-separated).',
|
||||
metavar='[all,host,android]',
|
||||
metavar='[all,host,android,fuchsia]',
|
||||
default='host')
|
||||
common_group.add_argument(
|
||||
'--sanitizer',
|
||||
|
|
|
@ -311,7 +311,7 @@ def IsCrossBuild(target_os, arch):
|
|||
|
||||
|
||||
def GetBuildConf(mode, arch, conf_os=None, sanitizer=None):
|
||||
if conf_os == 'android':
|
||||
if conf_os != GuessOS() and conf_os != "host":
|
||||
return '%s%s%s' % (GetBuildMode(mode), conf_os.title(), arch.upper())
|
||||
else:
|
||||
# Ask for a cross build if the host and target architectures don't match.
|
||||
|
|
Loading…
Reference in a new issue