From 1cd946c71e3950201545dc594f4e8e3dc583399e Mon Sep 17 00:00:00 2001 From: TheJanzap <16736682+TheJanzap@users.noreply.github.com> Date: Wed, 25 Mar 2026 22:38:35 +0100 Subject: [PATCH 1/5] build: Notify when no pre-built archive is available for the target --- build.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/build.rs b/build.rs index 512c6ee828..636b8044ae 100644 --- a/build.rs +++ b/build.rs @@ -569,6 +569,11 @@ fn static_lib_url() -> String { let target = env::var("TARGET").unwrap(); let profile = prebuilt_profile(); let features = prebuilt_features_suffix(); + + if base == default_base && !is_target_prebuilt(&target) { + panic!("The target {target} is not a first class target and no pre-built archive is provided. Compile v8 from source with V8_FROM_SOURCE=1") + } + format!( "{base}/v{version}/{}.gz", static_lib_name(&format!("{features}_{profile}_{target}")), @@ -610,6 +615,20 @@ fn build_dir() -> PathBuf { .to_path_buf() } +/// Checks if the target is available as a pre-built archive from the rusty_v8 GitLab. +/// Should only be called when `RUSTY_V8_MIRROR` is unset. +fn is_target_prebuilt(target: &str) -> bool { + const PREBUILT_TARGETS: [&str; 6] = [ + "aarch64-apple-darwin", + "aarch64-pc-windows-msvc", + "aarch64-unknown-linux", + "x86_64-apple-darwin", + "x86_64-pc-windows-msvc", + "x86_64-unknown-linux-gnu" + ]; + PREBUILT_TARGETS.contains(&target) +} + fn replace_non_alphanumeric(url: &str) -> String { url .chars() From 0cad4541179535052f25a36a461b388cf147f765 Mon Sep 17 00:00:00 2001 From: TheJanzap <16736682+TheJanzap@users.noreply.github.com> Date: Wed, 25 Mar 2026 22:51:02 +0100 Subject: [PATCH 2/5] chore: Run rustfmt --- build.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/build.rs b/build.rs index 636b8044ae..86a9747f0d 100644 --- a/build.rs +++ b/build.rs @@ -571,7 +571,9 @@ fn static_lib_url() -> String { let features = prebuilt_features_suffix(); if base == default_base && !is_target_prebuilt(&target) { - panic!("The target {target} is not a first class target and no pre-built archive is provided. Compile v8 from source with V8_FROM_SOURCE=1") + panic!( + "The target {target} is not a first class target and no pre-built archive is provided. Compile v8 from source with V8_FROM_SOURCE=1" + ) } format!( @@ -624,7 +626,7 @@ fn is_target_prebuilt(target: &str) -> bool { "aarch64-unknown-linux", "x86_64-apple-darwin", "x86_64-pc-windows-msvc", - "x86_64-unknown-linux-gnu" + "x86_64-unknown-linux-gnu", ]; PREBUILT_TARGETS.contains(&target) } From 7871b806b71c9eda0167c637b0f79a6982eb8ffd Mon Sep 17 00:00:00 2001 From: TheJanzap <16736682+TheJanzap@users.noreply.github.com> Date: Thu, 26 Mar 2026 07:13:34 +0100 Subject: [PATCH 3/5] chore: Fix comment --- build.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.rs b/build.rs index 86a9747f0d..72c6c14038 100644 --- a/build.rs +++ b/build.rs @@ -617,7 +617,7 @@ fn build_dir() -> PathBuf { .to_path_buf() } -/// Checks if the target is available as a pre-built archive from the rusty_v8 GitLab. +/// Checks if the target is available as a pre-built archive from the rusty_v8 GitHub. /// Should only be called when `RUSTY_V8_MIRROR` is unset. fn is_target_prebuilt(target: &str) -> bool { const PREBUILT_TARGETS: [&str; 6] = [ From d8dd6edfe98949e74678a7f7409e6eff0d357abf Mon Sep 17 00:00:00 2001 From: TheJanzap <16736682+TheJanzap@users.noreply.github.com> Date: Thu, 26 Mar 2026 08:06:48 +0100 Subject: [PATCH 4/5] chore: Rusfmt again --- build.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.rs b/build.rs index 72c6c14038..5542c2b7fe 100644 --- a/build.rs +++ b/build.rs @@ -617,7 +617,7 @@ fn build_dir() -> PathBuf { .to_path_buf() } -/// Checks if the target is available as a pre-built archive from the rusty_v8 GitHub. +/// Checks if the target is available as a pre-built archive from the rusty_v8 GitHub. /// Should only be called when `RUSTY_V8_MIRROR` is unset. fn is_target_prebuilt(target: &str) -> bool { const PREBUILT_TARGETS: [&str; 6] = [ From 8da857db82e9ce83ca2c948ba86ffd494118dfd1 Mon Sep 17 00:00:00 2001 From: TheJanzap <16736682+TheJanzap@users.noreply.github.com> Date: Thu, 26 Mar 2026 21:47:06 +0100 Subject: [PATCH 5/5] fix: Improve issues mentioned in review --- build.rs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/build.rs b/build.rs index 5542c2b7fe..93d3a53907 100644 --- a/build.rs +++ b/build.rs @@ -570,9 +570,11 @@ fn static_lib_url() -> String { let profile = prebuilt_profile(); let features = prebuilt_features_suffix(); - if base == default_base && !is_target_prebuilt(&target) { + if env::var("RUSTY_V8_MIRROR").is_err() + && !is_target_prebuilt(&target, profile) + { panic!( - "The target {target} is not a first class target and no pre-built archive is provided. Compile v8 from source with V8_FROM_SOURCE=1" + "The target '{target}' is not a first class target and no pre-built archive is provided. Compile v8 from source with V8_FROM_SOURCE=1" ) } @@ -619,15 +621,21 @@ fn build_dir() -> PathBuf { /// Checks if the target is available as a pre-built archive from the rusty_v8 GitHub. /// Should only be called when `RUSTY_V8_MIRROR` is unset. -fn is_target_prebuilt(target: &str) -> bool { +fn is_target_prebuilt(target: &str, profile: &str) -> bool { const PREBUILT_TARGETS: [&str; 6] = [ "aarch64-apple-darwin", "aarch64-pc-windows-msvc", - "aarch64-unknown-linux", + "aarch64-unknown-linux-gnu", "x86_64-apple-darwin", "x86_64-pc-windows-msvc", "x86_64-unknown-linux-gnu", ]; + + // No pre-built archives for Windows on debug builds. + if target.contains("windows") && profile != "release" { + return false; + } + PREBUILT_TARGETS.contains(&target) }