projects/guix·blob java-team · refs

407 lines · 20.1 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2014 John Darrington <[email protected]>
3;;; Copyright © 2014, 2016 Mark H Weaver <[email protected]>
4;;; Copyright © 2016, 2018, 2024 Ricardo Wurmus <[email protected]>
5;;; Copyright © 2017, 2020 Marius Bakke <[email protected]>
6;;; Copyright © 2018 Tobias Geerinckx-Rice <[email protected]>
7;;; Copyright © 2020, 2021, 2022, 2024 Maxim Cournoyer <[email protected]>
8;;; Copyright © 2020 Boris A. Dekshteyn <[email protected]>
9;;; Copyright © 2020 Ekaitz Zarraga <[email protected]>
10;;; Copyright © 2023, 2024 Efraim Flashner <[email protected]>
11;;; Copyright © 2025 John Kehayias <[email protected]>
12;;; Copyright © 2026 Konstantin Suntsov <[email protected]>
13;;; Copyright © 2026 Rodion Goritskov <[email protected]>
14;;;
15;;; This file is part of GNU Guix.
16;;;
17;;; GNU Guix is free software; you can redistribute it and/or modify it
18;;; under the terms of the GNU General Public License as published by
19;;; the Free Software Foundation; either version 3 of the License, or (at
20;;; your option) any later version.
21;;;
22;;; GNU Guix is distributed in the hope that it will be useful, but
23;;; WITHOUT ANY WARRANTY; without even the implied warranty of
24;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25;;; GNU General Public License for more details.
26;;;
27;;; You should have received a copy of the GNU General Public License
28;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
29
30(define-module (gnu packages inkscape)
31 #:use-module ((guix licenses) #:prefix license:)
32 #:use-module (guix packages)
33 #:use-module (guix download)
34 #:use-module (guix gexp)
35 #:use-module (guix utils)
36 #:use-module (guix deprecation)
37 #:use-module (guix build-system cmake)
38 #:use-module (gnu packages)
39 #:use-module (gnu packages algebra)
40 #:use-module (gnu packages bash)
41 #:use-module (gnu packages bdw-gc)
42 #:use-module (gnu packages boost)
43 #:use-module (gnu packages check)
44 #:use-module (gnu packages gettext)
45 #:use-module (gnu packages glib)
46 #:use-module (gnu packages gnome)
47 #:use-module (gnu packages graphics)
48 #:use-module (gnu packages gtk)
49 #:use-module (gnu packages imagemagick)
50 #:use-module (gnu packages libreoffice)
51 #:use-module (gnu packages maths)
52 #:use-module (gnu packages perl)
53 #:use-module (gnu packages pdf)
54 #:use-module (gnu packages popt)
55 #:use-module (gnu packages python)
56 #:use-module (gnu packages python-web)
57 #:use-module (gnu packages python-xyz)
58 #:use-module (gnu packages readline)
59 #:use-module (gnu packages xml)
60 #:use-module (gnu packages ghostscript)
61 #:use-module (gnu packages fontutils)
62 #:use-module (gnu packages image)
63 #:use-module (gnu packages pkg-config)
64 #:use-module (srfi srfi-1))
65
66;;; A variant of Inkscape intended to be bumped only on core-updates, to avoid
67;;; rebuilding 2k+ packages through dblatex. It should only be used as a
68;;; native-input since it might not receive timely security updates.
69(define-public inkscape/pinned
70 (hidden-package
71 (package
72 (name "inkscape")
73 (version "1.4.4")
74 (source
75 (origin
76 (method url-fetch)
77 (uri (string-append "https://media.inkscape.org/dl/"
78 "resources/file/"
79 "inkscape-" version ".tar.xz"))
80 (sha256
81 (base32 "0vl5p2rxki7lcgf7k8x6p6m0lw30n1g6cv7ibhd8g2z0l59mgkmv"))
82 (modules '((guix build utils)
83 (ice-9 format)))
84 (patches (search-patches "inkscape-poppler-26-1.patch"
85 "inkscape-poppler-26-2.patch"
86 "inkscape-poppler-26-3.patch"))
87 (snippet
88 '(begin
89 (let-syntax
90 ;; XXX: The build system doesn't currently support using
91 ;; system libraries over bundled ones (see:
92 ;; https://gitlab.com/inkscape/inkscape/issues/876).
93 ((unbundle
94 (syntax-rules ()
95 ((_ (name source-dir use-pkg-config?) ...)
96 (begin
97 ;; Delete bundled source directories.
98 (delete-file-recursively source-dir) ...
99 (substitute* '("src/CMakeLists.txt"
100 "src/3rdparty/CMakeLists.txt")
101 (((string-append ".*add_subdirectory\\("
102 (basename source-dir) "\\).*"))
103 "") ...)
104 ;; Remove bundled entries from INKSCAPE_TARGET_LIBS.
105 (substitute* "src/CMakeLists.txt"
106 (((string-append name "_LIB.*")) "") ...)
107 ;; Register the external libraries, so that their
108 ;; headers are added to INKSCAPE_INCS_SYS and their
109 ;; shared libraries added to INKSCAPE_LIBS.
110 (if use-pkg-config?
111 (let* ((width (string-length "pkg_check_modules("))
112 (indent (string-join (make-list width " ") "")))
113 (substitute* "CMakeScripts/DefineDependsandFlags.cmake"
114 (("^pkg_check_modules\\(INKSCAPE_DEP REQUIRED.*" start)
115 (string-append start
116 (format #f "~a~a~%" indent name)))))
117 (substitute* "CMakeScripts/DefineDependsandFlags.cmake"
118 (("^find_package\\(Iconv REQUIRED\\).*" start)
119 (string-append (format #f "
120find_path(~a_INCLUDE_DIR NAMES ~:*~a/~:*~a.h ~:*~a.h)
121if(NOT ~:*~a_INCLUDE_DIR)
122 message(FATAL_ERROR \"~:*~a headers not found\")
123else()
124 list(APPEND INKSCAPE_INCS_SYS ${~:*~a_INCLUDE_DIR})
125endif()
126
127find_library(~:*~a_LIB NAMES ~:*~a)
128if(NOT ~:*~a_LIB)
129 message(FATAL_ERROR \"~:*~a library not found\")
130else()
131 list(APPEND INKSCAPE_LIBS ~:*~a_LIB)
132endif()~%~%"
133 name)
134 start)))) ...
135 ;; Fix the references to the headers of the
136 ;; unbundled libraries.
137 (substitute* (find-files "." "\\.h$|\\.cpp$")
138 (((string-append "#include (\"|<)3rdparty/"
139 (basename source-dir)) _ quote)
140 (string-append "#include " quote
141 (basename source-dir)))
142 ...))))))
143 (unbundle ("2geom" "src/3rdparty/2geom" #t)
144 ;; libcroco cannot be unbundled as it is heavily
145 ;; modified (see:
146 ;; https://gitlab.com/inkscape/inkscape/issues/876#note_276114904).
147 ;; ("croco" "src/3rdparty/libcroco" #t)
148 ;; FIXME: Unbundle the following libraries once they
149 ;; have been packaged.
150 ;; ("cola" "src/3rdparty/adaptagrams/libcola")
151 ;; ("avoid" "src/3rdparty/adaptagrams/libavoid")
152 ;; ("vpsc" "src/3rdparty/adaptagrams/libvpsc")
153 ;; libuemf cannot be unbundled as it slightly modified
154 ;; from upstream (see:
155 ;; https://gitlab.com/inkscape/inkscape/issues/973).
156 ;; ("uemf" "src/3rdparty/libuemf" #f)
157 ;; FIXME: libdepixelize upstream is ancient and doesn't
158 ;; build with a recent lib2geom
159 ;; (see: https://bugs.launchpad.net/libdepixelize/+bug/1862458).
160 ;;("depixelize" "src/3rdparty/libdepixelize")
161 ("autotrace" "src/3rdparty/autotrace" #t)))
162 ;; Lift the requirement on the double-conversion library, as
163 ;; it is only needed by lib2geom, which is now unbundled.
164 (substitute* "CMakeScripts/DefineDependsandFlags.cmake"
165 ((".*find_package\\(DoubleConversion.*") ""))))))
166 (build-system cmake-build-system)
167 (arguments
168 (list
169 #:disallowed-references (list (this-package-native-input "imagemagick"))
170
171 #:imported-modules `(,@%cmake-build-system-modules
172 (guix build glib-or-gtk-build-system))
173 #:modules '((guix build cmake-build-system)
174 ((guix build glib-or-gtk-build-system) #:prefix glib-or-gtk:)
175 (guix build utils))
176 ;; Disable imagemagick support in the stable variant, to reduce the
177 ;; number of dependents of the 'imagemagick' package.
178 #:configure-flags
179 #~(list "-DWITH_IMAGE_MAGICK=OFF"
180 ;; TODO: Remove after next release, since the problematic
181 ;; libsoup/soup.h include is no longer used.
182 (string-append "-DCMAKE_CXX_FLAGS=-I"
183 (search-input-directory %build-inputs
184 "/include/libsoup-2.4")))
185 #:phases
186 #~(modify-phases %standard-phases
187 (add-after 'unpack 'generate-gdk-pixbuf-loaders-cache-file
188 (assoc-ref glib-or-gtk:%standard-phases
189 'generate-gdk-pixbuf-loaders-cache-file))
190 #$@(if (or (target-aarch64?)
191 (target-ppc64le?)
192 (target-riscv64?))
193 '((add-after 'unpack 'disable-more-tests
194 (lambda _
195 ;; https://gitlab.com/inkscape/inkscape/-/issues/3554#note_1035680690
196 (substitute* "testfiles/CMakeLists.txt"
197 (("lpe64-test") "#lpe64-test")
198 ((" lpe-test") " #lpe-test")
199 (("add_subdirectory\\(lpe_tests\\)") "")
200 ;; Fails on non-x86_64 architectures due to floating
201 ;; point precision differences (see:
202 ;; https://gitlab.com/inkscape/lib2geom/-/work_items/80).
203 ((" geom-pathstroke-test") ""))
204 ;; https://gitlab.com/inkscape/inkscape/-/issues/3554#note_1035539888
205 ;; According to upstream, this is a false positive.
206 (substitute* "testfiles/rendering_tests/CMakeLists.txt"
207 (("add_rendering_test\\(test-use" all)
208 (string-append "#" all)))
209 ;; https://gitlab.com/inkscape/inkscape/-/issues/3554#note_1035539888
210 ;; Allegedly a precision error in the gamma.
211 (substitute* "testfiles/cli_tests/CMakeLists.txt"
212 (("add_cli_test\\(export-png-color-mode-gray-8_png" all)
213 (string-append "#" all))
214 ;; These also seem to be failing due to precision errors.
215 (("add_pdfinput_test\\(font-(spacing|style) 1 draw-all" all)
216 (string-append "#" all))))))
217 '())
218 #$@(if (or (target-x86-32?)
219 (target-arm32?))
220 '((add-after 'unpack 'fix-32bit-size_t-format
221 (lambda _
222 ;; Fix an error due to format type mismatch with 32-bit size_t.
223 (substitute* "testfiles/src/visual-bounds-test.cpp"
224 (("%lu") "%u")))))
225 '())
226 (add-after 'unpack 'disable-svg-parser-test
227 (lambda _
228 ;; Fail because without gtksourceview in deps
229 ;; SvgPathParser::prettify_svgd is not available
230 ;; for tests
231 (substitute* "testfiles/CMakeLists.txt"
232 ((" svg-path-parser-test")
233 " #svg-path-parser-test"))))
234 (add-after 'unpack 'set-home
235 ;; Mute Inkscape warnings during tests.
236 (lambda _
237 (setenv "HOME" (getcwd))))
238 ;; Move the check phase after the install phase, as when run in the
239 ;; tests, Inkscape relies on files that are not yet installed, such
240 ;; as the "share/inkscape/ui/units.xml" file.
241 (delete 'check)
242 (add-after 'install 'check
243 ;; Use ctest directly so that we can easily exclude problematic
244 ;; tests.
245 (lambda* (#:key parallel-tests? tests? #:allow-other-keys)
246 (when tests?
247 ;; The following tests fails, perhaps due to building without
248 ;; ImageMagick (see:
249 ;; https://gitlab.com/inkscape/inbox/-/issues/10005).
250 (let ((job-count (if parallel-tests?
251 (number->string (parallel-job-count))
252 "1"))
253 (skipped-tests
254 (list "cli_export-type-caseinsensitive_check_output"
255 "cli_export-type_xaml_check_output"
256 "cli_export-height_export-use-hints_check_output"
257 "cli_export-plain-svg_check_output"
258 "cli_export-use-hints_export-id_check_output"
259 "cli_export-extension_svg_check_output"
260 "cli_export-extension_ps_check_output"
261 "cli_export-extension_eps_check_output"
262 "cli_export-extension_pdf_check_output"
263 "cli_export-plain-extension-svg_check_output"
264 ;; These fail non-deterministically (see:
265 ;; https://gitlab.com/inkscape/inbox/-/issues/10005).
266 "cli_export-ps-level_3_check_output"
267 "cli_export-ps-level_3_content_check_output"
268 "cli_export-ps-level_2_content_check_output"
269 "cli_export-ps-level_2_check_output"
270 ;; These fail on i686 but not x86-64
271 #$@(if (target-x86-32?)
272 '("cli_actions-path-simplify_check_output"
273 "cli_pdfinput-font-spacing_check_output"
274 "cli_pdfinput-font-style_check_output"
275 "cli_pdfinput-latex_check_output"
276 "cli_pdfinput-multi-page-sample_check_output"
277 "test_lpe"
278 "test_geom-pathstroke")
279 '()))))
280 (invoke "make" "-j" job-count "tests")
281 (invoke "ctest" "-j" job-count
282 "--output-on-failure"
283 "-E" (string-append
284 "(" (string-join skipped-tests "|") ")"))))))
285 (add-after 'install 'glib-or-gtk-compile-schemas
286 (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-compile-schemas))
287 (add-after 'glib-or-gtk-compile-schemas 'glib-or-gtk-wrap
288 (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-wrap))
289 (add-after 'install 'wrap-program
290 ;; Ensure Python is available at runtime.
291 (lambda* (#:key inputs #:allow-other-keys)
292 (wrap-program (string-append #$output "/bin/inkscape")
293 `("PATH" prefix
294 (,(dirname (search-input-file inputs "bin/python"))))
295 `("GUIX_PYTHONPATH" prefix
296 (,(getenv "GUIX_PYTHONPATH")))
297 ;; Wrapping GDK_PIXBUF_MODULE_FILE allows Inkscape to load
298 ;; its own icons in pure environments.
299 `("GDK_PIXBUF_MODULE_FILE" =
300 (,(getenv "GDK_PIXBUF_MODULE_FILE")))
301 ;; Ensure GObject Introspection typelibs are found.
302 `("GI_TYPELIB_PATH" ":" prefix
303 (,(getenv "GI_TYPELIB_PATH")))))))))
304 (inputs
305 (list (librsvg-for-system) ;for the pixbuf loader
306 autotrace
307 bash-minimal
308 boost
309 freetype
310 gdl-minimal
311 gsl
312 gspell
313 gtk+
314 gtkmm-3
315 lcms
316 lib2geom/pinned
317 libcdr
318 libgc
319 libjpeg-turbo
320 libpng
321 libsoup-minimal-2
322 libvisio
323 libwpd
324 libwpg
325 libxml2
326 libxslt
327 poppler
328 popt
329 potrace
330 ;; These Python dependencies are used by the Inkscape extension
331 ;; management system. To verify that it is working, visit the
332 ;; Extensions -> Manage Extensions... menu.
333 python-appdirs
334 python-cssselect
335 python-lxml
336 python-numpy
337 python-pygobject
338 python-pyserial
339 python-requests
340 python-scour
341 python-wrapper
342 readline))
343 (native-inputs
344 (list `(,glib "bin")
345 bc
346 gettext-minimal
347 googletest
348 imagemagick/stable ;for tests
349 perl
350 pkg-config))
351 (home-page "https://inkscape.org/")
352 (synopsis "Vector graphics editor")
353 (description "Inkscape is a vector graphics editor. What sets Inkscape
354apart is its use of Scalable Vector Graphics (SVG), an XML-based W3C standard,
355as the native format.")
356 (license license:gpl3+)))) ;see the file COPYING
357
358(define-deprecated/public-alias inkscape/stable inkscape/pinned)
359
360;;; The Inkscape release year used in the about dialog. Please keep it sync
361;;; when updating the package!
362(define %inkscape-release-year 2026)
363(define-public inkscape
364 (package
365 (inherit inkscape/pinned)
366 (arguments
367 (substitute-keyword-arguments (package-arguments inkscape/pinned)
368 ((#:modules modules)
369 (append '(((guix build gnu-build-system) #:prefix gnu:)) modules))
370 ((#:configure-flags flags ''())
371 ;; Enable ImageMagick support.
372 #~(delete "-DWITH_IMAGE_MAGICK=OFF" #$flags))
373 ((#:phases phases)
374 #~(modify-phases #$phases
375 (add-after 'unpack 'patch-inkscape-build-year
376 (lambda _
377 (substitute* "CMakeScripts/inkscape-version.cmake"
378 (("string\\(TIMESTAMP INKSCAPE_BUILD_YEAR.*")
379 (format #f "set(INKSCAPE_BUILD_YEAR ~a)~%"
380 #$%inkscape-release-year)))))
381 #$@(if (target-x86-32?)
382 #~() ;XXX: there are remaining failures on i686
383 ;; Re-instate the tests disabled in inkscape/pinned, now that
384 ;; their ImageMagick requirement is satisfied.
385 #~((replace 'check (assoc-ref gnu:%standard-phases 'check))))
386 ;; We now have gtksourceview in deps, so test should pass
387 (delete 'disable-svg-parser-test)
388 (replace 'wrap-program
389 ;; Ensure Python is available at runtime.
390 (lambda _
391 (wrap-program (string-append #$output "/bin/inkscape")
392 `("GUIX_PYTHONPATH" prefix
393 (,(getenv "GUIX_PYTHONPATH")))
394 ;; Wrapping GDK_PIXBUF_MODULE_FILE allows Inkscape to load
395 ;; its own icons in pure environments.
396 `("GDK_PIXBUF_MODULE_FILE" =
397 (,(getenv "GDK_PIXBUF_MODULE_FILE"))))))))))
398 (inputs (modify-inputs (package-inputs inkscape/pinned)
399 (replace "lib2geom" lib2geom)
400 (append imagemagick ;for libMagickCore and libMagickWand
401 gtksourceview-4
402 python-tinycss2)))
403 (native-inputs
404 (modify-inputs (package-native-inputs inkscape/pinned)
405 ;; Only use 1 imagemagick across the package build.
406 (replace "imagemagick" imagemagick)))
407 (properties (alist-delete 'hidden? (package-properties inkscape/pinned)))))