From 05b41b8b84e218d04cacd421f0395e91e582f879 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20=C3=81vila=20de=20Esp=C3=ADndola?= Date: Mon, 25 Oct 2021 13:35:19 -0700 Subject: [PATCH] Add support for a RUSTY_V8_ARCHIVE environment variable (#812) --- README.md | 10 ++++++++++ build.rs | 3 +++ 2 files changed, 13 insertions(+) diff --git a/README.md b/README.md index 88053c31..b1409290 100644 --- a/README.md +++ b/README.md @@ -82,6 +82,16 @@ for REL in v0.13.0 v0.12.0; do done ``` +## The `RUSTY_V8_ARCHIVE` environment variable + +Tell the build script to use a specific v8 library. This can be an URL +or a path. This is useful when you have a prebuilt archive somewhere: + +```bash +export RUSTY_V8_ARCHIVE=/path/to/custom_archive.a +cargo build +``` + ## Build V8 from Source Use `V8_FROM_SOURCE=1 cargo build -vv` to build the crate completely from diff --git a/build.rs b/build.rs index 9b2d04ff..56daa0e4 100644 --- a/build.rs +++ b/build.rs @@ -201,6 +201,9 @@ fn download_ninja_gn_binaries() { } fn static_lib_url() -> String { + if let Ok(custom_archive) = env::var("RUSTY_V8_ARCHIVE") { + return custom_archive; + } let default_base = "https://github.com/denoland/rusty_v8/releases/download"; let base = env::var("RUSTY_V8_MIRROR").unwrap_or_else(|_| default_base.into());