Skip to content

Commit

Permalink
ghostscript: fix install names on Darwin
Browse files Browse the repository at this point in the history
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
  • Loading branch information
carlocab committed Nov 22, 2024
1 parent 262e136 commit 6e66aaf
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions pkgs/by-name/gh/ghostscript/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ stdenv.mkDerivation rec {
;

preConfigure = ''
export DARWIN_LDFLAGS_SO_PREFIX=$out/lib/
# https://ghostscript.com/doc/current/Make.htm
export CCAUX=$CC_FOR_BUILD
${lib.optionalString cupsSupport ''export CUPSCONFIG="${cups.dev}/bin/cups-config"''}
Expand Down Expand Up @@ -140,14 +142,6 @@ stdenv.mkDerivation rec {
ln -s "$fonts/share/fonts" "$out/share/ghostscript/fonts"
'';

# dynamic library name only contains major version number, eg. '10'
dylib_version = lib.versions.major version;
preFixup = lib.optionalString stdenv.hostPlatform.isDarwin ''
for file in $out/bin/{gs,gsc,gsx}; do
install_name_tool -change libgs.$dylib_version.dylib $out/lib/libgs.$dylib_version.dylib $file
done
'';

# validate dynamic linkage
doInstallCheck = true;
installCheckPhase = ''
Expand Down

0 comments on commit 6e66aaf

Please sign in to comment.