0
0
Fork 0
mirror of https://github.com/denoland/rusty_v8.git synced 2024-11-21 15:04:33 -05:00

Refactor build / enable 'cargo package' (#15)

This commit is contained in:
Ry Dahl 2019-11-19 17:48:50 -05:00 committed by GitHub
parent 7df96332ad
commit 3fa1cbcc5e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
30 changed files with 241 additions and 105 deletions

183
.gclient Normal file
View file

@ -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'],
},
]

8
.gitattributes vendored
View file

@ -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

13
.gitignore vendored
View file

@ -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

11
.gn
View file

@ -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

View file

@ -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) {

2
Cargo.lock generated
View file

@ -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)",

View file

@ -1,8 +1,24 @@
[package]
name = "rusty_v8"
version = "0.0.1"
authors = ["Bert Belder <bertbelder@gmail.com>"]
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"

View file

@ -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`

1
build
View file

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

View file

@ -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<String>, 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") {

View file

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

View file

@ -0,0 +1 @@
import("//v8/build_overrides/build.gni")

View file

@ -0,0 +1 @@
import("//v8/build_overrides/gtest.gni")

View file

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

View file

@ -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;

View file

@ -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;

View file

@ -1,4 +1,4 @@
#include "third_party/v8/include/v8.h"
#include "v8/include/v8.h"
using namespace v8;

View file

@ -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;

View file

@ -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 <iostream>

View file

@ -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;

View file

@ -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;

View file

@ -1,4 +1,4 @@
#include "third_party/v8/include/v8.h"
#include "v8/include/v8.h"
using namespace v8;

View file

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

View file

@ -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
}
}
]

View file

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

1
third_party/jinja2 vendored
View file

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

View file

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

View file

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

View file

@ -1 +0,0 @@
../third_party/v8/tools/clang/

View file

@ -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
}
}
]