From bda21694d1a8acd8ac06ec8f4ce3830051b42378 Mon Sep 17 00:00:00 2001 From: Michael Weiss Date: Sun, 3 Feb 2019 17:52:53 +0100 Subject: [PATCH] wlroots: Fix the ELF binaries (rootston + examples) Due to stdenv changes the binaries where broken during the fixup phase (while stripping all binaries). The current solution isn't optimal but there must not be any cyclic dependencies on $out. --- .../development/libraries/wlroots/default.nix | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/pkgs/development/libraries/wlroots/default.nix b/pkgs/development/libraries/wlroots/default.nix index d25f1d0b4c8..6e7090a9c5b 100644 --- a/pkgs/development/libraries/wlroots/default.nix +++ b/pkgs/development/libraries/wlroots/default.nix @@ -40,14 +40,21 @@ in stdenv.mkDerivation rec { ''; postInstall = '' - # Install rootston (the reference compositor) to $bin and $examples + # Copy the library to $bin and $examples + for output in "$bin" "$examples"; do + mkdir -p $output/lib + cp -P libwlroots* $output/lib/ + done + ''; + + postFixup = '' + # Install rootston (the reference compositor) to $bin and $examples (this + # has to be done after the fixup phase to prevent broken binaries): for output in "$bin" "$examples"; do mkdir -p $output/bin cp rootston/rootston $output/bin/ - mkdir $output/lib - cp libwlroots* $output/lib/ patchelf \ - --set-rpath "$output/lib:${stdenv.lib.makeLibraryPath buildInputs}" \ + --set-rpath "$(patchelf --print-rpath $output/bin/rootston | sed s,$out,$output,g)" \ $output/bin/rootston mkdir $output/etc cp ../rootston/rootston.ini.example $output/etc/rootston.ini @@ -59,10 +66,10 @@ in stdenv.mkDerivation rec { mkdir -p $examples/bin cd ./examples for binary in $(find . -executable -type f -printf '%P\n' | grep -vE '\.so'); do - patchelf \ - --set-rpath "$examples/lib:${stdenv.lib.makeLibraryPath buildInputs}" \ - "$binary" cp "$binary" "$examples/bin/wlroots-$binary" + patchelf \ + --set-rpath "$(patchelf --print-rpath $output/bin/rootston | sed s,$out,$examples,g)" \ + "$examples/bin/wlroots-$binary" done '';