Skip to content

Commit

Permalink
ghostscript: fix install names on Darwin
Browse files Browse the repository at this point in the history
Fixes NixOS#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 NixOS#355853 and NixOS#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 8b3d3d5)
  • Loading branch information
carlocab authored and nixpkgs-channel-update-tracker[bot] committed Dec 6, 2024
1 parent 56c89f9 commit 0b961bd
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions pkgs/misc/ghostscript/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down Expand Up @@ -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 = ''
Expand Down

0 comments on commit 0b961bd

Please sign in to comment.