summary refs log tree commit diff
diff options
context:
space:
mode:
authorNikolay Korotkiy <sikmir@disroot.org>2023-08-02 22:54:27 +0400
committerNikolay Korotkiy <sikmir@disroot.org>2023-08-02 23:21:57 +0400
commit0db4b9956990c9394006214042f31da9f00244d7 (patch)
treea31cb786f4f615b9b0bcf1d24ce9d555ff36be89
parent90044aebad57cbcb5a612a5bf683188d4bc936a6 (diff)
downloadnixpkgs-0db4b9956990c9394006214042f31da9f00244d7.tar
nixpkgs-0db4b9956990c9394006214042f31da9f00244d7.tar.gz
nixpkgs-0db4b9956990c9394006214042f31da9f00244d7.tar.bz2
nixpkgs-0db4b9956990c9394006214042f31da9f00244d7.tar.lz
nixpkgs-0db4b9956990c9394006214042f31da9f00244d7.tar.xz
nixpkgs-0db4b9956990c9394006214042f31da9f00244d7.tar.zst
nixpkgs-0db4b9956990c9394006214042f31da9f00244d7.zip
inkscape: fix broken patching
-rw-r--r--pkgs/applications/graphics/inkscape/default.nix16
-rw-r--r--pkgs/applications/graphics/inkscape/fix-ps2pdf-path.patch36
2 files changed, 45 insertions, 7 deletions
diff --git a/pkgs/applications/graphics/inkscape/default.nix b/pkgs/applications/graphics/inkscape/default.nix
index 6444537cac2..ec0ab074625 100644
--- a/pkgs/applications/graphics/inkscape/default.nix
+++ b/pkgs/applications/graphics/inkscape/default.nix
@@ -4,6 +4,7 @@
 , boost
 , cairo
 , cmake
+, desktopToDarwinBundle
 , fetchurl
 , gettext
 , ghostscript
@@ -78,16 +79,15 @@ stdenv.mkDerivation rec {
       # e.g., those from the "Effects" menu.
       python3 = "${python3Env}/bin/python";
     })
+    (substituteAll {
+      # Fix path to ps2pdf binary
+      src = ./fix-ps2pdf-path.patch;
+      inherit ghostscript;
+    })
   ];
 
   postPatch = ''
     patchShebangs share/extensions
-    substituteInPlace share/extensions/eps_input.inx \
-      --replace "location=\"path\">ps2pdf" "location=\"absolute\">${ghostscript}/bin/ps2pdf"
-    substituteInPlace share/extensions/ps_input.inx \
-      --replace "location=\"path\">ps2pdf" "location=\"absolute\">${ghostscript}/bin/ps2pdf"
-    substituteInPlace share/extensions/ps_input.py \
-      --replace "call('ps2pdf'" "call('${ghostscript}/bin/ps2pdf'"
     patchShebangs share/templates
     patchShebangs man/fix-roff-punct
 
@@ -107,7 +107,9 @@ stdenv.mkDerivation rec {
   ] ++ (with perlPackages; [
     perl
     XMLParser
-  ]);
+  ]) ++ lib.optionals stdenv.isDarwin [
+    desktopToDarwinBundle
+  ];
 
   buildInputs = [
     boehmgc
diff --git a/pkgs/applications/graphics/inkscape/fix-ps2pdf-path.patch b/pkgs/applications/graphics/inkscape/fix-ps2pdf-path.patch
new file mode 100644
index 00000000000..9cd8e4b34cb
--- /dev/null
+++ b/pkgs/applications/graphics/inkscape/fix-ps2pdf-path.patch
@@ -0,0 +1,36 @@
+diff -Naur inkscape-1.2.2_2022-12-01_b0a8486541.orig/share/extensions/eps_input.inx inkscape-1.2.2_2022-12-01_b0a8486541/share/extensions/eps_input.inx
+--- inkscape-1.2.2_2022-12-01_b0a8486541.orig/share/extensions/eps_input.inx	2023-08-02 22:22:32.000000000 +0400
++++ inkscape-1.2.2_2022-12-01_b0a8486541/share/extensions/eps_input.inx	2023-08-02 22:23:34.000000000 +0400
+@@ -3,7 +3,7 @@
+     <name>EPS Input</name>
+     <id>org.inkscape.input.eps</id>
+     <dependency type="extension">org.inkscape.input.pdf</dependency>
+-    <dependency type="executable" location="path">ps2pdf</dependency>
++    <dependency type="executable" location="path">@ghostscript@/bin/ps2pdf</dependency>
+     <param name="crop" type="bool" gui-hidden="true">true</param>
+     <param name="autorotate" type="optiongroup" appearance="combo" gui-text="Determine page orientation from text direction"
+     gui-description="The PS/EPS importer can try to determine the page orientation such that the majority of the text runs left-to-right.">
+diff -Naur inkscape-1.2.2_2022-12-01_b0a8486541.orig/share/extensions/ps_input.inx inkscape-1.2.2_2022-12-01_b0a8486541/share/extensions/ps_input.inx
+--- inkscape-1.2.2_2022-12-01_b0a8486541.orig/share/extensions/ps_input.inx	2023-08-02 22:22:33.000000000 +0400
++++ inkscape-1.2.2_2022-12-01_b0a8486541/share/extensions/ps_input.inx	2023-08-02 22:24:00.000000000 +0400
+@@ -3,7 +3,7 @@
+     <name>PostScript Input</name>
+     <id>org.inkscape.input.postscript_input</id>
+     <dependency type="extension">org.inkscape.input.pdf</dependency>
+-    <dependency type="executable" location="path">ps2pdf</dependency>
++    <dependency type="executable" location="path">@ghostscript@/bin/ps2pdf</dependency>
+     <param name="autorotate" type="optiongroup" appearance="combo" gui-text="Determine page orientation from text direction"
+     gui-description="The PS/EPS importer can try to determine the page orientation such that the majority of the text runs left-to-right.">
+         <option value="None">Disabled</option>
+diff -Naur inkscape-1.2.2_2022-12-01_b0a8486541.orig/share/extensions/ps_input.py inkscape-1.2.2_2022-12-01_b0a8486541/share/extensions/ps_input.py
+--- inkscape-1.2.2_2022-12-01_b0a8486541.orig/share/extensions/ps_input.py	2023-08-02 22:22:32.000000000 +0400
++++ inkscape-1.2.2_2022-12-01_b0a8486541/share/extensions/ps_input.py	2023-08-02 22:23:48.000000000 +0400
+@@ -79,7 +79,7 @@
+         else:
+             try:
+                 call(
+-                    "ps2pdf",
++                    "@ghostscript@/bin/ps2pdf",
+                     crop,
+                     "-dAutoRotatePages=/" + self.options.autorotate,
+                     input_file,