From 743ae5d20c55b4f84cede9a2be57a72ad30263ea Mon Sep 17 00:00:00 2001 From: qbisi Date: Fri, 12 Sep 2025 06:39:20 +0800 Subject: [PATCH] pypy: fix installPhase --- .../interpreters/python/pypy/default.nix | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/pkgs/development/interpreters/python/pypy/default.nix b/pkgs/development/interpreters/python/pypy/default.nix index 5f4f0d537e0a..d7da3fe94a14 100644 --- a/pkgs/development/interpreters/python/pypy/default.nix +++ b/pkgs/development/interpreters/python/pypy/default.nix @@ -7,6 +7,7 @@ zlib, bzip2, pkg-config, + lndir, libffi, sqlite, openssl, @@ -80,7 +81,10 @@ stdenv.mkDerivation rec { inherit hash; }; - nativeBuildInputs = [ pkg-config ]; + nativeBuildInputs = [ + pkg-config + lndir + ]; buildInputs = [ bzip2 openssl @@ -185,16 +189,17 @@ stdenv.mkDerivation rec { installPhase = '' runHook preInstall - mkdir -p $out/{bin,include,lib,${executable}-c} + mkdir -p $out/{bin,lib/${libPrefix}} - cp -R {include,lib_pypy,lib-python,${executable}-c} $out/${executable}-c - cp lib${executable}-c${stdenv.hostPlatform.extensions.sharedLibrary} $out/lib/ - ln -s $out/${executable}-c/${executable}-c $out/bin/${executable} + cp -R {include,lib_pypy,lib-python} $out + install -Dm755 lib${executable}-c${stdenv.hostPlatform.extensions.sharedLibrary} $out/lib/ + install -Dm755 ${executable}-c $out/bin/${executable} ${lib.optionalString isPy39OrNewer "ln -s $out/bin/${executable} $out/bin/pypy3"} # other packages expect to find stuff according to libPrefix - ln -s $out/${executable}-c/include $out/include/${libPrefix} - ln -s $out/${executable}-c/lib-python/${if isPy3k then "3" else pythonVersion} $out/lib/${libPrefix} + ln -s $out/include $out/include/${libPrefix} + lndir $out/lib-python/${if isPy3k then "3" else pythonVersion} $out/lib/${libPrefix} + lndir $out/lib_pypy $out/lib/${libPrefix} # Include a sitecustomize.py file cp ${../sitecustomize.py} $out/${ @@ -208,11 +213,6 @@ stdenv.mkDerivation rec { lib.optionalString (stdenv.hostPlatform.isDarwin) '' install_name_tool -change @rpath/lib${executable}-c.dylib $out/lib/lib${executable}-c.dylib $out/bin/${executable} '' - + lib.optionalString (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) '' - mkdir -p $out/${executable}-c/pypy/bin - mv $out/bin/${executable} $out/${executable}-c/pypy/bin/${executable} - ln -s $out/${executable}-c/pypy/bin/${executable} $out/bin/${executable} - '' # _testcapi is compiled dynamically, into the store. # This would fail if we don't do it here. + lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''