libredirect: fix build for aarch64-darwin (PR #156460)

This commit is contained in:
Jonathan Ringer 2022-01-24 03:20:51 -08:00 committed by GitHub
parent fde0b2e2f2
commit 4bde5a3a68
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -44,7 +44,7 @@ else stdenv.mkDerivation rec {
-isystem ${llvmPackages_13.clang.libc}/include \
-isystem ${llvmPackages_13.libclang.lib}/lib/clang/*/include \
-L${llvmPackages_13.clang.libc}/lib \
-Wl,-install_name,$out/lib/$libName \
-Wl,-install_name,$libName \
-Wall -std=c99 -O3 -fPIC libredirect.c \
-ldl -shared -o "$libName"
'' else if stdenv.isDarwin then ''
@ -73,6 +73,12 @@ else stdenv.mkDerivation rec {
install -vD "$libName" "$out/lib/$libName"
'' + lib.optionalString (stdenv.isDarwin && stdenv.isAarch64) ''
# dylib will be rejected unless dylib rpath gets explictly set
install_name_tool \
-change $libName $out/lib/$libName \
$out/lib/$libName
'' + ''
# Provide a setup hook that injects our library into every process.
mkdir -p "$hook/nix-support"
cat <<SETUP_HOOK > "$hook/nix-support/setup-hook"