about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJan Tojnar <jtojnar@gmail.com>2024-06-01 09:40:24 +0200
committerGitHub <noreply@github.com>2024-06-01 09:40:24 +0200
commitc7535769b84ec8c01bf2c067117a38529688d20a (patch)
tree9e8177a6b29390b354056cd1d2f9439296a4b330
parent90f635947fec7c02b100f5aa898994a9c7464d92 (diff)
parentfae8ec30eabc4dc29051ab26a37ba1ba89827031 (diff)
Merge pull request #303748 from TuxCoder/inkscape_eps
inkscape: fix path patch
-rw-r--r--pkgs/applications/graphics/inkscape/default.nix3
-rw-r--r--pkgs/applications/graphics/inkscape/fix-ps2pdf-path.patch4
-rw-r--r--pkgs/applications/graphics/inkscape/test-ps2pdf-plugin.nix27
3 files changed, 32 insertions, 2 deletions
diff --git a/pkgs/applications/graphics/inkscape/default.nix b/pkgs/applications/graphics/inkscape/default.nix
index 358931534ad99..c285fc3116401 100644
--- a/pkgs/applications/graphics/inkscape/default.nix
+++ b/pkgs/applications/graphics/inkscape/default.nix
@@ -3,6 +3,7 @@
 , boehmgc
 , boost
 , cairo
+, callPackage
 , cmake
 , desktopToDarwinBundle
 , fetchurl
@@ -172,6 +173,8 @@ stdenv.mkDerivation rec {
     done
   '';
 
+  passthru.tests.ps2pdf-plugin = callPackage ./test-ps2pdf-plugin.nix { };
+
   meta = with lib; {
     description = "Vector graphics editor";
     homepage = "https://www.inkscape.org";
diff --git a/pkgs/applications/graphics/inkscape/fix-ps2pdf-path.patch b/pkgs/applications/graphics/inkscape/fix-ps2pdf-path.patch
index 9cd8e4b34cb59..0a28533591e1e 100644
--- a/pkgs/applications/graphics/inkscape/fix-ps2pdf-path.patch
+++ b/pkgs/applications/graphics/inkscape/fix-ps2pdf-path.patch
@@ -6,7 +6,7 @@ diff -Naur inkscape-1.2.2_2022-12-01_b0a8486541.orig/share/extensions/eps_input.
      <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>
++    <dependency type="executable" location="absolute">@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.">
@@ -18,7 +18,7 @@ diff -Naur inkscape-1.2.2_2022-12-01_b0a8486541.orig/share/extensions/ps_input.i
      <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>
++    <dependency type="executable" location="absolute">@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 --git a/pkgs/applications/graphics/inkscape/test-ps2pdf-plugin.nix b/pkgs/applications/graphics/inkscape/test-ps2pdf-plugin.nix
new file mode 100644
index 0000000000000..3e55557c860e1
--- /dev/null
+++ b/pkgs/applications/graphics/inkscape/test-ps2pdf-plugin.nix
@@ -0,0 +1,27 @@
+{ inkscape, runCommand, writeTextFile }:
+
+let
+  svg_file = writeTextFile {
+    name = "test.svg";
+    text = ''
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="50" height="50" version="1.1">
+  <ellipse cx="1" cy="1" rx="1" ry="1" />
+</svg>'';
+  };
+in
+runCommand "inkscape-test-eps"
+{
+  nativeBuildInputs = [ inkscape ];
+} ''
+  echo ps test
+  inkscape ${svg_file} --export-type=ps -o test.ps
+  inkscape test.ps -o test.ps.svg
+
+  echo eps test
+  inkscape ${svg_file} --export-type=eps -o test.eps
+  inkscape test.eps -o test.eps.svg
+
+  # inkscape does not return an error code, only does not create files
+  [[ -f test.ps.svg && -f test.eps.svg ]] && touch $out
+''