mirror of
https://github.com/storytold/effectcraft.git
synced 2026-10-30 04:57:54 -06:00
xtask: a pkg-config that will not launch is not 'ALSA missing'
The probe's spawn failure (a PKG_CONFIG that names nothing runnable, or pkg-config absent from PATH) reported the ALSA-missing hint, sending the reader off to install alsa-lib they may well have: a failed launch now reports itself, naming the executable and pointing at installing pkg-config or correcting PKG_CONFIG, while a probe that runs and exits non-zero still gets the ALSA guidance.
This commit is contained in:
+8
-2
@@ -432,11 +432,17 @@ fn audio_backend_hint(found: bool) -> Result<(), String> {
|
||||
/// present. Checking here turns a late, confusing link error into one line naming the package.
|
||||
/// The probe reads `PKG_CONFIG` first, like the pkg-config crate alsa-sys goes through: the
|
||||
/// variable may name a working pkg-config that is not on `PATH`, and the build would use it too.
|
||||
/// A probe that could not launch is not "ALSA missing" — it reports the launch failure separately.
|
||||
#[cfg(target_os = "linux")]
|
||||
fn audio_backend() -> Result<(), String> {
|
||||
let program = std::env::var_os("PKG_CONFIG").unwrap_or_else(|| "pkg-config".into());
|
||||
let found = Command::new(program).args(["--exists", "alsa"]).status().map(|s| s.success()).unwrap_or(false);
|
||||
audio_backend_hint(found)
|
||||
match Command::new(&program).args(["--exists", "alsa"]).status() {
|
||||
Ok(status) => audio_backend_hint(status.success()),
|
||||
Err(e) => Err(format!(
|
||||
"The {} executable could not be run: {e}. Install pkg-config, or point PKG_CONFIG at a working one — it is the same executable alsa-sys's pkg-config dependency asks.",
|
||||
std::path::Path::new(&program).display()
|
||||
)),
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(target_os = "linux"))]
|
||||
|
||||
Reference in New Issue
Block a user