diff --git a/.gclient b/.gclient new file mode 100644 index 00000000..fcd5b00b --- /dev/null +++ b/.gclient @@ -0,0 +1,183 @@ +solutions = [ + { + 'url': 'https://github.com/v8/v8.git@7.9.317.12', + 'name': 'v8', + 'custom_hooks': [ + # Surpress v8 hooks... one wishes there was a better way to do this. + { 'name': 'disable_depot_tools_selfupdate' }, + { 'name': 'landmines' }, + { 'name': 'clang_format_win' }, + { 'name': 'clang_format_mac' }, + { 'name': 'clang_format_linux' }, + { 'name': 'gcmole' }, + { 'name': 'jsfunfuzz' }, + { 'name': 'wasm_spec_tests' }, + { 'name': 'wasm_js' }, + { 'name': 'msan_chained_origins' }, + { 'name': 'msan_no_origins' }, + { 'name': 'win_toolchain' }, + { 'name': 'mac_toolchain' }, + { 'name': 'binutils' }, + { 'name': 'clang' }, + { 'name': 'lastchange' }, + { 'name': 'fuchsia_sdk' }, + { 'name': 'lld/mac' }, + { 'name': 'llvm-objdump' }, + { 'name': 'vpython_common' }, + { 'name': 'check_v8_header_includes' }, + { 'name': 'sysroot_arm' }, + { 'name': 'sysroot_arm64' }, + { 'name': 'sysroot_x86' }, + { 'name': 'sysroot_x64' }, + ], + 'custom_deps': { + 'v8/build': None, + 'v8/buildtools': None, + 'v8/buildtools/clang_format/script': None, + 'v8/buildtools/linux64': None, + 'v8/buildtools/mac': None, + 'v8/test/benchmarks/data': None, + 'v8/test/mozilla/data': None, + 'v8/test/test262/data': None, + 'v8/test/test262/harness': None, + 'v8/test/wasm-js': None, + 'v8/third_party/android_tools': None, + 'v8/third_party/catapult': None, + 'v8/third_party/colorama/src': None, + 'v8/third_party/depot_tools': None, + #'v8/third_party/googletest/src': None, + 'v8/third_party/icu': None, + 'v8/third_party/instrumented_libraries': None, + 'v8/third_party/jinja2': None, + 'v8/third_party/markupsafe': None, + 'v8/third_party/perfetto': None, + 'v8/third_party/protobuf': None, + 'v8/tools/clang': None, + 'v8/tools/clang/dsymutil': None, + 'v8/tools/gyp': None, + 'v8/tools/luci-go': None, + 'v8/tools/swarming_client': None, + } + }, + { + 'url': + 'https://chromium.googlesource.com/chromium/src/build.git@082f11b29976c3be67dddd74bd75c6d1793201c7', + 'name': 'build', + }, + { + 'url': + 'https://chromium.googlesource.com/chromium/src/buildtools.git@cf454b247c611167388742c7a31ef138a6031172', + 'name': 'buildtools', + }, + { + 'url': + 'https://chromium.googlesource.com/chromium/src/tools/clang.git@c5d85f1e9d3a01e4de2ccf4dfaa7847653ae9121', + 'name': 'tools/clang', + }, + { + 'url': + 'https://chromium.googlesource.com/chromium/src/third_party/jinja2.git@b41863e42637544c2941b574c7877d3e1f663e25', + 'name': 'third_party/jinja2', + }, + { + 'url': + 'https://chromium.googlesource.com/chromium/src/third_party/markupsafe.git@8f45f5cfa0009d2a70589bcda0349b8cb2b72783', + 'name': 'third_party/markupsafe', + }, +] + +hooks = [ + { + # Ensure that the DEPS'd "depot_tools" has its self-update capability + # disabled. + 'name': 'disable_depot_tools_selfupdate', + 'pattern': '.', + 'action': [ + 'python', + 'third_party/depot_tools/update_depot_tools_toggle.py', + '--disable', + ], + }, + # { + # # This clobbers when necessary (based on get_landmines.py). It must be the + # # first hook so that other things that get/generate into the output + # # directory will not subsequently be clobbered. + # 'name': 'landmines', + # 'pattern': '.', + # 'action': [ + # 'python', + # 'build/landmines.py', + # '--landmine-scripts', + # 'tools/get_landmines.py', + # ], + # }, + { + 'name': 'sysroot_arm', + 'pattern': '.', + 'condition': '(checkout_linux and checkout_arm)', + 'action': ['python', 'build/linux/sysroot_scripts/install-sysroot.py', + '--arch=arm'], + }, + { + 'name': 'sysroot_arm64', + 'pattern': '.', + 'condition': '(checkout_linux and checkout_arm64)', + 'action': ['python', 'build/linux/sysroot_scripts/install-sysroot.py', + '--arch=arm64'], + }, + { + 'name': 'sysroot_x86', + 'pattern': '.', + 'condition': '(checkout_linux and (checkout_x86 or checkout_x64))', + 'action': ['python', 'build/linux/sysroot_scripts/install-sysroot.py', + '--arch=x86'], + }, + { + 'name': 'sysroot_x64', + 'pattern': '.', + 'condition': 'checkout_linux and checkout_x64', + 'action': ['python', 'build/linux/sysroot_scripts/install-sysroot.py', + '--arch=x64'], + }, + { + # Update the Windows toolchain if necessary. + 'name': 'win_toolchain', + 'pattern': '.', + 'condition': 'checkout_win', + 'action': ['python', 'build/vs_toolchain.py', 'update'], + }, + { + # Update the Mac toolchain if necessary. + 'name': 'mac_toolchain', + 'pattern': '.', + 'condition': 'checkout_mac', + 'action': ['python', 'build/mac_toolchain.py'], + }, + # Pull binutils for linux, enabled debug fission for faster linking / + # debugging when used with clang on Ubuntu Precise. + # https://code.google.com/p/chromium/issues/detail?id=352046 + #{ + # 'name': 'binutils', + # 'pattern': 'third_party/binutils', + # 'condition': 'host_os == "linux"', + # 'action': [ + # 'python', + # 'v8/third_party/binutils/download.py', + # ], + #}, + { + # Note: On Win, this should run after win_toolchain, as it may use it. + 'name': 'clang', + 'pattern': '.', + # clang not supported on aix + 'condition': 'host_os != "aix"', + 'action': ['python', 'tools/clang/scripts/update.py'], + }, + { + # Update LASTCHANGE. + 'name': 'lastchange', + 'pattern': '.', + 'action': ['python', 'build/util/lastchange.py', + '-o', 'build/util/LASTCHANGE'], + }, +] diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 8faaeb0c..00000000 --- a/.gitattributes +++ /dev/null @@ -1,8 +0,0 @@ -build symlink=dir -buildtools symlink=dir -build_overrides symlink=dir -testing symlink=dir -third_party/googletest symlink=dir -third_party/jinja2 symlink=dir -third_party/llvm-build symlink=dir -third_party/markupsafe symlink=dir diff --git a/.gitignore b/.gitignore index 1349b734..ae2ea16f 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,13 @@ /.vscode/ /target/ -/third_party/.cipd/ -/third_party/gclient_config.py_entries -/third_party/v8/ +/.cipd/ +.gclient_entries +/v8/ +/build/ +/buildtools/ +/tools/clang/ +/third_party/jinja2/ +/third_party/markupsafe/ +/third_party/llvm-build/ +.landmines diff --git a/.gn b/.gn index 7916c47a..af43e695 100644 --- a/.gn +++ b/.gn @@ -11,6 +11,11 @@ buildconfig = "//build/config/BUILDCONFIG.gn" # "gn check" or "gn gen --check". check_targets = [] +# The secondary source root is a parallel directory tree where +# GN build files are placed when they can not be placed directly +# in the source tree, e.g. for third party source trees. +secondary_source = "//v8/" + default_args = { # Various global chrome args that are unrelated to deno. proprietary_codecs = false @@ -26,6 +31,8 @@ default_args = { # To disable "use_atk" and other features that we don't need. is_desktop_linux = false + linux_use_bundled_binutils = false + # TODO(ry) We may want to turn on CFI at some point. Disabling for simplicity # for now. See http://clang.llvm.org/docs/ControlFlowIntegrity.html is_cfi = false @@ -34,10 +41,6 @@ default_args = { # this breaks cargo build in debug mode in OSX. is_component_build = false - # Enable Jumbo build for a faster build. - # https://chromium.googlesource.com/chromium/src/+/master/docs/jumbo.md - use_jumbo_build = true - symbol_level = 1 treat_warnings_as_errors = true diff --git a/BUILD.gn b/BUILD.gn index 22d231e4..f8777112 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -1,5 +1,5 @@ # Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import("//third_party/v8/gni/v8.gni") +import("//v8/gni/v8.gni") v8_static_library("rusty_v8") { sources = [ @@ -22,17 +22,16 @@ v8_static_library("rusty_v8") { v8_source_set("v8") { deps = [ - "//third_party/v8:v8", - "//third_party/v8:v8_libbase", - "//third_party/v8:v8_libplatform", - "//third_party/v8:v8_libsampler", + "//v8:v8", + "//v8:v8_libbase", + "//v8:v8_libplatform", + "//v8:v8_libsampler", ] configs = [ ":rusty_v8_config" ] } config("rusty_v8_config") { - include_dirs = [ "//third_party/v8" ] # This allows us to v8/src/base/ libraries. - configs = [ "//third_party/v8:external_config" ] + configs = [ "//v8:external_config" ] cflags = [] if (is_debug) { diff --git a/Cargo.lock b/Cargo.lock index 62f12fa7..19ab058b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -60,7 +60,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "rusty_v8" -version = "0.0.1" +version = "0.0.2" dependencies = [ "cargo_gn 0.0.13 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/Cargo.toml b/Cargo.toml index 67b586f9..d32f007f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,8 +1,24 @@ [package] name = "rusty_v8" -version = "0.0.1" -authors = ["Bert Belder "] +version = "0.0.2" +description = "Rust bindings to V8" +readme = "README.md" +authors = ["the Deno authors"] +license = "MIT" edition = "2018" +repository = "https://github.com/denoland/rusty_v8" +exclude = [ + ".cipd", + ".gclient_entries", + "v8", + "build", + "buildtools", + "tools/clang", + "third_party/jinja2", + "third_party/markupsafe", + "third_party/llvm-build", + ".landmines", +] [dependencies] lazy_static = "1.4.0" diff --git a/README.md b/README.md index ddaa4005..c1a658cd 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,9 @@ [![Build Status](https://github.com/denoland/rusty_v8/workflows/ci/badge.svg?branch=master)](https://github.com/denoland/rusty_v8/actions) +https://crates.io/crates/rusty_v8 + This is a project to replace libdeno with a full V8 binding. It's very much under construction and not usable. I'll update this message if it ever is. - Env vars used in build.rs: `SCCACHE`, `GCLIENT_SYNC` diff --git a/build b/build deleted file mode 120000 index 57ae3a6c..00000000 --- a/build +++ /dev/null @@ -1 +0,0 @@ -third_party/v8/build \ No newline at end of file diff --git a/build.rs b/build.rs index 4ff215f2..305d32b2 100644 --- a/build.rs +++ b/build.rs @@ -8,7 +8,7 @@ use which::which; fn main() { init_depot_tools(); - if !Path::new("third_party/v8/src").is_dir() + if !Path::new("v8/src").is_dir() || env::var_os("GCLIENT_SYNC").is_some() { gclient_sync(); @@ -29,12 +29,7 @@ fn main() { println!("cargo:warning=Not using sccache"); } - // gn_root needs to be an absolute path. - let gn_root = env::current_dir() - .unwrap() - .into_os_string() - .into_string() - .unwrap(); + let gn_root = env::var("CARGO_MANIFEST_DIR").unwrap(); let gn_out = cargo_gn::maybe_gen(&gn_root, gn_args); assert!(gn_out.exists()); @@ -98,7 +93,6 @@ fn gclient_sync() { let root = env::current_dir().unwrap(); let third_party = root.join("third_party"); let depot_tools = third_party.join("depot_tools"); - let gclient_file = third_party.join("gclient_config.py"); let gclient = depot_tools.join(if cfg!(windows) { "gclient.bat" @@ -115,11 +109,10 @@ fn gclient_sync() { println!("Running gclient sync to download V8. This could take a while."); let status = Command::new(gclient) - .current_dir(&third_party) + .current_dir(&root) .arg("sync") .arg("--no-history") .arg("--shallow") - .env("GCLIENT_FILE", gclient_file) .status() .expect("gclient sync failed"); assert!(status.success()); @@ -127,7 +120,6 @@ fn gclient_sync() { fn cc_wrapper(gn_args: &mut Vec, sccache_path: &Path) { gn_args.push(format!("cc_wrapper={:?}", sccache_path)); - // Disable treat_warnings_as_errors until this sccache bug is fixed: // https://github.com/mozilla/sccache/issues/264 if cfg!(target_os = "windows") { diff --git a/build_overrides b/build_overrides deleted file mode 120000 index 5d2fd546..00000000 --- a/build_overrides +++ /dev/null @@ -1 +0,0 @@ -third_party/v8/build_overrides/ \ No newline at end of file diff --git a/build_overrides/build.gni b/build_overrides/build.gni new file mode 100644 index 00000000..e2408684 --- /dev/null +++ b/build_overrides/build.gni @@ -0,0 +1 @@ +import("//v8/build_overrides/build.gni") diff --git a/build_overrides/gtest.gni b/build_overrides/gtest.gni new file mode 100644 index 00000000..b6aed316 --- /dev/null +++ b/build_overrides/gtest.gni @@ -0,0 +1 @@ +import("//v8/build_overrides/gtest.gni") diff --git a/buildtools b/buildtools deleted file mode 120000 index 5ae69d7f..00000000 --- a/buildtools +++ /dev/null @@ -1 +0,0 @@ -third_party/v8/buildtools/ \ No newline at end of file diff --git a/src/inspector/channel.cc b/src/inspector/channel.cc index 94c87662..39f936e0 100644 --- a/src/inspector/channel.cc +++ b/src/inspector/channel.cc @@ -1,4 +1,4 @@ -#include "third_party/v8/include/v8-inspector.h" +#include "v8/include/v8-inspector.h" #include "../support.h" using namespace v8_inspector; diff --git a/src/inspector/client.cc b/src/inspector/client.cc index 957b787f..26dfacb1 100644 --- a/src/inspector/client.cc +++ b/src/inspector/client.cc @@ -1,4 +1,4 @@ -#include "third_party/v8/include/v8-inspector.h" +#include "v8/include/v8-inspector.h" #include "../support.h" using namespace v8_inspector; diff --git a/src/isolate.cc b/src/isolate.cc index f4024618..0a7ba8a4 100644 --- a/src/isolate.cc +++ b/src/isolate.cc @@ -1,4 +1,4 @@ -#include "third_party/v8/include/v8.h" +#include "v8/include/v8.h" using namespace v8; diff --git a/src/locker.cc b/src/locker.cc index 8d39d804..20b70c65 100644 --- a/src/locker.cc +++ b/src/locker.cc @@ -1,5 +1,5 @@ #include "support.h" -#include "third_party/v8/include/v8.h" +#include "v8/include/v8.h" using namespace v8; using namespace support; diff --git a/src/platform/mod.cc b/src/platform/mod.cc index f820ff93..614c4eba 100644 --- a/src/platform/mod.cc +++ b/src/platform/mod.cc @@ -1,6 +1,6 @@ #include "../support.h" -#include "third_party/v8/include/libplatform/libplatform.h" -#include "third_party/v8/include/v8-platform.h" +#include "v8/include/libplatform/libplatform.h" +#include "v8/include/v8-platform.h" #include diff --git a/src/platform/task.cc b/src/platform/task.cc index e7084bff..841dfc56 100644 --- a/src/platform/task.cc +++ b/src/platform/task.cc @@ -1,5 +1,5 @@ #include "../support.h" -#include "third_party/v8/include/v8-platform.h" +#include "v8/include/v8-platform.h" using namespace v8; using namespace support; diff --git a/src/string_buffer.cc b/src/string_buffer.cc index 3f772a7e..03b1f56e 100644 --- a/src/string_buffer.cc +++ b/src/string_buffer.cc @@ -1,4 +1,4 @@ -#include "third_party/v8/include/v8-inspector.h" +#include "v8/include/v8-inspector.h" #include "support.h" using namespace v8_inspector; diff --git a/src/v8.cc b/src/v8.cc index a8c42e0f..de161561 100644 --- a/src/v8.cc +++ b/src/v8.cc @@ -1,4 +1,4 @@ -#include "third_party/v8/include/v8.h" +#include "v8/include/v8.h" using namespace v8; diff --git a/testing b/testing deleted file mode 120000 index ee588681..00000000 --- a/testing +++ /dev/null @@ -1 +0,0 @@ -third_party/v8/testing \ No newline at end of file diff --git a/third_party/gclient_config.py b/third_party/gclient_config.py deleted file mode 100644 index d6173ea9..00000000 --- a/third_party/gclient_config.py +++ /dev/null @@ -1,25 +0,0 @@ -solutions = [ - { - 'url': 'https://chromium.googlesource.com/v8/v8.git@7.9.317.12', - '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, - 'v8/tools/swarming_client': None, - 'v8/tools/gyp': None, - 'v8/third_party/instrumented_libraries': None, - 'v8/third_party/android_tools': None, - # 'v8/third_party/depot_tools': None, - 'v8/test/wasm-js': None, - 'v8/test/benchmarks/data': None, - 'v8/test/mozilla/data': None, - 'v8/third_party/icu': None, - 'v8/test/test262/data': None, - 'v8/test/test262/harness': None, - 'v8/tools/luci-go': None - } - } -] diff --git a/third_party/googletest b/third_party/googletest deleted file mode 120000 index 9603b859..00000000 --- a/third_party/googletest +++ /dev/null @@ -1 +0,0 @@ -v8/third_party/googletest/ \ No newline at end of file diff --git a/third_party/jinja2 b/third_party/jinja2 deleted file mode 120000 index 678f5812..00000000 --- a/third_party/jinja2 +++ /dev/null @@ -1 +0,0 @@ -v8/third_party/jinja2/ \ No newline at end of file diff --git a/third_party/llvm-build b/third_party/llvm-build deleted file mode 120000 index 5b189e3b..00000000 --- a/third_party/llvm-build +++ /dev/null @@ -1 +0,0 @@ -v8/third_party/llvm-build/ \ No newline at end of file diff --git a/third_party/markupsafe b/third_party/markupsafe deleted file mode 120000 index e4779e12..00000000 --- a/third_party/markupsafe +++ /dev/null @@ -1 +0,0 @@ -v8/third_party/markupsafe/ \ No newline at end of file diff --git a/tools/clang b/tools/clang deleted file mode 120000 index 8747c8bd..00000000 --- a/tools/clang +++ /dev/null @@ -1 +0,0 @@ -../third_party/v8/tools/clang/ \ No newline at end of file diff --git a/tools/gclient_config.py b/tools/gclient_config.py deleted file mode 100644 index d6173ea9..00000000 --- a/tools/gclient_config.py +++ /dev/null @@ -1,25 +0,0 @@ -solutions = [ - { - 'url': 'https://chromium.googlesource.com/v8/v8.git@7.9.317.12', - '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, - 'v8/tools/swarming_client': None, - 'v8/tools/gyp': None, - 'v8/third_party/instrumented_libraries': None, - 'v8/third_party/android_tools': None, - # 'v8/third_party/depot_tools': None, - 'v8/test/wasm-js': None, - 'v8/test/benchmarks/data': None, - 'v8/test/mozilla/data': None, - 'v8/third_party/icu': None, - 'v8/test/test262/data': None, - 'v8/test/test262/harness': None, - 'v8/tools/luci-go': None - } - } -]