1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-09-11 15:08:33 +01:00

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.
This commit is contained in:
Michael Weiss 2019-02-03 17:52:53 +01:00
parent 4bff986b92
commit bda21694d1
No known key found for this signature in database
GPG key ID: 5BE487C4D4771D83

View file

@ -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
'';