mirror of
https://github.com/denoland/rusty_v8.git
synced 2025-01-21 21:50:20 -05:00
Default to linking against release v8 builds (#783)
Unless $V8_FORCE_DEBUG=true to speedup CI for main deno repo
This commit is contained in:
parent
b6537573c4
commit
0bd141c78d
2 changed files with 23 additions and 6 deletions
|
@ -42,6 +42,13 @@ from github to get the static lib. To disable this build using the
|
||||||
When making changes to rusty_v8 itself, it should be tested by build from
|
When making changes to rusty_v8 itself, it should be tested by build from
|
||||||
source. The CI always builds from source.
|
source. The CI always builds from source.
|
||||||
|
|
||||||
|
## The `V8_FORCE_DEBUG` environment variable
|
||||||
|
|
||||||
|
By default `rusty_v8` will link against release builds of `v8`, if you want to
|
||||||
|
use a debug build of `v8` set `V8_FORCE_DEBUG=true`.
|
||||||
|
|
||||||
|
We default to release builds of `v8` due to performance & CI reasons in `deno`.
|
||||||
|
|
||||||
## The `RUSTY_V8_MIRROR` environment variable
|
## The `RUSTY_V8_MIRROR` environment variable
|
||||||
|
|
||||||
Tells the build script where to get binary builds from. Understands
|
Tells the build script where to get binary builds from. Understands
|
||||||
|
|
22
build.rs
22
build.rs
|
@ -206,14 +206,24 @@ fn static_lib_url() -> String {
|
||||||
env::var("RUSTY_V8_MIRROR").unwrap_or_else(|_| default_base.into());
|
env::var("RUSTY_V8_MIRROR").unwrap_or_else(|_| default_base.into());
|
||||||
let version = env::var("CARGO_PKG_VERSION").unwrap();
|
let version = env::var("CARGO_PKG_VERSION").unwrap();
|
||||||
let target = env::var("TARGET").unwrap();
|
let target = env::var("TARGET").unwrap();
|
||||||
|
|
||||||
|
// Note: we always use the release build on windows.
|
||||||
if cfg!(target_os = "windows") {
|
if cfg!(target_os = "windows") {
|
||||||
// Note: we always use the release build on windows.
|
return format!("{}/v{}/rusty_v8_release_{}.lib", base, version, target);
|
||||||
format!("{}/v{}/rusty_v8_release_{}.lib", base, version, target)
|
|
||||||
} else {
|
|
||||||
let profile = env::var("PROFILE").unwrap();
|
|
||||||
assert!(profile == "release" || profile == "debug");
|
|
||||||
format!("{}/v{}/librusty_v8_{}_{}.a", base, version, profile, target)
|
|
||||||
}
|
}
|
||||||
|
// Use v8 in release mode unless $V8_FORCE_DEBUG=true
|
||||||
|
let profile = match env_bool("V8_FORCE_DEBUG") {
|
||||||
|
true => "debug",
|
||||||
|
_ => "release",
|
||||||
|
};
|
||||||
|
format!("{}/v{}/librusty_v8_{}_{}.a", base, version, profile, target)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn env_bool(key: &str) -> bool {
|
||||||
|
matches!(
|
||||||
|
env::var(key).unwrap_or_default().as_str(),
|
||||||
|
"true" | "1" | "yes"
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn static_lib_name() -> &'static str {
|
fn static_lib_name() -> &'static str {
|
||||||
|
|
Loading…
Add table
Reference in a new issue