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