Merge pull request #280807 from suhr/fix-pharo

pharo: fix non-path argv[0] segfault
This commit is contained in:
Guillaume Girol 2024-01-14 10:38:21 +01:00 committed by GitHub
commit adad0b0a22
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -54,29 +54,28 @@ stdenv.mkDerivation (finalAttrs: {
"-DBUILD_BUNDLE=OFF"
];
installPhase =
let
library_path = lib.strings.makeLibraryPath [
"$out"
cairo
freetype
libgit2
SDL2
];
in
''
runHook preInstall
installPhase = ''
runHook preInstall
cmake --build . --target=install
mkdir -p "$out/lib"
mkdir "$out/bin"
cp build/vm/*.so* "$out/lib/"
cp build/vm/pharo "$out/bin/pharo"
patchelf --allowed-rpath-prefixes "$NIX_STORE" --shrink-rpath "$out/bin/pharo"
wrapProgram "$out/bin/pharo" --set LD_LIBRARY_PATH "${library_path}"
cmake --build . --target=install
mkdir -p "$out/lib"
mkdir "$out/bin"
cp build/vm/*.so* "$out/lib/"
cp build/vm/pharo "$out/bin/pharo"
runHook postInstall
'';
runHook postInstall
'';
preFixup = let
libPath = lib.makeLibraryPath (finalAttrs.buildInputs ++ [
stdenv.cc.cc.lib
"$out"
]);
in ''
patchelf --allowed-rpath-prefixes "$NIX_STORE" --shrink-rpath "$out/bin/pharo"
ln -s "${libgit2}/lib/libgit2.so" $out/lib/libgit2.so.1.1
wrapProgram "$out/bin/pharo" --argv0 $out/bin/pharo --prefix LD_LIBRARY_PATH ":" "${libPath}"
'';
meta = {
description = "Clean and innovative Smalltalk-inspired environment";