ghostscript: fix build on darwin

3230e58d06
https://hydra.nixos.org/build/274082857/nixlog/3/tail
This commit is contained in:
Lily Foster 2024-10-02 20:12:28 +02:00 committed by Vladimír Čunát
parent b90a808faa
commit 3070d8a681
No known key found for this signature in database
GPG Key ID: E747DF1F9575A3AA

View File

@ -21,6 +21,7 @@
, bash , bash
, buildPackages , buildPackages
, openjpeg , openjpeg
, fixDarwinDylibNames
, cupsSupport ? config.ghostscript.cups or (!stdenv.hostPlatform.isDarwin) , cupsSupport ? config.ghostscript.cups or (!stdenv.hostPlatform.isDarwin)
, cups , cups
, x11Support ? cupsSupport , x11Support ? cupsSupport
@ -82,7 +83,8 @@ stdenv.mkDerivation rec {
]; ];
nativeBuildInputs = [ pkg-config autoconf zlib ] nativeBuildInputs = [ pkg-config autoconf zlib ]
++ lib.optional cupsSupport cups; ++ lib.optional cupsSupport cups
++ lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames;
buildInputs = [ buildInputs = [
zlib expat openssl zlib expat openssl
@ -136,17 +138,14 @@ stdenv.mkDerivation rec {
mkdir -p $fonts/share/fonts mkdir -p $fonts/share/fonts
cp -rv ${fonts}/* "$fonts/share/fonts/" cp -rv ${fonts}/* "$fonts/share/fonts/"
ln -s "$fonts/share/fonts" "$out/share/ghostscript/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' # dynamic library name only contains major version number, eg. '10'
dylib_version = lib.versions.majorMinor version; dylib_version = lib.versions.major version;
preFixup = lib.optionalString stdenv.hostPlatform.isDarwin '' preFixup = lib.optionalString stdenv.hostPlatform.isDarwin ''
install_name_tool -change libgs.dylib.$dylib_version $out/lib/libgs.dylib.$dylib_version $out/bin/gs for file in $out/bin/{gs,gsc,gsx}; do
install_name_tool -change libgs.dylib.$dylib_version $out/lib/libgs.dylib.$dylib_version $out/bin/gsx install_name_tool -change libgs.$dylib_version.dylib $out/lib/libgs.$dylib_version.dylib $file
done
''; '';
# validate dynamic linkage # validate dynamic linkage