summary refs log tree commit diff
path: root/pkgs/applications/graphics/inkscape/default.nix
blob: eb349e412068fdf875b9ea4a00941bdc1fb90f7f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
{ stdenv, fetchurl, fetchpatch, pkgconfig, perl, perlXMLParser, libXft
, libpng, zlib, popt, boehmgc, libxml2, libxslt, glib, gtkmm2
, glibmm, libsigcxx, lcms, boost, gettext, makeWrapper
, gsl, python2, poppler, imagemagick, libwpg, librevenge
, libvisio, libcdr, libexif, potrace, autoreconfHook
, intltool
, icu # Not needed for building with CMake
, lib
}:

# Note that originally this Nix expression used CMake to build but
# this led to errors on MacOS of "Too many arguments". Inkscape
# supports autoconf and we will use this for now on.

let
  python2Env = python2.withPackages(ps: with ps; [ numpy lxml ]);
in

stdenv.mkDerivation rec {
  name = "inkscape-0.92.3";

  src = fetchurl {
    url = "https://media.inkscape.org/dl/resources/file/${name}.tar.bz2";
    sha256 = "1chng2yw8dsjxc9gf92aqv7plj11cav8ax321wmakmv5bb09cch6";
  };

  postPatch = ''
    patchShebangs share/extensions
    patchShebangs fix-roff-punct

    # XXX: Not needed for CMake:
    patchShebangs share/palettes
    patchShebangs share/patterns
    patchShebangs share/symbols
    patchShebangs share/templates

    # Python is used at run-time to execute scripts, e.g., those from
    # the "Effects" menu.
    substituteInPlace src/extension/implementation/script.cpp \
      --replace '"python-interpreter", "python"' '"python-interpreter", "${python2Env}/bin/python"'
  '';

  nativeBuildInputs = [ pkgconfig autoreconfHook intltool ];
  buildInputs = [
    perl perlXMLParser libXft libpng zlib popt boehmgc
    libxml2 libxslt glib gtkmm2 glibmm libsigcxx lcms boost gettext
    makeWrapper gsl poppler imagemagick libwpg librevenge
    libvisio libcdr libexif potrace python2Env icu
  ];

  enableParallelBuilding = true;

  preConfigure = ''
    intltoolize -f
  '';

  postInstall = ''
    # Make sure PyXML modules can be found at run-time.
    rm "$out/share/icons/hicolor/icon-theme.cache"
  '';

  meta = with lib; {
    license = "GPL";
    homepage = https://www.inkscape.org;
    description = "Vector graphics editor";
    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.
    '';
    maintainers = with maintainers; [ matthewbauer ];
  };
}