| 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 | (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 | |
| 67 | |
| 68 | |
| 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 | |
| 91 | |
| 92 | |
| 93 | ((unbundle
|
| 94 | (syntax-rules ()
|
| 95 | ((_ (name source-dir use-pkg-config?) ...)
|
| 96 | (begin
|
| 97 | |
| 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 | |
| 105 | (substitute* "src/CMakeLists.txt"
|
| 106 | (((string-append name "_LIB.*")) "") ...)
|
| 107 | |
| 108 | |
| 109 | |
| 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 "
|
| 120 | find_path(~a_INCLUDE_DIR NAMES ~:*~a/~:*~a.h ~:*~a.h)
|
| 121 | if(NOT ~:*~a_INCLUDE_DIR)
|
| 122 | message(FATAL_ERROR \"~:*~a headers not found\")
|
| 123 | else()
|
| 124 | list(APPEND INKSCAPE_INCS_SYS ${~:*~a_INCLUDE_DIR})
|
| 125 | endif()
|
| 126 |
|
| 127 | find_library(~:*~a_LIB NAMES ~:*~a)
|
| 128 | if(NOT ~:*~a_LIB)
|
| 129 | message(FATAL_ERROR \"~:*~a library not found\")
|
| 130 | else()
|
| 131 | list(APPEND INKSCAPE_LIBS ~:*~a_LIB)
|
| 132 | endif()~%~%"
|
| 133 | name)
|
| 134 | start)))) ...
|
| 135 | |
| 136 | |
| 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 | |
| 145 | |
| 146 | |
| 147 | |
| 148 | |
| 149 | |
| 150 | |
| 151 | |
| 152 | |
| 153 | |
| 154 | |
| 155 | |
| 156 | |
| 157 | |
| 158 | |
| 159 | |
| 160 | |
| 161 | ("autotrace" "src/3rdparty/autotrace" #t)))
|
| 162 | |
| 163 | |
| 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 | |
| 177 | |
| 178 | #:configure-flags
|
| 179 | #~(list "-DWITH_IMAGE_MAGICK=OFF"
|
| 180 | |
| 181 | |
| 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 | |
| 196 | (substitute* "testfiles/CMakeLists.txt"
|
| 197 | (("lpe64-test") "#lpe64-test")
|
| 198 | ((" lpe-test") " #lpe-test")
|
| 199 | (("add_subdirectory\\(lpe_tests\\)") "")
|
| 200 | |
| 201 | |
| 202 | |
| 203 | ((" geom-pathstroke-test") ""))
|
| 204 | |
| 205 | |
| 206 | (substitute* "testfiles/rendering_tests/CMakeLists.txt"
|
| 207 | (("add_rendering_test\\(test-use" all)
|
| 208 | (string-append "#" all)))
|
| 209 | |
| 210 | |
| 211 | (substitute* "testfiles/cli_tests/CMakeLists.txt"
|
| 212 | (("add_cli_test\\(export-png-color-mode-gray-8_png" all)
|
| 213 | (string-append "#" all))
|
| 214 | |
| 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 | |
| 223 | (substitute* "testfiles/src/visual-bounds-test.cpp"
|
| 224 | (("%lu") "%u")))))
|
| 225 | '())
|
| 226 | (add-after 'unpack 'disable-svg-parser-test
|
| 227 | (lambda _
|
| 228 | |
| 229 | |
| 230 | |
| 231 | (substitute* "testfiles/CMakeLists.txt"
|
| 232 | ((" svg-path-parser-test")
|
| 233 | " #svg-path-parser-test"))))
|
| 234 | (add-after 'unpack 'set-home
|
| 235 | |
| 236 | (lambda _
|
| 237 | (setenv "HOME" (getcwd))))
|
| 238 | |
| 239 | |
| 240 | |
| 241 | (delete 'check)
|
| 242 | (add-after 'install 'check
|
| 243 | |
| 244 | |
| 245 | (lambda* (#:key parallel-tests? tests? #:allow-other-keys)
|
| 246 | (when tests?
|
| 247 | |
| 248 | |
| 249 | |
| 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 | |
| 265 | |
| 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 | |
| 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 | |
| 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 | |
| 298 | |
| 299 | `("GDK_PIXBUF_MODULE_FILE" =
|
| 300 | (,(getenv "GDK_PIXBUF_MODULE_FILE")))
|
| 301 | |
| 302 | `("GI_TYPELIB_PATH" ":" prefix
|
| 303 | (,(getenv "GI_TYPELIB_PATH")))))))))
|
| 304 | (inputs
|
| 305 | (list (librsvg-for-system) |
| 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 | |
| 331 | |
| 332 | |
| 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 |
| 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
|
| 354 | apart is its use of Scalable Vector Graphics (SVG), an XML-based W3C standard,
|
| 355 | as the native format.")
|
| 356 | (license license:gpl3+)))) |
| 357 |
|
| 358 | (define-deprecated/public-alias inkscape/stable inkscape/pinned)
|
| 359 |
|
| 360 | |
| 361 | |
| 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 | |
| 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 | #~() |
| 383 | |
| 384 | |
| 385 | #~((replace 'check (assoc-ref gnu:%standard-phases 'check))))
|
| 386 | |
| 387 | (delete 'disable-svg-parser-test)
|
| 388 | (replace 'wrap-program
|
| 389 | |
| 390 | (lambda _
|
| 391 | (wrap-program (string-append #$output "/bin/inkscape")
|
| 392 | `("GUIX_PYTHONPATH" prefix
|
| 393 | (,(getenv "GUIX_PYTHONPATH")))
|
| 394 | |
| 395 | |
| 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 |
| 401 | gtksourceview-4
|
| 402 | python-tinycss2)))
|
| 403 | (native-inputs
|
| 404 | (modify-inputs (package-native-inputs inkscape/pinned)
|
| 405 | |
| 406 | (replace "imagemagick" imagemagick)))
|
| 407 | (properties (alist-delete 'hidden? (package-properties inkscape/pinned)))))
|