Make //build a git submodule

So we can float patches before sending them upstream.
https://github.com/denoland/chromium_build

Remove build_extra/toolchain
This commit is contained in:
Ryan Dahl 2018-11-29 21:50:38 -05:00
parent b6fda735ee
commit 1ac2934604
10 changed files with 9 additions and 551 deletions

4
.gitmodules vendored
View File

@ -1,3 +1,7 @@
[submodule "third_party"]
path = third_party
url = https://github.com/denoland/deno_third_party.git
[submodule "build"]
path = build
url = https://github.com/denoland/chromium_build.git
branch = deno

View File

@ -3,7 +3,6 @@ import("//build/toolchain/cc_wrapper.gni")
import("//build_extra/flatbuffers/flatbuffer.gni")
import("//build_extra/flatbuffers/rust/rust_flatbuffer.gni")
import("//build_extra/rust/rust.gni")
import("//build_extra/toolchain/validate.gni")
import("//third_party/v8/gni/v8.gni")
import("//third_party/v8/snapshot_toolchain.gni")
import("libdeno/deno.gni")

1
build
View File

@ -1 +0,0 @@
third_party/v8/build

1
build Submodule

@ -0,0 +1 @@
Subproject commit 414ab91cd9e5511aa5dc35ec3eaea5de8445544a

View File

@ -1,19 +0,0 @@
# Copyright 2018 the Deno authors. All rights reserved. MIT license.
import("//build/toolchain/cc_wrapper.gni")
# Verify that the cc_wrapper/toolchain combo correctly set up on Windows.
if (is_win && cc_wrapper != "") {
cc_wrapper_toolchain = "//build_extra/toolchain/win:win_clang_$target_cpu"
toolchain_supports_cc_wrapper = cc_wrapper_toolchain == default_toolchain &&
cc_wrapper_toolchain == host_toolchain
if (!toolchain_supports_cc_wrapper) {
# Using print instead of assert-with-message for readability of the output.
print("The 'cc_wrapper' option isn't supported by the default Windows" +
" toolchain. To make it work, add these gn arguments:")
print(" custom_toolchain=\"$cc_wrapper_toolchain\"")
print(" host_toolchain=\"$cc_wrapper_toolchain\"")
assert(toolchain_supports_cc_wrapper)
}
}

View File

@ -1,494 +0,0 @@
# Automatically generated. See mods.gni.
# Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("mods.gni")
import("//build/config/clang/clang.gni")
import("//build/config/compiler/compiler.gni")
import("//build/config/sanitizers/sanitizers.gni")
import("//build/config/win/visual_studio_version.gni")
import("//build/toolchain/clang_static_analyzer.gni")
import("//build/toolchain/goma.gni")
import("//build/toolchain/toolchain.gni")
# Should only be running on Windows.
assert(is_win)
# Setup the Visual Studio state.
#
# Its arguments are the VS path and the compiler wrapper tool. It will write
# "environment.x86" and "environment.x64" to the build directory and return a
# list to us.
# This tool will is used as a wrapper for various commands below.
tool_wrapper_path = rebase_path("tool_wrapper.py", root_build_dir)
if (use_goma) {
if (host_os == "win") {
goma_prefix = "$goma_dir/gomacc.exe "
} else {
goma_prefix = "$goma_dir/gomacc "
}
} else {
goma_prefix = ""
}
# Copy the VS runtime DLL for the default toolchain to the root build directory
# so things will run.
if (current_toolchain == default_toolchain) {
if (is_debug) {
configuration_name = "Debug"
} else {
configuration_name = "Release"
}
exec_script("$base_toolchain_dir/../../vs_toolchain.py",
[
"copy_dlls",
rebase_path(root_build_dir),
configuration_name,
target_cpu,
])
}
# Parameters:
# environment: File name of environment file.
#
# You would also define a toolchain_args variable with at least these set:
# current_cpu: current_cpu to pass as a build arg
# current_os: current_os to pass as a build arg
template("msvc_toolchain") {
toolchain(target_name) {
# 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.
assert(defined(invoker.toolchain_args))
toolchain_args = {
if (defined(invoker.toolchain_args)) {
forward_variables_from(invoker.toolchain_args, "*")
}
# This value needs to be passed through unchanged.
host_toolchain = host_toolchain
}
# Make these apply to all tools below.
lib_switch = ""
lib_dir_switch = "/LIBPATH:"
# Object files go in this directory.
object_subdir = "{{target_out_dir}}/{{label_name}}"
env = invoker.environment
# When the invoker has explicitly overridden use_goma or cc_wrapper in the
# toolchain args, use those values, otherwise default to the global one.
# This works because the only reasonable override that toolchains might
# supply for these values are to force-disable them.
if (defined(toolchain_args.is_clang)) {
toolchain_uses_clang = toolchain_args.is_clang
} else {
toolchain_uses_clang = is_clang
}
cl = invoker.cl
if (toolchain_uses_clang && use_clang_static_analyzer) {
analyzer_prefix =
"$python_path " +
rebase_path("//build/toolchain/clang_static_analyzer_wrapper.py",
root_build_dir) + " --mode=cl"
cl = "${analyzer_prefix} ${cl}"
}
if (use_lld) {
if (host_os == "win") {
lld_link = "lld-link.exe"
} else {
lld_link = "lld-link"
}
prefix = rebase_path("$clang_base_path/bin", root_build_dir)
# lld-link includes a replacement for lib.exe that can produce thin
# archives and understands bitcode (for lto builds).
lib = "$prefix/$lld_link /lib /llvmlibthin"
link = "$prefix/$lld_link"
if (host_os != "win") {
# See comment adding --rsp-quoting to $cl above for more information.
link = "$link --rsp-quoting=posix"
}
} else {
lib = "lib.exe"
link = "link.exe"
}
# If possible, pass system includes as flags to the compiler. When that's
# not possible, load a full environment file (containing %INCLUDE% and
# %PATH%) -- e.g. 32-bit MSVS builds require %PATH% to be set and just
# passing in a list of include directories isn't enough.
if (defined(invoker.sys_include_flags)) {
env_wrapper = ""
sys_include_flags = "${invoker.sys_include_flags} " # Note trailing space.
} else {
# clang-cl doesn't need this env hoop, so omit it there.
assert(!toolchain_uses_clang)
env_wrapper = "ninja -t msvc -e $env -- " # Note trailing space.
sys_include_flags = ""
}
# ninja does not have -t msvc other than windows, and lld doesn't depend on
# mt.exe in PATH on non-Windows, so it's not needed there anyways.
if (defined(invoker.sys_lib_flags)) {
linker_wrapper = ""
sys_lib_flags = "${invoker.sys_lib_flags} " # Note trailing space
} else if (use_lld) {
# Invoke ninja as wrapper instead of tool wrapper, because python
# invocation requires higher cpu usage compared to ninja invocation, and
# the python wrapper is only needed to work around link.exe problems.
# TODO(thakis): Remove wrapper once lld-link can merge manifests without
# relying on mt.exe being in %PATH% on Windows, https://crbug.com/872740
linker_wrapper = "ninja -t msvc -e $env -- " # Note trailing space.
sys_lib_flags = ""
} else {
linker_wrapper =
"$python_path $tool_wrapper_path link-wrapper $env False " # Note trailing space.
sys_lib_flags = ""
}
clflags = ""
# Pass /FC flag to the compiler if needed.
if (msvc_use_absolute_paths) {
clflags += "/FC "
}
tool("cc") {
precompiled_header_type = "msvc"
pdbname = "{{target_out_dir}}/{{label_name}}_c.pdb"
# Label names may have spaces in them so the pdbname must be quoted. The
# source and output don't need to be quoted because GN knows they're a
# full file name and will quote automatically when necessary.
depsformat = "msvc"
description = "CC {{output}}"
outputs = [
"$object_subdir/{{source_name_part}}.obj",
]
command = "$env_wrapper$cl /nologo /showIncludes ${clflags} $sys_include_flags{{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} /c {{source}} /Fo{{output}} /Fd\"$pdbname\""
}
tool("cxx") {
precompiled_header_type = "msvc"
# The PDB name needs to be different between C and C++ compiled files.
pdbname = "{{target_out_dir}}/{{label_name}}_cc.pdb"
# See comment in CC tool about quoting.
depsformat = "msvc"
description = "CXX {{output}}"
outputs = [
"$object_subdir/{{source_name_part}}.obj",
]
command = "$env_wrapper$cl /nologo /showIncludes ${clflags} $sys_include_flags{{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}} /c {{source}} /Fo{{output}} /Fd\"$pdbname\""
}
tool("rc") {
command = "$python_path $tool_wrapper_path rc-wrapper $env rc.exe {{defines}} {{include_dirs}} /fo{{output}} {{source}}"
depsformat = "msvc"
outputs = [
"$object_subdir/{{source_name_part}}.res",
]
description = "RC {{output}}"
}
tool("asm") {
if (toolchain_args.current_cpu == "x64") {
ml = "ml64.exe"
} else {
ml = "ml.exe"
}
command = "$python_path $tool_wrapper_path asm-wrapper $env $ml {{defines}} {{include_dirs}} {{asmflags}} /c /Fo{{output}} {{source}}"
description = "ASM {{output}}"
outputs = [
"$object_subdir/{{source_name_part}}.obj",
]
}
tool("alink") {
rspfile = "{{output}}.rsp"
command = "$linker_wrapper$lib /nologo ${sys_lib_flags}{{arflags}} /OUT:{{output}} @$rspfile"
description = "LIB {{output}}"
outputs = [
# Ignore {{output_extension}} and always use .lib, there's no reason to
# allow targets to override this extension on Windows.
"{{output_dir}}/{{target_output_name}}.lib",
]
default_output_extension = ".lib"
default_output_dir = "{{target_out_dir}}"
# The use of inputs_newline is to work around a fixed per-line buffer
# size in the linker.
rspfile_content = "{{inputs_newline}}"
}
tool("solink") {
dllname = "{{output_dir}}/{{target_output_name}}{{output_extension}}" # e.g. foo.dll
libname = "${dllname}.lib" # e.g. foo.dll.lib
pdbname = "${dllname}.pdb"
rspfile = "${dllname}.rsp"
pool = "//build/toolchain:link_pool($default_toolchain)"
command = "$linker_wrapper$link /nologo ${sys_lib_flags}/IMPLIB:$libname /DLL /OUT:$dllname /PDB:$pdbname @$rspfile"
default_output_extension = ".dll"
default_output_dir = "{{root_out_dir}}"
description = "LINK(DLL) {{output}}"
outputs = [
dllname,
libname,
]
link_output = libname
depend_output = libname
runtime_outputs = [ dllname ]
if (symbol_level != 0) {
outputs += [ pdbname ]
runtime_outputs += [ pdbname ]
}
# Since the above commands only updates the .lib file when it changes, ask
# Ninja to check if the timestamp actually changed to know if downstream
# dependencies should be recompiled.
restat = true
# The use of inputs_newline is to work around a fixed per-line buffer
# size in the linker.
rspfile_content = "{{libs}} {{solibs}} {{inputs_newline}} {{ldflags}}"
}
tool("solink_module") {
dllname = "{{output_dir}}/{{target_output_name}}{{output_extension}}" # e.g. foo.dll
pdbname = "${dllname}.pdb"
rspfile = "${dllname}.rsp"
pool = "//build/toolchain:link_pool($default_toolchain)"
command = "$linker_wrapper$link /nologo ${sys_lib_flags}/DLL /OUT:$dllname /PDB:$pdbname @$rspfile"
default_output_extension = ".dll"
default_output_dir = "{{root_out_dir}}"
description = "LINK_MODULE(DLL) {{output}}"
outputs = [
dllname,
]
if (symbol_level != 0) {
outputs += [ pdbname ]
}
runtime_outputs = outputs
# The use of inputs_newline is to work around a fixed per-line buffer
# size in the linker.
rspfile_content = "{{libs}} {{solibs}} {{inputs_newline}} {{ldflags}}"
}
tool("link") {
exename = "{{output_dir}}/{{target_output_name}}{{output_extension}}"
pdbname = "$exename.pdb"
rspfile = "$exename.rsp"
pool = "//build/toolchain:link_pool($default_toolchain)"
command = "$linker_wrapper$link /nologo ${sys_lib_flags}/OUT:$exename /PDB:$pdbname @$rspfile"
default_output_extension = ".exe"
default_output_dir = "{{root_out_dir}}"
description = "LINK {{output}}"
outputs = [
exename,
]
if (symbol_level != 0) {
outputs += [ pdbname ]
}
runtime_outputs = outputs
# The use of inputs_newline is to work around a fixed per-line buffer
# size in the linker.
rspfile_content = "{{inputs_newline}} {{libs}} {{solibs}} {{ldflags}}"
}
# These two are really entirely generic, but have to be repeated in
# each toolchain because GN doesn't allow a template to be used here.
# See //build/toolchain/toolchain.gni for details.
tool("stamp") {
command = stamp_command
description = stamp_description
pool = "//build/toolchain:action_pool($default_toolchain)"
}
tool("copy") {
command = copy_command
description = copy_description
pool = "//build/toolchain:action_pool($default_toolchain)"
}
tool("action") {
pool = "//build/toolchain:action_pool($default_toolchain)"
}
}
}
if (host_os == "win") {
clang_cl = "clang-cl.exe"
} else {
clang_cl = "clang-cl"
}
if (target_cpu == "x86" || target_cpu == "x64") {
win_build_host_cpu = target_cpu
} else {
win_build_host_cpu = host_cpu
}
# x86, arm and arm64 build cpu toolchains for Windows (not WinUWP). Only
# define when the build cpu is one of these architectures since we don't
# do any cross compiles when targeting x64-bit (the build does generate
# some 64-bit stuff from x86/arm/arm64 target builds).
if (win_build_host_cpu != "x64") {
build_cpu_toolchain_data =
exec_script("$base_toolchain_dir/setup_toolchain.py",
[
visual_studio_path,
windows_sdk_path,
visual_studio_runtime_dirs,
host_os,
win_build_host_cpu,
"environment." + win_build_host_cpu,
],
"scope")
msvc_toolchain(win_build_host_cpu) {
environment = "environment." + win_build_host_cpu
cl = "${goma_prefix}${cc_wrapper_prefix}\"${build_cpu_toolchain_data.vc_bin_dir}/cl.exe\""
if (host_os != "win") {
# For win cross build.
sys_lib_flags = "${build_cpu_toolchain_data.libpath_flags}"
}
toolchain_args = {
current_os = "win"
current_cpu = win_build_host_cpu
is_clang = false
}
}
msvc_toolchain("win_clang_" + win_build_host_cpu) {
environment = "environment." + win_build_host_cpu
prefix = rebase_path("$clang_base_path/bin", root_build_dir)
cl = "${goma_prefix}${cc_wrapper_prefix}$prefix/${clang_cl}"
sys_include_flags = "${build_cpu_toolchain_data.include_flags_imsvc}"
if (host_os != "win") {
# For win cross build.
sys_lib_flags = "${build_cpu_toolchain_data.libpath_flags}"
}
toolchain_args = {
current_os = "win"
current_cpu = win_build_host_cpu
is_clang = true
}
}
}
# 64-bit toolchains.
x64_toolchain_data = exec_script("$base_toolchain_dir/setup_toolchain.py",
[
visual_studio_path,
windows_sdk_path,
visual_studio_runtime_dirs,
"win",
"x64",
"environment.x64",
],
"scope")
template("win_x64_toolchains") {
msvc_toolchain(target_name) {
environment = "environment.x64"
cl = "${goma_prefix}${cc_wrapper_prefix}\"${x64_toolchain_data.vc_bin_dir}/cl.exe\""
if (host_os != "win") {
# For win cross build
sys_lib_flags = "${x64_toolchain_data.libpath_flags}"
}
toolchain_args = {
if (defined(invoker.toolchain_args)) {
forward_variables_from(invoker.toolchain_args, "*")
}
is_clang = false
current_os = "win"
current_cpu = "x64"
}
}
msvc_toolchain("win_clang_" + target_name) {
environment = "environment.x64"
prefix = rebase_path("$clang_base_path/bin", root_build_dir)
cl = "${goma_prefix}${cc_wrapper_prefix}$prefix/${clang_cl}"
sys_include_flags = "${x64_toolchain_data.include_flags_imsvc}"
if (host_os != "win") {
# For win cross build
sys_lib_flags = "${x64_toolchain_data.libpath_flags}"
}
toolchain_args = {
if (defined(invoker.toolchain_args)) {
forward_variables_from(invoker.toolchain_args, "*")
}
is_clang = true
current_os = "win"
current_cpu = "x64"
}
}
}
win_x64_toolchains("x64") {
toolchain_args = {
# Use the defaults.
}
}
# The nacl_win64 toolchain is nearly identical to the plain x64 toolchain.
# It's used solely for building nacl64.exe (//components/nacl/broker:nacl64).
# The only reason it's a separate toolchain is so that it can force
# is_component_build to false in the toolchain_args() block, because
# building nacl64.exe in component style does not work.
win_x64_toolchains("nacl_win64") {
toolchain_args = {
is_component_build = false
}
}
# WinUWP toolchains. Only define these when targeting them.
if (target_os == "winuwp") {
assert(target_cpu == "x64" || target_cpu == "x86" || target_cpu == "arm" ||
target_cpu == "arm64")
store_cpu_toolchain_data =
exec_script("$base_toolchain_dir/setup_toolchain.py",
[
visual_studio_path,
windows_sdk_path,
visual_studio_runtime_dirs,
target_os,
target_cpu,
"environment.store_" + target_cpu,
],
"scope")
msvc_toolchain("uwp_" + target_cpu) {
environment = "environment.store_" + target_cpu
cl = "${goma_prefix}${cc_wrapper_prefix}\"${store_cpu_toolchain_data.vc_bin_dir}/cl.exe\""
toolchain_args = {
current_os = "winuwp"
current_cpu = target_cpu
is_clang = false
}
}
}

View File

@ -1,28 +0,0 @@
# Copyright 2018 the Deno authors. All rights reserved. MIT license.
# The toolchain definitions in BUILD.gn are derived from Chromium's default
# Windows toolchain. The only difference is that the 'cc_wrapper' build option
# is honored, so we can use ccache or an equivalent tool.
#
# 'BUILD.gn' was generated as follows (using GNU sed):
#
# (echo -e '# Automatically generated. See mods.gni.\n' |
# cat - ../../../build/toolchain/win/BUILD.gn |
# sed '0,/import/s|import|import("mods.gni")\n&|' |
# sed 's|exec_script("|&$base_toolchain_dir/|' |
# sed 's|${goma_prefix}|&${cc_wrapper_prefix}|' ) > BUILD.gn
# gn format BUILD.gn
# Ensure the 'cc_wrapper' variable is in scope.
import("//build/toolchain/cc_wrapper.gni")
# Location of the original toolchain definition that this one is derived from.
# Some python scripts that are run by BUILD.gni live here.
base_toolchain_dir = "//build/toolchain/win"
# If cc_wrapper if is set, add a space to it.
if (cc_wrapper == "") {
cc_wrapper_prefix = ""
} else {
cc_wrapper_prefix = "$cc_wrapper "
}

View File

@ -4,6 +4,7 @@ solutions = [{
'name': 'v8',
'deps_file': 'DEPS',
'custom_deps': {
'v8/build': None,
'v8/third_party/catapult': None,
'v8/third_party/colorama/src': None,
'v8/testing/gmock': None,

@ -1 +1 @@
Subproject commit f89841f37209f5995263f0a41f5c247d35550f21
Subproject commit 5206c3eec54e5a8eac93ba2d5b7f8eaa088d14a2

View File

@ -122,12 +122,7 @@ def generate_gn_args(mode):
if cc_wrapper:
# The gn toolchain does not shell escape cc_wrapper, so do it here.
out += ['cc_wrapper=%s' % gn_string(shell_quote(cc_wrapper))]
# For cc_wrapper to work on Windows, we need to select our own toolchain
# by overriding 'custom_toolchain' and 'host_toolchain'.
# TODO: Is there a way to use it without the involvement of args.gn?
if os.name == "nt":
tc = "//build_extra/toolchain/win:win_clang_x64"
out += ['custom_toolchain="%s"' % tc, 'host_toolchain="%s"' % tc]
# Disable treat_warnings_as_errors until this sccache bug is fixed:
# https://github.com/mozilla/sccache/issues/264
out += ["treat_warnings_as_errors=false"]

View File

@ -105,7 +105,6 @@ def fix_symlinks():
# and it's target are in different repos. Here we fix the symlinks that exist
# in the root repo while their target is in the third_party repo.
remove_and_symlink("third_party/node_modules", root("node_modules"), True)
remove_and_symlink("third_party/v8/build", root("build"), True)
remove_and_symlink("third_party/v8/buildtools", root("buildtools"), True)
remove_and_symlink("third_party/v8/build_overrides",
root("build_overrides"), True)
@ -260,7 +259,8 @@ def maybe_download_sysroot():
if sys.platform.startswith('linux'):
run([
'python',
tp('v8/build/linux/sysroot_scripts/install-sysroot.py'),
os.path.join(root_path,
'build/linux/sysroot_scripts/install-sysroot.py'),
'--arch=amd64'
],
env=google_env())