From a775974c8ac756d2293c4c9f8b2db887d3aa47e7 Mon Sep 17 00:00:00 2001 From: Sirio Balmelli Date: Tue, 24 Nov 2020 10:46:19 +0100 Subject: [PATCH] ghostscript: fix broken rpath on Darwin Dynamic library name on Darwin contains only 'maj.min' eg "9.53"; the build however used $version to set rpath; this broke on 2029ca37 when $version went from "9.52" to "9.53.3". Add a call to 'gs' in installCheckPhase, to break the build if dylib issues arise in the future. Signed-off-by: Sirio Balmelli Co-authored-by: Dmitry Kalinkin --- pkgs/misc/ghostscript/default.nix | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/pkgs/misc/ghostscript/default.nix b/pkgs/misc/ghostscript/default.nix index 5a7762640f73..6f113bcd99cb 100644 --- a/pkgs/misc/ghostscript/default.nix +++ b/pkgs/misc/ghostscript/default.nix @@ -103,8 +103,20 @@ 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.${version} $out/lib/libgs.dylib.${version} $out/bin/gs + install_name_tool -change libgs.dylib.$dylib_version $out/lib/libgs.dylib.$dylib_version $out/bin/gs + ''; + + # validate dynamic linkage + doInstallCheck = true; + installCheckPhase = '' + runHook preInstallCheck + + $out/bin/gs --version + + runHook postInstallCheck ''; meta = {