Some checks failed
Test / test (push) Has been cancelled
Apple Silicon Homebrew uses /opt/homebrew as prefix, so hardcoding /usr/local/lib/ahfail/ahfail-display as DEFAULT_PATH breaks there. build.rs now falls back to /usr/local/lib on macOS and /usr/lib on Linux when AHFAIL_LIBDIR is not set; macOS uses the same concat!(env!(...)) approach as Linux. install-macos.sh passes -Dlibdir so the baked-in path matches INSTALL_DIR. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
12 lines
647 B
Rust
12 lines
647 B
Rust
fn main() {
|
|
println!("cargo:rustc-link-lib=pam");
|
|
|
|
// Emit AHFAIL_INSTALL_DIR so DEFAULT_PATH in lib.rs is correct on multiarch Linux
|
|
// (e.g. /usr/lib/x86_64-linux-gnu) and on Apple Silicon macOS (/opt/homebrew/lib).
|
|
// Meson passes AHFAIL_LIBDIR=<libdir> when building; fall back per platform otherwise.
|
|
let target_os = std::env::var("CARGO_CFG_TARGET_OS").unwrap_or_default();
|
|
let fallback = if target_os == "macos" { "/usr/local/lib" } else { "/usr/lib" };
|
|
let libdir = std::env::var("AHFAIL_LIBDIR").unwrap_or_else(|_| fallback.to_string());
|
|
println!("cargo:rustc-env=AHFAIL_INSTALL_DIR={}/ahfail", libdir);
|
|
}
|