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