diff --git a/build.rs b/build.rs index 658bf89..8347d05 100644 --- a/build.rs +++ b/build.rs @@ -156,12 +156,28 @@ fn static_lbug_file_name() -> &'static str { } fn prebuilt_cache_key() -> String { + // Linux ships more than one static build per release, and the download + // script picks one with LBUG_LINUX_VARIANT. Keep them in separate cache + // directories, otherwise switching the variant reuses whichever archive + // was downloaded first. + let variant_suffix = if cfg!(target_os = "linux") { + // Same default as download-liblbug.sh, which also treats an empty + // value as unset. + let variant = env::var("LBUG_LINUX_VARIANT") + .ok() + .filter(|v| !v.is_empty()) + .unwrap_or_else(|| "compat".to_string()); + format!("-{variant}") + } else { + String::new() + }; + let source = if let Ok(run_id) = env::var("LBUG_PRECOMPILED_RUN_ID") { - format!("run-{run_id}") + format!("run-{run_id}{variant_suffix}") } else if let Ok(version) = env::var("LBUG_VERSION") { - format!("version-{version}") + format!("version-{version}{variant_suffix}") } else { - "latest".to_string() + format!("latest{variant_suffix}") }; source