3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/applications/graphics/inkscape/default.nix
Arnout Engelen 4fb94610d9
inkscape: ps and eps import
There are a number of extensions, like the eps import,
that only become available when ps2pdf is available.
https://gitlab.com/inkscape/extensions/-/blob/master/eps_input.inx#L6

This is not so obvious, and this PR adds ghostscript (which provides ps2pdf)
explicitly so those extensions are always available and using a stable
version instead of relying on the PATH.

This will increase the inkscape closure by about 60MB,
which is quite a chunk, but perhaps not too bad on a
total of 1100MB.
2021-02-17 23:16:04 +01:00

159 lines
3.3 KiB
Nix
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{ lib, stdenv
, boehmgc
, boost
, cairo
, cmake
, double-conversion
, fetchurl
, gettext
, gdl
, ghostscript
, glib
, glib-networking
, glibmm
, gsl
, gtk-mac-integration
, gtkmm3
, gtkspell3
, gdk-pixbuf
, imagemagick
, lcms
, libcdr
, libexif
, libpng
, librevenge
, librsvg
, libsigcxx
, libsoup
, libvisio
, libwpg
, libXft
, libxml2
, libxslt
, ninja
, perlPackages
, pkg-config
, poppler
, popt
, potrace
, python3
, substituteAll
, wrapGAppsHook
, zlib
}:
let
python3Env = python3.withPackages
(ps: with ps; [
numpy
lxml
scour
]);
in
stdenv.mkDerivation rec {
pname = "inkscape";
version = "1.0.2";
src = fetchurl {
url = "https://media.inkscape.org/dl/resources/file/${pname}-${version}.tar.xz";
sha256 = "sha256-2j4jBRGgjL8h6GcQ0WFFhZT+qHhn6RV7Z+0BoE6ieYo=";
};
# Inkscape hits the ARGMAX when linking on macOS. It appears to be
# CMakes ARGMAX check doesnt offer enough padding for NIX_LDFLAGS.
# Setting strictDeps it avoids duplicating some dependencies so it
# will leave us under ARGMAX.
strictDeps = true;
patches = [
(substituteAll {
src = ./fix-python-paths.patch;
# Python is used at run-time to execute scripts,
# e.g., those from the "Effects" menu.
python3 = "${python3Env}/bin/python";
})
];
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
'';
nativeBuildInputs = [
pkg-config
cmake
ninja
python3Env
glib # for setup hook
gdk-pixbuf # for setup hook
wrapGAppsHook
] ++ (with perlPackages; [
perl
XMLParser
]);
buildInputs = [
boehmgc
boost
double-conversion
gdl
gettext
glib
glib-networking
glibmm
gsl
gtkmm3
imagemagick
lcms
libcdr
libexif
libpng
librevenge
librsvg # for loading icons
libsigcxx
libsoup
libvisio
libwpg
libXft
libxml2
libxslt
perlPackages.perl
poppler
popt
potrace
python3Env
zlib
] ++ lib.optionals (!stdenv.isDarwin) [
gtkspell3
] ++ lib.optionals stdenv.isDarwin [
cairo
gtk-mac-integration
];
# Make sure PyXML modules can be found at run-time.
postInstall = lib.optionalString stdenv.isDarwin ''
install_name_tool -change $out/lib/libinkscape_base.dylib $out/lib/inkscape/libinkscape_base.dylib $out/bin/inkscape
install_name_tool -change $out/lib/libinkscape_base.dylib $out/lib/inkscape/libinkscape_base.dylib $out/bin/inkview
'';
meta = with lib; {
description = "Vector graphics editor";
homepage = "https://www.inkscape.org";
license = licenses.gpl3Plus;
maintainers = [ maintainers.jtojnar ];
platforms = platforms.all;
longDescription = ''
Inkscape is a feature-rich vector graphics editor that edits
files in the W3C SVG (Scalable Vector Graphics) file format.
If you want to import .eps files install ps2edit.
'';
};
}