nixpkgs/pkgs/applications/graphics/inkscape/default.nix

173 lines
3.9 KiB
Nix
Raw Normal View History

{ stdenv
, lib
, boehmgc
, boost
, cairo
, cmake
, fetchurl
, fetchpatch
, gettext
, ghostscript
, glib
2020-04-14 09:55:08 +01:00
, glib-networking
, glibmm
, gsl
, gspell
2020-04-14 09:55:08 +01:00
, gtk-mac-integration
, gtkmm3
, gdk-pixbuf
, imagemagick
, lcms
, lib2geom
, libcdr
, libexif
, libpng
, librevenge
, librsvg
, libsigcxx
2020-04-14 09:55:08 +01:00
, libsoup
, libvisio
, libwpg
, libXft
, libxml2
, libxslt
2020-04-14 09:55:08 +01:00
, ninja
, perlPackages
, pkg-config
, poppler
, popt
, potrace
, python3
2020-04-14 09:55:08 +01:00
, substituteAll
, wrapGAppsHook
, zlib
}:
2017-03-09 00:26:26 +00:00
let
python3Env = python3.withPackages
(ps: with ps; [
numpy
lxml
pillow
scour
]);
2015-05-21 14:43:02 +01:00
in
stdenv.mkDerivation rec {
pname = "inkscape";
version = "1.1.1";
src = fetchurl {
2020-04-14 09:55:08 +01:00
url = "https://media.inkscape.org/dl/resources/file/${pname}-${version}.tar.xz";
sha256 = "sha256-rsoLnTO1sc+pqnBDO97mqMPQIP+vwubwyaYO7Xp5eK8=";
};
# 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;
2020-04-14 09:55:08 +01:00
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";
})
# Fix parsing paths by Python extensions.
# https://gitlab.com/inkscape/extensions/-/merge_requests/342
(fetchpatch {
url = "https://gitlab.com/inkscape/extensions/-/commit/a82c382c610d37837c8f3f5b13224bab8fd3667e.patch";
sha256 = "YWrgjCnQ9q6BUsxSLQojIXnDzPxM/SgrIfj1gxQ/JKM=";
stripLen = 1;
extraPrefix = "share/extensions/";
})
2020-04-14 09:55:08 +01:00
];
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'"
2020-04-14 09:55:08 +01:00
patchShebangs share/templates
patchShebangs man/fix-roff-punct
# double-conversion is a dependency of 2geom
substituteInPlace CMakeScripts/DefineDependsandFlags.cmake \
--replace 'find_package(DoubleConversion REQUIRED)' ""
'';
nativeBuildInputs = [
pkg-config
cmake
2020-04-14 09:55:08 +01:00
ninja
python3Env
2020-04-14 09:55:08 +01:00
glib # for setup hook
gdk-pixbuf # for setup hook
wrapGAppsHook
] ++ (with perlPackages; [
perl
XMLParser
]);
buildInputs = [
boehmgc
boost
gettext
glib
2020-04-14 09:55:08 +01:00
glib-networking
glibmm
gsl
2020-04-14 09:55:08 +01:00
gtkmm3
imagemagick
lcms
lib2geom
libcdr
libexif
libpng
librevenge
librsvg # for loading icons
libsigcxx
2020-04-14 09:55:08 +01:00
libsoup
libvisio
libwpg
libXft
libxml2
libxslt
perlPackages.perl
poppler
popt
potrace
python3Env
zlib
2021-01-15 13:21:58 +00:00
] ++ lib.optionals (!stdenv.isDarwin) [
gspell
2021-01-15 13:21:58 +00:00
] ++ lib.optionals stdenv.isDarwin [
cairo
2020-04-14 09:55:08 +01:00
gtk-mac-integration
];
# Make sure PyXML modules can be found at run-time.
2021-01-15 13:21:58 +00:00
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";
2020-04-14 00:11:51 +01:00
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.
'';
};
}