Commit | Line | Data |
---|---|---|
1d07e931 JD |
1 | ;;; GNU Guix --- Functional package management for GNU |
2 | ;;; Copyright © 2014 John Darrington <jmd@gnu.org> | |
8e359335 | 3 | ;;; Copyright © 2014, 2016 Mark H Weaver <mhw@netris.org> |
cda7f4bc | 4 | ;;; Copyright © 2016, 2018 Ricardo Wurmus <rekado@elephly.net> |
1e5663e2 | 5 | ;;; Copyright © 2017, 2020 Marius Bakke <mbakke@fastmail.com> |
2b7eda61 | 6 | ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr> |
ff8a1a88 | 7 | ;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com> |
17d30d1f | 8 | ;;; Copyright © 2020 Boris A. Dekshteyn <boris.dekshteyn@gmail.com> |
24b233d4 | 9 | ;;; Copyright © 2020 Ekaitz Zarraga <ekaitz@elenq.tech> |
1d07e931 JD |
10 | ;;; |
11 | ;;; This file is part of GNU Guix. | |
12 | ;;; | |
13 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | |
14 | ;;; under the terms of the GNU General Public License as published by | |
15 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
16 | ;;; your option) any later version. | |
17 | ;;; | |
18 | ;;; GNU Guix is distributed in the hope that it will be useful, but | |
19 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 | ;;; GNU General Public License for more details. | |
22 | ;;; | |
23 | ;;; You should have received a copy of the GNU General Public License | |
24 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | |
25 | ||
26 | (define-module (gnu packages inkscape) | |
b5b73a82 | 27 | #:use-module ((guix licenses) #:prefix license:) |
1d07e931 JD |
28 | #:use-module (guix packages) |
29 | #:use-module (guix download) | |
bc351001 | 30 | #:use-module (guix utils) |
68f90673 | 31 | #:use-module (guix build-system cmake) |
1d07e931 JD |
32 | #:use-module (gnu packages) |
33 | #:use-module (gnu packages aspell) | |
34 | #:use-module (gnu packages bdw-gc) | |
35 | #:use-module (gnu packages boost) | |
ff8a1a88 | 36 | #:use-module (gnu packages check) |
1d07e931 | 37 | #:use-module (gnu packages glib) |
ff8a1a88 MC |
38 | #:use-module (gnu packages gnome) |
39 | #:use-module (gnu packages graphics) | |
1d07e931 | 40 | #:use-module (gnu packages gtk) |
ff8a1a88 MC |
41 | #:use-module (gnu packages imagemagick) |
42 | #:use-module (gnu packages libreoffice) | |
1d07e931 JD |
43 | #:use-module (gnu packages maths) |
44 | #:use-module (gnu packages perl) | |
45 | #:use-module (gnu packages pdf) | |
46 | #:use-module (gnu packages popt) | |
47 | #:use-module (gnu packages python) | |
24b233d4 | 48 | #:use-module (gnu packages python-xyz) |
1d07e931 JD |
49 | #:use-module (gnu packages xml) |
50 | #:use-module (gnu packages ghostscript) | |
51 | #:use-module (gnu packages fontutils) | |
e55354b8 | 52 | #:use-module (gnu packages image) |
1d07e931 JD |
53 | #:use-module (gnu packages pkg-config)) |
54 | ||
55 | (define-public inkscape | |
56 | (package | |
57 | (name "inkscape") | |
d680a8af | 58 | (version "0.92.4") |
1d07e931 JD |
59 | (source (origin |
60 | (method url-fetch) | |
68f90673 RW |
61 | (uri (string-append "https://media.inkscape.org/dl/" |
62 | "resources/file/" | |
63 | "inkscape-" version ".tar.bz2")) | |
1a753d56 | 64 | (patches (search-patches "inkscape-poppler-0.76.patch")) |
1d07e931 JD |
65 | (sha256 |
66 | (base32 | |
d680a8af | 67 | "0pjinhjibfsz1aywdpgpj3k23xrsszpj4a1ya5562dkv2yl2vv2p")))) |
68f90673 | 68 | (build-system cmake-build-system) |
1d07e931 JD |
69 | (inputs |
70 | `(("aspell" ,aspell) | |
71 | ("gtkmm" ,gtkmm-2) | |
72 | ("gtk" ,gtk+-2) | |
73 | ("gsl" ,gsl) | |
74 | ("poppler" ,poppler) | |
75 | ("libpng" ,libpng) | |
76 | ("libxml2" ,libxml2) | |
77 | ("libxslt" ,libxslt) | |
618ea7c9 | 78 | ("libgc" ,libgc) |
1d07e931 JD |
79 | ("freetype" ,freetype) |
80 | ("popt" ,popt) | |
68376f6c | 81 | ("potrace" ,potrace) |
1d07e931 JD |
82 | ("python" ,python-2) |
83 | ("lcms" ,lcms) | |
84 | ("boost" ,boost))) | |
85 | (native-inputs | |
86 | `(("intltool" ,intltool) | |
68f90673 | 87 | ("glib" ,glib "bin") |
1d07e931 JD |
88 | ("perl" ,perl) |
89 | ("pkg-config" ,pkg-config))) | |
68f90673 | 90 | ;; FIXME: tests require gmock |
81ed306d DM |
91 | (arguments |
92 | `(#:tests? #f | |
20f5c86c DM |
93 | #:phases |
94 | (modify-phases %standard-phases | |
95 | (add-after 'unpack 'patch-icon-cache-generator | |
96 | (lambda _ | |
97 | (substitute* "share/icons/application/CMakeLists.txt" | |
98 | (("gtk-update-icon-cache") "true")) | |
0bba8a5c | 99 | #t)) |
1e5663e2 MB |
100 | (add-after 'unpack 'adjust-for-new-poppler |
101 | (lambda _ | |
102 | (substitute* (find-files "src/extension/internal/pdfinput") | |
103 | ;; Needed for Poppler 0.82. | |
104 | (("Unicode \\*u") "Unicode const *u") | |
105 | ;; Needed for Poppler 0.83. | |
106 | (("\\(GfxPath") "(const GfxPath") | |
107 | (("GfxSubpath") "const GfxSubpath") | |
108 | (("new GlobalParams\\(\\)") | |
109 | "std::unique_ptr<GlobalParams>(new GlobalParams())") | |
110 | (("new GlobalParams\\(poppler_datadir\\)") | |
111 | "std::unique_ptr<GlobalParams>(new GlobalParams(poppler_datadir))")) | |
20f5c86c | 112 | #t))))) |
50dc3b8b | 113 | (home-page "https://inkscape.org/") |
1d07e931 JD |
114 | (synopsis "Vector graphics editor") |
115 | (description "Inkscape is a vector graphics editor. What sets Inkscape | |
116 | apart is its use of Scalable Vector Graphics (SVG), an XML-based W3C standard, | |
117 | as the native format.") | |
118 | (license license:gpl2+))) | |
ff8a1a88 MC |
119 | |
120 | (define-public inkscape-1.0 | |
121 | (package | |
122 | (name "inkscape") | |
f9bd4621 | 123 | (version "1.0.2") |
ff8a1a88 MC |
124 | (source |
125 | (origin | |
126 | (method url-fetch) | |
127 | (uri (string-append "https://media.inkscape.org/dl/" | |
128 | "resources/file/" | |
129 | "inkscape-" version ".tar.xz")) | |
130 | (sha256 | |
131 | (base32 | |
f9bd4621 | 132 | "12krl97a00gdcxxibsb7g2lgx5458mhx2437x0hvz350242j6gns")) |
ff8a1a88 MC |
133 | (modules '((guix build utils) |
134 | (ice-9 format))) | |
135 | (snippet | |
136 | '(begin | |
137 | (let-syntax | |
138 | ;; XXX: The build system doesn't currently support using | |
139 | ;; system libraries over bundled ones (see: | |
140 | ;; https://gitlab.com/inkscape/inkscape/issues/876). | |
141 | ((unbundle | |
142 | (syntax-rules () | |
143 | ((_ (name source-dir use-pkg-config?) ...) | |
144 | (begin | |
145 | ;; Delete bundled source directories. | |
146 | (delete-file-recursively source-dir) ... | |
147 | (substitute* '("src/CMakeLists.txt" | |
148 | "src/3rdparty/CMakeLists.txt") | |
149 | (((string-append ".*add_subdirectory\\(" | |
150 | (basename source-dir) "\\).*")) | |
151 | "") ...) | |
152 | ;; Remove bundled entries from INKSCAPE_TARGET_LIBS. | |
153 | (substitute* "src/CMakeLists.txt" | |
154 | (((string-append name "_LIB.*")) "") ...) | |
155 | ;; Register the external libraries, so that their | |
156 | ;; headers are added to INKSCAPE_INCS_SYS and their | |
157 | ;; shared libraries added to INKSCAPE_LIBS. | |
158 | (if use-pkg-config? | |
159 | (let* ((width (string-length "pkg_check_modules(")) | |
160 | (indent (string-join (make-list width " ") ""))) | |
161 | (substitute* "CMakeScripts/DefineDependsandFlags.cmake" | |
162 | (("^pkg_check_modules\\(INKSCAPE_DEP REQUIRED.*" start) | |
163 | (string-append start | |
164 | (format #f "~a~a~%" indent name))))) | |
165 | (substitute* "CMakeScripts/DefineDependsandFlags.cmake" | |
166 | (("^find_package\\(Iconv REQUIRED\\).*" start) | |
167 | (string-append (format #f " | |
168 | find_path(~a_INCLUDE_DIR NAMES ~:*~a/~:*~a.h ~:*~a.h) | |
169 | if(NOT ~:*~a_INCLUDE_DIR) | |
170 | message(FATAL_ERROR \"~:*~a headers not found\") | |
171 | else() | |
172 | list(APPEND INKSCAPE_INCS_SYS ${~:*~a_INCLUDE_DIR}) | |
173 | endif() | |
174 | ||
175 | find_library(~:*~a_LIB NAMES ~:*~a) | |
176 | if(NOT ~:*~a_LIB) | |
177 | message(FATAL_ERROR \"~:*~a library not found\") | |
178 | else() | |
179 | list(APPEND INKSCAPE_LIBS ~:*~a_LIB) | |
180 | endif()~%~%" | |
181 | name) | |
182 | start)))) ... | |
183 | ;; Fix the references to the headers of the | |
184 | ;; unbundled libraries. | |
185 | (substitute* (find-files "." "\\.h$|\\.cpp$") | |
186 | (((string-append "#include (\"|<)3rdparty/" | |
187 | (basename source-dir)) _ quote) | |
188 | (string-append "#include " quote | |
189 | (basename source-dir))) | |
190 | ...)))))) | |
191 | (unbundle ("2geom" "src/2geom" #t) | |
192 | ;; libcroco cannot be unbundled as it is heavily | |
193 | ;; modified (see: | |
194 | ;; https://gitlab.com/inkscape/inkscape/issues/876#note_276114904). | |
195 | ;; ("croco" "src/3rdparty/libcroco" #t) | |
196 | ;; FIXME: Unbundle the following libraries once they | |
197 | ;; have been packaged. | |
198 | ;; ("cola" "src/3rdparty/adaptagrams/libcola") | |
199 | ;; ("avoid" "src/3rdparty/adaptagrams/libavoid") | |
200 | ;; ("vpsc" "src/3rdparty/adaptagrams/libvpsc") | |
201 | ;; libuemf cannot be unbundled as it slightly modified | |
202 | ;; from upstream (see: | |
203 | ;; https://gitlab.com/inkscape/inkscape/issues/973). | |
204 | ;; ("uemf" "src/3rdparty/libuemf" #f) | |
205 | ;; FIXME: libdepixelize upstream is ancient and doesn't | |
206 | ;; build with a recent lib2geom | |
207 | ;; (see: https://bugs.launchpad.net/libdepixelize/+bug/1862458). | |
208 | ;;("depixelize" "src/3rdparty/libdepixelize") | |
209 | ("autotrace" "src/3rdparty/autotrace" #t))) | |
210 | ;; Lift the requirement on the double-conversion library, as | |
211 | ;; it is only needed by lib2geom, which is now unbundled. | |
212 | (substitute* "CMakeScripts/DefineDependsandFlags.cmake" | |
213 | ((".*find_package\\(DoubleConversion.*") "")) | |
214 | #t)))) | |
215 | (build-system cmake-build-system) | |
216 | (arguments | |
217 | `(#:tests? #t | |
218 | #:test-target "check" ;otherwise some test binaries are missing | |
1afa2c5c MC |
219 | #:imported-modules (,@%cmake-build-system-modules |
220 | (guix build glib-or-gtk-build-system)) | |
221 | #:modules ((guix build cmake-build-system) | |
222 | ((guix build glib-or-gtk-build-system) #:prefix glib-or-gtk:) | |
223 | (guix build utils)) | |
ff8a1a88 MC |
224 | #:phases |
225 | (modify-phases %standard-phases | |
226 | (add-after 'unpack 'patch-icon-cache-generator | |
227 | (lambda _ | |
228 | (substitute* "share/icons/application/CMakeLists.txt" | |
229 | (("gtk-update-icon-cache") "true")) | |
230 | #t)) | |
231 | (add-after 'unpack 'disable-latex-export-tests | |
232 | ;; FIXME: For some reason the test.pdf_tex file generated by the | |
233 | ;; "--export-latex" lacks "some text" in its content when run in | |
234 | ;; the build environment. Skip the related tests. | |
235 | (lambda _ | |
236 | (substitute* "testfiles/cli_tests/CMakeLists.txt" | |
237 | (("add_cli_test\\(export-latex") | |
238 | "message(TEST_DISABLED: export-latex")) | |
239 | #t)) | |
240 | (add-after 'unpack 'set-home | |
241 | ;; Mute Inkscape warnings during tests. | |
242 | (lambda _ | |
243 | (setenv "HOME" (getcwd)) | |
244 | (format #t "ARGS is set to: ~a" (getenv "ARGS")) | |
245 | #t)) | |
246 | ;; Move the check phase after the install phase, as when run in the | |
247 | ;; tests, Inkscape relies on files that are not yet installed, such | |
248 | ;; as the "share/inkscape/ui/units.xml" file. | |
249 | (delete 'check) | |
250 | (add-after 'install 'check | |
1afa2c5c MC |
251 | (assoc-ref %standard-phases 'check)) |
252 | (add-after 'install 'glib-or-gtk-compile-schemas | |
253 | (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-compile-schemas)) | |
254 | (add-after 'glib-or-gtk-compile-schemas 'glib-or-gtk-wrap | |
24b233d4 EZ |
255 | (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-wrap)) |
256 | (add-after 'install 'wrap-program | |
257 | ;; Ensure Python is available at runtime. | |
258 | (lambda* (#:key outputs #:allow-other-keys) | |
259 | (let ((out (assoc-ref outputs "out"))) | |
260 | (wrap-program (string-append out "/bin/inkscape") | |
261 | `("PYTHONPATH" ":" prefix (,(getenv "PYTHONPATH"))))) | |
262 | #t))))) | |
ff8a1a88 MC |
263 | (inputs |
264 | `(("aspell" ,aspell) | |
265 | ("autotrace" ,autotrace) | |
266 | ("gdl" ,gdl-minimal) | |
267 | ("gtkmm" ,gtkmm) | |
268 | ("gtk" ,gtk+) | |
269 | ("gtkspell3" ,gtkspell3) | |
270 | ("gsl" ,gsl) | |
271 | ("poppler" ,poppler) | |
272 | ("lib2geom" ,lib2geom) | |
273 | ("libjpeg" ,libjpeg-turbo) | |
274 | ("libpng" ,libpng) | |
275 | ("libxml2" ,libxml2) | |
276 | ("libxslt" ,libxslt) | |
277 | ("libgc" ,libgc) | |
278 | ("libsoup" ,libsoup-minimal) | |
279 | ("libcdr" ,libcdr) | |
280 | ("libvisio" ,libvisio) | |
281 | ("libwpd" ,libwpd) | |
282 | ("libwpg" ,libwpg) | |
283 | ("freetype" ,freetype) | |
284 | ("popt" ,popt) | |
285 | ("potrace" ,potrace) | |
286 | ("lcms" ,lcms) | |
24b233d4 EZ |
287 | ("boost" ,boost) |
288 | ("python" ,python-wrapper) | |
289 | ("python-scour" ,python-scour) | |
290 | ("python-pyserial" ,python-pyserial) | |
291 | ("python-numpy" ,python-numpy) | |
292 | ("python-lxml" ,python-lxml))) | |
ff8a1a88 MC |
293 | (native-inputs |
294 | `(("imagemagick" ,imagemagick) ;for tests | |
295 | ("intltool" ,intltool) | |
296 | ("glib" ,glib "bin") | |
297 | ("googletest" ,googletest) | |
298 | ("perl" ,perl) | |
24b233d4 | 299 | ("pkg-config" ,pkg-config))) |
ff8a1a88 MC |
300 | (home-page "https://inkscape.org/") |
301 | (synopsis "Vector graphics editor") | |
302 | (description "Inkscape is a vector graphics editor. What sets Inkscape | |
303 | apart is its use of Scalable Vector Graphics (SVG), an XML-based W3C standard, | |
304 | as the native format.") | |
305 | (license license:gpl3+))) ;see the file COPYING |