Skip to content

Instantly share code, notes, and snippets.

@ry
Created October 31, 2018 18:46
Show Gist options
  • Save ry/413fab741d1b858583261908380febdb to your computer and use it in GitHub Desktop.
Save ry/413fab741d1b858583261908380febdb to your computer and use it in GitHub Desktop.
From fc1f726c8be5b94818213789ef84cb04974563d8 Mon Sep 17 00:00:00 2001
From: Ryan Dahl <ry@tinyclouds.org>
Date: Wed, 31 Oct 2018 14:43:10 -0400
Subject: [PATCH] Support cargo build on OSX/Linux
---
.gn | 4 ++++
.travis.yml | 3 ++-
BUILD.gn | 21 ++++++++++++++-------
3 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/.gn b/.gn
index 94ff452a..454290ac 100644
--- a/.gn
+++ b/.gn
@@ -30,6 +30,10 @@ default_args = {
# for now. See http://clang.llvm.org/docs/ControlFlowIntegrity.html
is_cfi = false
+ # To link properly with Cargo built objects, we need to build libc++ and
+ # include it in deno_deps.
+ use_custom_libcxx = true
+
is_component_build = false
symbol_level = 1
treat_warnings_as_errors = true
diff --git a/.travis.yml b/.travis.yml
index 5d494adc..73efea04 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -12,7 +12,7 @@ env:
- RUSTUP_HOME=$HOME/.rustup/
- RUST_BACKTRACE=1
- HOMEBREW_PATH=$HOME/homebrew/
- - DENO_BUILD_ARGS="use_custom_libcxx=false use_sysroot=false"
+ - DENO_BUILD_ARGS="use_sysroot=false"
- DENO_BUILD_PATH=$HOME/out/Default
- CARGO_TARGET_DIR=$DENO_BUILD_PATH
- DENO_BUILD_MODE=release
@@ -92,6 +92,7 @@ script:
- bash -c "sleep 2100; pkill ninja; pkill cargo" &
- ./tools/build.py -j2
- RUSTC_WRAPPER=sccache cargo check -j2 --release
+- RUSTC_WRAPPER=sccache cargo build -j2 --release
- ./tools/test.py $DENO_BUILD_PATH
after_script:
- ccache --show-stats
diff --git a/BUILD.gn b/BUILD.gn
index cc985077..57f28ca3 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -202,6 +202,13 @@ v8_executable("test_cc") {
configs = [ ":deno_config" ]
}
+v8_deps = [
+ "third_party/v8:v8",
+ "third_party/v8:v8_libbase",
+ "third_party/v8:v8_libplatform",
+ "third_party/v8:v8_libsampler",
+]
+
# 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
@@ -215,19 +222,19 @@ static_library("libdeno") {
"libdeno/file_util.h",
"libdeno/internal.h",
]
- public_deps = [
- "third_party/v8:v8_monolith",
- ]
+ public_deps = v8_deps
configs += [ ":deno_config" ]
}
static_library("deno_deps") {
complete_static_lib = true
public_deps = [
- ":libdeno",
- ":msg_rs",
- ":snapshot",
- ]
+ ":libdeno",
+ ":msg_rs",
+ ":snapshot",
+ "//build/win:default_exe_manifest",
+ "//buildtools/third_party/libc++:libc++",
+ ] + v8_deps
configs += [ ":deno_config" ]
}
--
2.15.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment