fix: use build-time AHFAIL_INSTALL_DIR on macOS, not hardcoded /usr/local/lib
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>
This commit is contained in:
Asger Geel Weirsøe
2026-05-06 15:24:34 +02:00
parent f951cb9c6d
commit b8a03d72bb
3 changed files with 12 additions and 12 deletions

View File

@@ -20,12 +20,9 @@ pub const PAM_DATA_REPLACE: c_int = 0x00000002;
#[cfg(not(any(target_os = "linux", target_os = "macos")))]
pub const PAM_DATA_REPLACE: c_int = 0x20000000u32 as i32;
// Default install path for ahfail-display.
// On Linux: built from AHFAIL_INSTALL_DIR emitted by build.rs, which reads AHFAIL_LIBDIR
// passed by Meson — correct on multiarch systems (e.g. /usr/lib/x86_64-linux-gnu/ahfail).
#[cfg(target_os = "macos")]
const DEFAULT_PATH: &str = "/usr/local/lib/ahfail/ahfail-display";
#[cfg(not(target_os = "macos"))]
// Default install path for ahfail-display — baked in at build time via AHFAIL_INSTALL_DIR,
// which build.rs derives from AHFAIL_LIBDIR (passed by Meson or the install script).
// This is correct on multiarch Linux and on both Intel and Apple Silicon macOS.
const DEFAULT_PATH: &str = concat!(env!("AHFAIL_INSTALL_DIR"), "/ahfail-display");
pub fn default_display_path() -> &'static str { DEFAULT_PATH }