Skip to content

Commit

Permalink
libredirect: Add missing phase hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
nh2 authored and bachp committed Sep 3, 2021
1 parent bb1058f commit 5ca0265
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkgs/build-support/libredirect/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ stdenv.mkDerivation rec {
outputs = ["out" "hook"];

buildPhase = ''
runHook preBuild
$CC -Wall -std=c99 -O3 -fPIC -ldl -shared \
${lib.optionalString stdenv.isDarwin "-Wl,-install_name,$out/lib/$libName"} \
-o "$libName" \
Expand All @@ -22,9 +24,13 @@ stdenv.mkDerivation rec {
if [ -n "$doInstallCheck" ]; then
$CC -Wall -std=c99 -O3 test.c -o test
fi
runHook postBuild
'';

installPhase = ''
runHook preInstall
install -vD "$libName" "$out/lib/$libName"
mkdir -p "$hook/nix-support"
Expand All @@ -36,6 +42,8 @@ stdenv.mkDerivation rec {
export LD_PRELOAD="$out/lib/$libName"
''}
SETUP_HOOK
runHook postInstall
'';

doInstallCheck = true;
Expand Down

0 comments on commit 5ca0265

Please sign in to comment.