From 3070d8a681fab94a2dd108de4b151e0def7e8868 Mon Sep 17 00:00:00 2001 From: Lily Foster Date: Wed, 2 Oct 2024 20:12:28 +0200 Subject: [PATCH] ghostscript: fix build on darwin https://github.com/ArtifexSoftware/ghostpdl/commit/3230e58d06e024a6b4a08c37690aac48c0f186b2 https://hydra.nixos.org/build/274082857/nixlog/3/tail --- pkgs/misc/ghostscript/default.nix | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/pkgs/misc/ghostscript/default.nix b/pkgs/misc/ghostscript/default.nix index 841172ff7c08..c9557858a161 100644 --- a/pkgs/misc/ghostscript/default.nix +++ b/pkgs/misc/ghostscript/default.nix @@ -21,6 +21,7 @@ , bash , buildPackages , openjpeg +, fixDarwinDylibNames , cupsSupport ? config.ghostscript.cups or (!stdenv.hostPlatform.isDarwin) , cups , x11Support ? cupsSupport @@ -82,7 +83,8 @@ stdenv.mkDerivation rec { ]; nativeBuildInputs = [ pkg-config autoconf zlib ] - ++ lib.optional cupsSupport cups; + ++ lib.optional cupsSupport cups + ++ lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames; buildInputs = [ zlib expat openssl @@ -136,17 +138,14 @@ stdenv.mkDerivation rec { mkdir -p $fonts/share/fonts cp -rv ${fonts}/* "$fonts/share/fonts/" ln -s "$fonts/share/fonts" "$out/share/ghostscript/fonts" - '' + lib.optionalString stdenv.hostPlatform.isDarwin '' - for file in $out/lib/*.dylib* ; do - install_name_tool -id "$file" $file - done ''; - # dynamic library name only contains maj.min, eg. '9.53' - dylib_version = lib.versions.majorMinor version; + # dynamic library name only contains major version number, eg. '10' + dylib_version = lib.versions.major version; preFixup = lib.optionalString stdenv.hostPlatform.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 + 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