diff --git a/.gitignore b/.gitignore index 2693a712c7..284a7b1ee4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ # build +*.swp /out/ /target/ *.pyc diff --git a/.gn b/.gn index 94ff452ac7..ce64e43d74 100644 --- a/.gn +++ b/.gn @@ -30,7 +30,6 @@ default_args = { # for now. See http://clang.llvm.org/docs/ControlFlowIntegrity.html is_cfi = false - is_component_build = false symbol_level = 1 treat_warnings_as_errors = true rust_treat_warnings_as_errors = true @@ -44,7 +43,7 @@ default_args = { v8_experimental_extra_library_files = [] v8_extra_library_files = [] v8_imminent_deprecation_warnings = false - v8_monolithic = true + v8_monolithic = false v8_untrusted_code_mitigations = false v8_use_external_startup_data = false v8_use_snapshot = true diff --git a/BUILD.gn b/BUILD.gn index 064f8d1463..060b024a1e 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -218,11 +218,23 @@ v8_executable("test_cc") { configs = [ ":deno_config" ] } +v8_static_library("v8") { + public_deps = [ + "third_party/v8:v8", + "third_party/v8:v8_libbase", + "third_party/v8:v8_libplatform", + "third_party/v8:v8_libsampler", + "//build/win:default_exe_manifest", + ] + configs = [ ":deno_config" ] +} + # Only functionality needed for libdeno_test and snapshot_creator # In particular no flatbuffers, no assets, no rust, no msg handlers. # Because snapshots are slow, it's important that snapshot_creator's # dependencies are minimal. -static_library("libdeno") { +v8_static_library("libdeno") { + configs = [ ":deno_config" ] sources = [ "libdeno/api.cc", "libdeno/binding.cc", @@ -231,30 +243,44 @@ static_library("libdeno") { "libdeno/file_util.h", "libdeno/internal.h", ] - public_deps = [ - "third_party/v8:v8_monolith", - ] - configs += [ ":deno_config" ] + if (!use_prebuilt_v8) { + public_deps = [ + ":v8", + ] + } else { + # TODO(ry) It would be nice to have a standalone target for the prebuilt + # library that could simply be added to the deps here, but it wasn't + # obvious how to accomplish that in gn. + if (is_mac) { + libs = [ "//prebuilt/mac/libv8.a" ] + } else if (is_linux) { + libs = [ "//prebuilt/linux64/libv8.a" ] + } else if (is_win) { + libs = [ "//prebuilt/win/v8.lib" ] + } else { + assert(false, "We don't have prebuilt binaries for this platform yet.") + } + } } -static_library("deno_deps") { +v8_static_library("deno_deps") { complete_static_lib = true public_deps = [ ":libdeno", ":msg_rs", ":snapshot", ] - configs += [ ":deno_config" ] + configs = [ ":deno_config" ] } -executable("snapshot_creator") { +v8_executable("snapshot_creator") { sources = [ "libdeno/snapshot_creator.cc", ] deps = [ ":libdeno", ] - configs += [ ":deno_config" ] + configs = [ ":deno_config" ] } # Generates the core TypeScript type library for deno that will be diff --git a/Docs.md b/Docs.md index 9c0a0a8fd4..ee359e1c2b 100644 --- a/Docs.md +++ b/Docs.md @@ -332,6 +332,17 @@ We use Flatbuffers to define common structs and enums between TypeScript and Rust. These common data structures are defined in https://github.com/denoland/deno/blob/master/src/msg.fbs +### Internal: Updating prebuilt binaries + +V8 takes a long time to build - on the order of an hour. We use pre-built V8 +libraries stored in a Google Storage bucket instead of rebuilding it from +scratch each time. Our build system is however setup such that we can build V8 +as part of the Deno build if necessary (useful for debugging or changing various +configurations in V8, or building the pre-built binaries themselves). To control +whether to use a pre-built V8 or not use the `use_v8_prebuilt` GN argument. + +Use `tools/gcloud_upload.py` to upload new prebuilt files. + ## Contributing See diff --git a/build_extra/deno.gni b/build_extra/deno.gni index 08cccfdea9..9e0d43cab6 100644 --- a/build_extra/deno.gni +++ b/build_extra/deno.gni @@ -1,6 +1,11 @@ # Copyright 2018 the Deno authors. All rights reserved. MIT license. import("//build/compiled_action.gni") +declare_args() { + # Use prebuilt V8 libraries from //prebuilt/ + use_prebuilt_v8 = true +} + template("run_node") { action(target_name) { forward_variables_from(invoker, "*") diff --git a/tools/setup.py b/tools/setup.py index b806267cbe..57f99f8a4e 100755 --- a/tools/setup.py +++ b/tools/setup.py @@ -7,6 +7,7 @@ import os import re import sys from distutils.spawn import find_executable +import prebuilt def main(): @@ -18,6 +19,7 @@ def main(): third_party.download_gn() third_party.download_clang_format() third_party.download_clang() + prebuilt.load() third_party.maybe_download_sysroot() write_lastchange()