From 0b961bd05d74b565cbd418c6ad8fb76e407693cc Mon Sep 17 00:00:00 2001 From: Carlo Cabrera Date: Fri, 22 Nov 2024 14:39:21 +0800 Subject: [PATCH] ghostscript: fix install names on Darwin Fixes #355377. This should avoid the need to mess around with `install_name_tool` entirely. This mirrors what is done by Homebrew[^1] and MacPorts[^2]. This should also make the changes in #355853 and #357951 unnecessary. [^1]: https://github.com/Homebrew/homebrew-core/blob/5ca4f8ce766c69d49321fb7da1d297b8232f40cf/Formula/g/ghostscript.rb#L76 [^2]: https://github.com/macports/macports-ports/blob/d8a05520fa6a81fa5b0365068590aff184976b69/print/ghostscript/Portfile#L114 (cherry picked from commit 8b3d3d5854495297ee537e505bab522c21e0762f) --- pkgs/misc/ghostscript/default.nix | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/pkgs/misc/ghostscript/default.nix b/pkgs/misc/ghostscript/default.nix index 51fa6cda5dee9..d47a2b8768b10 100644 --- a/pkgs/misc/ghostscript/default.nix +++ b/pkgs/misc/ghostscript/default.nix @@ -104,6 +104,8 @@ stdenv.mkDerivation rec { sed "s@^ZLIBDIR=.*@ZLIBDIR=${zlib.dev}/include@" -i configure.ac autoconf + '' + lib.optionalString stdenv.hostPlatform.isDarwin '' + export DARWIN_LDFLAGS_SO_PREFIX=$out/lib/ ''; configureFlags = [ @@ -140,13 +142,6 @@ stdenv.mkDerivation rec { done ''; - # dynamic library name only contains maj.min, eg. '9.53' - dylib_version = lib.versions.majorMinor version; - preFixup = lib.optionalString stdenv.isDarwin '' - install_name_tool -change libgs.dylib.$dylib_version $out/lib/libgs.dylib.$dylib_version $out/bin/gs - install_name_tool -change libgs.dylib.$dylib_version $out/lib/libgs.dylib.$dylib_version $out/bin/gsx - ''; - # validate dynamic linkage doInstallCheck = true; installCheckPhase = ''