Subject: [bug#68813] [core-updates PATCH 17/20] gnu: inkscape: Update to 1.3.2.

From: Maxim Cournoyer <[email-masked]>
Date: Thu, 22 Feb 2024 11:10:16 -0500

* gnu/packages/inkscape.scm (inkscape/stable): Update to 1.3.2.  Remove
patches.
[configure-flags]: Add CMAKE_CXX_FLAGS flag.
[phases] Remove obsolete patch-icon-cache-generator,
disable-latex-export-tests and disable-vertical-glyph-tests phases.  Add
disable-problematic-tests phase.  Override check phase to disable a few test
failures caused by the lack of imagemagick.
[inputs]: Add gspell and readline.  Remove aspell and gtkspell3.
(inkscape): Update to 1.3.2.
[phases]: Reset the check phase to the original.
* gnu/packages/patches/inkscape-poppler-compat.patch: Delete file.
* gnu/local.mk (dist_patch_DATA): De-register it.

Change-Id: I391fb42db8d93a9cdc83e6fd62ca90f7458b5c49
---

 gnu/local.mk                                  |  1 -
 gnu/packages/inkscape.scm                     | 94 +++++++++++--------
 .../patches/inkscape-poppler-compat.patch     | 45 ---------
 3 files changed, 55 insertions(+), 85 deletions(-)
 delete mode 100644 gnu/packages/patches/inkscape-poppler-compat.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 94b4620c02..28dd075f37 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1475,7 +1475,6 @@ dist_patch_DATA =						\
   %D%/packages/patches/idris-test-ffi008.patch			\
   %D%/packages/patches/igraph-fix-varargs-integer-size.patch	\
   %D%/packages/patches/ilmbase-fix-tests.patch			\
-  %D%/packages/patches/inkscape-poppler-compat.patch		\
   %D%/packages/patches/instead-use-games-path.patch		\
   %D%/packages/patches/intltool-perl-compatibility.patch	\
   %D%/packages/patches/irrlicht-use-system-libs.patch		\
diff --git a/gnu/packages/inkscape.scm b/gnu/packages/inkscape.scm
index db871dc904..1e674add9e 100644
--- a/gnu/packages/inkscape.scm
+++ b/gnu/packages/inkscape.scm
@@ -32,7 +32,7 @@ (define-module (gnu packages inkscape)
   #:use-module (guix utils)
   #:use-module (guix build-system cmake)
   #:use-module (gnu packages)
-  #:use-module (gnu packages aspell)
+  #:use-module (gnu packages algebra)
   #:use-module (gnu packages bash)
   #:use-module (gnu packages bdw-gc)
   #:use-module (gnu packages boost)
@@ -51,6 +51,7 @@ (define-module (gnu packages inkscape)
   #:use-module (gnu packages python)
   #:use-module (gnu packages python-web)
   #:use-module (gnu packages python-xyz)
+  #:use-module (gnu packages readline)
   #:use-module (gnu packages xml)
   #:use-module (gnu packages ghostscript)
   #:use-module (gnu packages fontutils)
@@ -65,16 +66,15 @@ (define-public inkscape/stable
   (hidden-package
    (package
      (name "inkscape")
-     (version "1.2.1")
+     (version "1.3.2")
      (source
       (origin
         (method url-fetch)
         (uri (string-append "https://media.inkscape.org/dl/"
                             "resources/file/"
                             "inkscape-" version ".tar.xz"))
-        (patches (search-patches "inkscape-poppler-compat.patch"))
         (sha256
-         (base32 "06scilds4p4bw337ss22nfdxy2kynv5yjw6vq6nlpjm7xfh7vkj6"))
+         (base32 "0sq81smxwypgnp7r3wgza8w25dsz9qa8ga79sc85xzj3qi6q9lfv"))
         (modules '((guix build utils)
                    (ice-9 format)))
         (snippet
@@ -168,38 +168,18 @@ (define-public inkscape/stable
                    (guix build utils))
        ;; Disable imagemagick support in the stable variant, to reduce the
        ;; number of dependents of the 'imagemagick' package.
-       #:configure-flags #~(list "-DWITH_IMAGE_MAGICK=OFF")
+       #:configure-flags
+       #~(list "-DWITH_IMAGE_MAGICK=OFF"
+               ;; TODO: Remove after next release, since the problematic
+               ;; libsoup/soup.h include is no longer used.
+               (string-append "-DCMAKE_CXX_FLAGS=-I"
+                              (search-input-directory %build-inputs
+                                                      "/include/libsoup-2.4")))
        #:phases
        #~(modify-phases %standard-phases
            (add-after 'unpack 'generate-gdk-pixbuf-loaders-cache-file
              (assoc-ref glib-or-gtk:%standard-phases
                         'generate-gdk-pixbuf-loaders-cache-file))
-           (add-after 'unpack 'patch-icon-cache-generator
-             (lambda _
-               (substitute* "share/icons/application/CMakeLists.txt"
-                 (("gtk-update-icon-cache") "true"))))
-           (add-after 'unpack 'disable-latex-export-tests
-             ;; FIXME: For some reason the test.pdf_tex file generated by the
-             ;; "--export-latex" lacks "some text" in its content when run in
-             ;; the build environment.  Skip the related tests.
-             (lambda _
-               (substitute* "testfiles/cli_tests/CMakeLists.txt"
-                 (("add_cli_test\\(export-latex")
-                  "message(TEST_DISABLED: export-latex"))))
-           (add-after 'unpack 'disable-vertical-glyph-tests
-             (lambda _
-               ;; FIXME: These tests fail with newer Pango and Harfbuzz:
-               ;;   https://gitlab.com/inkscape/inkscape/-/issues/2917
-               ;;   https://gitlab.com/inkscape/inkscape/-/issues/3554
-               ;; Simply providing older versions don't work, as we need
-               ;; the full GTK stack; we could use package-input-rewriting
-               ;; but then have to also downgrade pangomm and disable tests
-               ;; in librsvg and GTK+.  Just ignore for now.
-               (substitute* "testfiles/rendering_tests/CMakeLists.txt"
-                 (("test-glyph-y-pos") "")
-                 (("text-glyphs-combining") "")
-                 (("text-glyphs-vertical") "")
-                 (("test-rtl-vertical") ""))))
            #$@(if (or (target-aarch64?)
                       (target-ppc64le?)
                       (target-riscv64?))
@@ -227,7 +207,38 @@ (define-public inkscape/stable
            ;; as the "share/inkscape/ui/units.xml" file.
            (delete 'check)
            (add-after 'install 'check
-             (assoc-ref %standard-phases 'check))
+             ;; Use ctest directly so that we can easily exclude problematic
+             ;; tests.
+             (lambda* (#:key parallel-tests? tests? #:allow-other-keys)
+               (when tests?
+                 ;; The following tests fails, perhaps due to building without
+                 ;; ImageMagick (see:
+                 ;; https://gitlab.com/inkscape/inbox/-/issues/10005).
+                 (let ((job-count (if parallel-tests?
+                                      (number->string (parallel-job-count))
+                                      "1"))
+                       (skipped-tests
+                        (list "cli_export-type-caseinsensitive_check_output"
+                              "cli_export-type_xaml_check_output"
+                              "cli_export-height_export-use-hints_check_output"
+                              "cli_export-plain-svg_check_output"
+                              "cli_export-use-hints_export-id_check_output"
+                              "cli_export-extension_svg_check_output"
+                              "cli_export-extension_ps_check_output"
+                              "cli_export-extension_eps_check_output"
+                              "cli_export-extension_pdf_check_output"
+                              "cli_export-plain-extension-svg_check_output"
+                              ;; These fail non-deterministically (see:
+                              ;; https://gitlab.com/inkscape/inbox/-/issues/10005).
+                              "cli_export-ps-level_3_check_output"
+                              "cli_export-ps-level_3_content_check_output"
+                              "cli_export-ps-level_2_content_check_output"
+                              "cli_export-ps-level_2_check_output")))
+                   (invoke "make" "-j" job-count "tests")
+                   (invoke "ctest" "-j" job-count
+                           "--output-on-error"
+                           "-E" (string-append
+                                 "(" (string-join skipped-tests "|") ")"))))))
            (add-after 'install 'glib-or-gtk-compile-schemas
              (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-compile-schemas))
            (add-after 'glib-or-gtk-compile-schemas 'glib-or-gtk-wrap
@@ -243,14 +254,13 @@ (define-public inkscape/stable
                  `("GDK_PIXBUF_MODULE_FILE" =
                    (,(getenv "GDK_PIXBUF_MODULE_FILE")))))))))
      (inputs
-      (list aspell
-            autotrace
+      (list autotrace
             bash-minimal
             gdl-minimal
             gtkmm-3
             gtk+
-            gtkspell3
             gsl
+            gspell
             poppler
             lib2geom
             libjpeg-turbo
@@ -273,9 +283,11 @@ (define-public inkscape/stable
             python-scour
             python-pyserial
             python-numpy
-            python-lxml))
+            python-lxml
+            readline))
      (native-inputs
-      (list gettext-minimal
+      (list bc
+            gettext-minimal
             imagemagick/stable          ;for tests
             `(,glib "bin")
             googletest
@@ -292,7 +304,7 @@ (define-public inkscape
   (package
     (inherit inkscape/stable)
     (name "inkscape")
-    (version "1.2.1")
+    (version "1.3.2")
     (source
      (origin
        (inherit (package-source inkscape/stable))
@@ -301,7 +313,7 @@ (define-public inkscape
                            "resources/file/"
                            "inkscape-" version ".tar.xz"))
        (sha256
-        (base32 "06scilds4p4bw337ss22nfdxy2kynv5yjw6vq6nlpjm7xfh7vkj6"))))
+        (base32 "0sq81smxwypgnp7r3wgza8w25dsz9qa8ga79sc85xzj3qi6q9lfv"))))
     (build-system cmake-build-system)
     (arguments
      (substitute-keyword-arguments (package-arguments inkscape/stable)
@@ -310,6 +322,10 @@ (define-public inkscape
         #~(delete "-DWITH_IMAGE_MAGICK=OFF" #$flags))
        ((#:phases phases)
         #~(modify-phases #$phases
+            (replace 'check
+              ;; Re-instate the tests disabled in inskcape/stable, now that
+              ;; their ImageMagick requirement is satisfied.
+              (assoc-ref %standard-phases 'check))
             (replace 'wrap-program
               ;; Ensure Python is available at runtime.
               (lambda _
diff --git a/gnu/packages/patches/inkscape-poppler-compat.patch b/gnu/packages/patches/inkscape-poppler-compat.patch
deleted file mode 100644
index cb7d1c8eb3..0000000000
--- a/gnu/packages/patches/inkscape-poppler-compat.patch
+++ /dev/null
@@ -1,45 +0,0 @@
-Fix build with Poppler 22.9.0.
-
-Taken from upstream:
-
-  https://gitlab.com/inkscape/inkscape/-/commit/fb00794923d19cfbb2ca4adca3ae8971553a06be
-
-diff --git a/src/extension/internal/pdfinput/pdf-parser.cpp b/src/extension/internal/pdfinput/pdf-parser.cpp
-index cca1e840966c7940a1af472025535042b07e3e0f..80d64c9b866d5d3dd095636a9a02571b89061af1 100644
---- a/src/extension/internal/pdfinput/pdf-parser.cpp
-+++ b/src/extension/internal/pdfinput/pdf-parser.cpp
-@@ -697,7 +697,11 @@ void PdfParser::opSetDash(Object args[], int /*numArgs*/)
-       _POPPLER_FREE(obj);
-     }
-   }
-+#if POPPLER_CHECK_VERSION(22, 9, 0)
-+  state->setLineDash(std::vector<double> (dash, dash + length), args[1].getNum());
-+#else
-   state->setLineDash(dash, length, args[1].getNum());
-+#endif
-   builder->updateStyle(state);
- }
- 
-diff --git a/src/extension/internal/pdfinput/svg-builder.cpp b/src/extension/internal/pdfinput/svg-builder.cpp
-index 12f71dd9214b95dbad6fdf7642a96cdd57f2c64a..9fc56fe63c2feee986ad1ff5018e679a0bacb665 100644
---- a/src/extension/internal/pdfinput/svg-builder.cpp
-+++ b/src/extension/internal/pdfinput/svg-builder.cpp
-@@ -389,10 +389,17 @@ void SvgBuilder::_setStrokeStyle(SPCSSAttr *css, GfxState *state) {
-     sp_repr_css_set_property(css, "stroke-miterlimit", os_ml.str().c_str());
- 
-     // Line dash
--    double *dash_pattern;
-     int dash_length;
-     double dash_start;
-+#if POPPLER_CHECK_VERSION(22, 9, 0)
-+    const double *dash_pattern;
-+    const std::vector<double> &dash = state->getLineDash(&dash_start);
-+    dash_pattern = dash.data();
-+    dash_length = dash.size();
-+#else
-+    double *dash_pattern;
-     state->getLineDash(&dash_pattern, &dash_length, &dash_start);
-+#endif
-     if ( dash_length > 0 ) {
-         Inkscape::CSSOStringStream os_array;
-         for ( int i = 0 ; i < dash_length ; i++ ) {
-- 
2.41.0