biglybt: 3.5.0.0 -> 3.6.0.0
[NixPkgs.git] / pkgs / applications / graphics / inkscape / default.nix
blob35000a06de02ea1a0f635e3030779a36f2ffd5d3
1 { stdenv
2 , lib
3 , boehmgc
4 , boost
5 , cairo
6 , cmake
7 , desktopToDarwinBundle
8 , fetchurl
9 , fetchpatch
10 , gettext
11 , ghostscript
12 , glib
13 , glibmm
14 , gobject-introspection
15 , gsl
16 , gspell
17 , gtk-mac-integration
18 , gtkmm3
19 , gdk-pixbuf
20 , imagemagick
21 , lcms
22 , lib2geom
23 , libcdr
24 , libexif
25 , libpng
26 , librevenge
27 , librsvg
28 , libsigcxx
29 , libsoup
30 , libvisio
31 , libwpg
32 , libXft
33 , libxml2
34 , libxslt
35 , ninja
36 , perlPackages
37 , pkg-config
38 , poppler
39 , popt
40 , potrace
41 , python3
42 , substituteAll
43 , wrapGAppsHook
44 , libepoxy
45 , zlib
47 let
48   python3Env = python3.withPackages
49     (ps: with ps; [
50       appdirs
51       beautifulsoup4
52       cachecontrol
53     ]
54     # CacheControl requires extra runtime dependencies for FileCache
55     # https://gitlab.com/inkscape/extras/extension-manager/-/commit/9a4acde6c1c028725187ff5972e29e0dbfa99b06
56     ++ cachecontrol.optional-dependencies.filecache
57     ++ [
58       numpy
59       lxml
60       packaging
61       pillow
62       scour
63       pyparsing
64       pyserial
65       requests
66       pygobject3
67     ] ++ inkex.propagatedBuildInputs);
69 stdenv.mkDerivation rec {
70   pname = "inkscape";
71   version = "1.3.2";
73   src = fetchurl {
74     url = "https://inkscape.org/release/inkscape-${version}/source/archive/xz/dl/inkscape-${version}.tar.xz";
75     sha256 = "sha256-29GETcRD/l4Q0+mohxROX7ciOFL/8ZHPte963qsOCGs=";
76   };
78   # Inkscape hits the ARGMAX when linking on macOS. It appears to be
79   # CMake’s ARGMAX check doesn’t offer enough padding for NIX_LDFLAGS.
80   # Setting strictDeps it avoids duplicating some dependencies so it
81   # will leave us under ARGMAX.
82   strictDeps = true;
84   patches = [
85     (substituteAll {
86       src = ./fix-python-paths.patch;
87       # Python is used at run-time to execute scripts,
88       # e.g., those from the "Effects" menu.
89       python3 = "${python3Env}/bin/python";
90     })
91     (substituteAll {
92       # Fix path to ps2pdf binary
93       src = ./fix-ps2pdf-path.patch;
94       inherit ghostscript;
95     })
97     # Fix build with libxml2 2.12
98     # https://gitlab.com/inkscape/inkscape/-/merge_requests/6089
99     (fetchpatch {
100       url = "https://gitlab.com/inkscape/inkscape/-/commit/694d8ae43d06efff21adebf377ce614d660b24cd.patch";
101       hash = "sha256-9IXJzpZbNU5fnt7XKgqCzUDrwr08qxGwo8TqnL+xc6E=";
102     })
103   ];
105   postPatch = ''
106     patchShebangs share/extensions
107     patchShebangs share/templates
108     patchShebangs man/fix-roff-punct
110     # double-conversion is a dependency of 2geom
111     substituteInPlace CMakeScripts/DefineDependsandFlags.cmake \
112       --replace 'find_package(DoubleConversion REQUIRED)' ""
113   '';
115   nativeBuildInputs = [
116     pkg-config
117     cmake
118     ninja
119     python3Env
120     glib # for setup hook
121     gdk-pixbuf # for setup hook
122     wrapGAppsHook
123     gobject-introspection
124   ] ++ (with perlPackages; [
125     perl
126     XMLParser
127   ]) ++ lib.optionals stdenv.isDarwin [
128     desktopToDarwinBundle
129   ];
131   buildInputs = [
132     boehmgc
133     boost
134     gettext
135     glib
136     glibmm
137     gsl
138     gtkmm3
139     imagemagick
140     lcms
141     lib2geom
142     libcdr
143     libexif
144     libpng
145     librevenge
146     librsvg # for loading icons
147     libsigcxx
148     libsoup
149     libvisio
150     libwpg
151     libXft
152     libxml2
153     libxslt
154     perlPackages.perl
155     poppler
156     popt
157     potrace
158     python3Env
159     zlib
160     libepoxy
161   ] ++ lib.optionals (!stdenv.isDarwin) [
162     gspell
163   ] ++ lib.optionals stdenv.isDarwin [
164     cairo
165     gtk-mac-integration
166   ];
168   # Make sure PyXML modules can be found at run-time.
169   postInstall = lib.optionalString stdenv.isDarwin ''
170     for f in $out/lib/inkscape/*.dylib; do
171       ln -s $f $out/lib/$(basename $f)
172     done
173   '';
175   meta = with lib; {
176     description = "Vector graphics editor";
177     homepage = "https://www.inkscape.org";
178     license = licenses.gpl3Plus;
179     maintainers = [ maintainers.jtojnar ];
180     platforms = platforms.all;
181     mainProgram = "inkscape";
182     longDescription = ''
183       Inkscape is a feature-rich vector graphics editor that edits
184       files in the W3C SVG (Scalable Vector Graphics) file format.
186       If you want to import .eps files install ps2edit.
187     '';
188   };