From f2c59d3401eedd47689d80e4767bfc951b1eadb2 Mon Sep 17 00:00:00 2001 From: K900 Date: Sun, 24 Sep 2023 20:26:33 +0300 Subject: [PATCH] libsForQt5.kdegraphics-thumbnailers: hardcode Ghostscript path Fixes #153983. --- pkgs/applications/kde/default.nix | 2 +- .../default.nix} | 11 +++++++++- .../kdegraphics-thumbnailers/gs-paths.patch | 22 +++++++++++++++++++ 3 files changed, 33 insertions(+), 2 deletions(-) rename pkgs/applications/kde/{kdegraphics-thumbnailers.nix => kdegraphics-thumbnailers/default.nix} (55%) create mode 100644 pkgs/applications/kde/kdegraphics-thumbnailers/gs-paths.patch diff --git a/pkgs/applications/kde/default.nix b/pkgs/applications/kde/default.nix index e61e99751d0d..a0e59c43d17c 100644 --- a/pkgs/applications/kde/default.nix +++ b/pkgs/applications/kde/default.nix @@ -120,7 +120,7 @@ let kdebugsettings = callPackage ./kdebugsettings.nix {}; kdeconnect-kde = callPackage ./kdeconnect-kde.nix {}; kdegraphics-mobipocket = callPackage ./kdegraphics-mobipocket.nix {}; - kdegraphics-thumbnailers = callPackage ./kdegraphics-thumbnailers.nix {}; + kdegraphics-thumbnailers = callPackage ./kdegraphics-thumbnailers {}; kdenetwork-filesharing = callPackage ./kdenetwork-filesharing.nix {}; kdenlive = callPackage ./kdenlive {}; kdepim-addons = callPackage ./kdepim-addons.nix {}; diff --git a/pkgs/applications/kde/kdegraphics-thumbnailers.nix b/pkgs/applications/kde/kdegraphics-thumbnailers/default.nix similarity index 55% rename from pkgs/applications/kde/kdegraphics-thumbnailers.nix rename to pkgs/applications/kde/kdegraphics-thumbnailers/default.nix index f0d9fea5d0e6..6686f582d6d2 100644 --- a/pkgs/applications/kde/kdegraphics-thumbnailers.nix +++ b/pkgs/applications/kde/kdegraphics-thumbnailers/default.nix @@ -1,5 +1,5 @@ { - mkDerivation, lib, fetchpatch, + mkDerivation, lib, ghostscript, substituteAll, extra-cmake-modules, karchive, kio, libkexiv2, libkdcraw, kdegraphics-mobipocket }: @@ -11,4 +11,13 @@ mkDerivation { }; nativeBuildInputs = [ extra-cmake-modules ]; buildInputs = [ karchive kio libkexiv2 libkdcraw kdegraphics-mobipocket ]; + + patches = [ + # Hardcode patches to Ghostscript so PDF thumbnails work OOTB. + # Intentionally not doing the same for dvips because TeX is big. + (substituteAll { + gs = "${ghostscript}/bin/gs"; + src = ./gs-paths.patch; + }) + ]; } diff --git a/pkgs/applications/kde/kdegraphics-thumbnailers/gs-paths.patch b/pkgs/applications/kde/kdegraphics-thumbnailers/gs-paths.patch new file mode 100644 index 000000000000..5aa4a8d7444c --- /dev/null +++ b/pkgs/applications/kde/kdegraphics-thumbnailers/gs-paths.patch @@ -0,0 +1,22 @@ +diff --git a/ps/gscreator.cpp b/ps/gscreator.cpp +index 5b84e49..cbb7c25 100644 +--- a/ps/gscreator.cpp ++++ b/ps/gscreator.cpp +@@ -101,7 +101,7 @@ static const char *epsprolog = + "[ ] 0 setdash newpath false setoverprint false setstrokeadjust\n"; + + static const char * gsargs_ps[] = { +- "gs", ++ "@gs@", + "-sDEVICE=png16m", + "-sOutputFile=-", + "-dSAFER", +@@ -120,7 +120,7 @@ static const char * gsargs_ps[] = { + }; + + static const char * gsargs_eps[] = { +- "gs", ++ "@gs@", + "-sDEVICE=png16m", + "-sOutputFile=-", + "-dSAFER",