libredirect: set install_name on Darwin

fixes https://github.com/NixOS/nixpkgs/pull/50246#issuecomment-437975038
This commit is contained in:
zimbatm 2018-11-13 15:56:46 +01:00
parent 91c130e2f5
commit d04a1265a1
No known key found for this signature in database
GPG key ID: 71BAF6D40C1D63D7

View file

@ -1,4 +1,4 @@
{ stdenv, coreutils }: { stdenv, lib, coreutils }:
stdenv.mkDerivation { stdenv.mkDerivation {
name = "libredirect-0"; name = "libredirect-0";
@ -13,8 +13,10 @@ stdenv.mkDerivation {
outputs = ["out" "hook"]; outputs = ["out" "hook"];
buildPhase = '' buildPhase = ''
$CC -Wall -std=c99 -O3 -shared libredirect.c \ $CC -Wall -std=c99 -O3 -fPIC -ldl -shared \
-o "$libName" -fPIC -ldl ${lib.optionalString stdenv.isDarwin "-Wl,-install_name,$out/lib/$libName"} \
-o "$libName" \
libredirect.c
if [ -n "$doInstallCheck" ]; then if [ -n "$doInstallCheck" ]; then
$CC -Wall -std=c99 -O3 test.c -o test $CC -Wall -std=c99 -O3 test.c -o test