Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inkscape: fix path patch #303748

Merged
merged 2 commits into from
Jun 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions pkgs/applications/graphics/inkscape/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
, boehmgc
, boost
, cairo
, callPackage
, cmake
, desktopToDarwinBundle
, fetchurl
Expand Down Expand Up @@ -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";
Expand Down
4 changes: 2 additions & 2 deletions pkgs/applications/graphics/inkscape/fix-ps2pdf-path.patch
Original file line number Diff line number Diff line change
Expand Up @@ -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.">
Expand All @@ -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>
Expand Down
27 changes: 27 additions & 0 deletions pkgs/applications/graphics/inkscape/test-ps2pdf-plugin.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{ inkscape, runCommand, writeTextFile }:

let
svg_file = writeTextFile {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we could move this SVG into a separate file or use an existing svg file like in

${finalAttrs.finalPackage}/libexec/xdg-desktop-portal-validate-icon --sandbox 512 512 ${../../../applications/audio/zynaddsubfx/ZynLogo.svg} > "$out"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hello @jtojnar ,
I tried to reduce the svg file to a minimum, but would keep external deps to a minimum.
So our test gets not broken by a change in another package.

If you think otherwise I will change to the external file.

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
''