Subject: [PATCH kde-team 59/63] gnu: Add kimageformats-6.

From: Zheng Junjie <[email-masked]>
Date: Mon, 15 Apr 2024 20:47:36 +0800

* gnu/packages/kde-frameworks.scm (kimageformats-6): New variable.
(kimageformats): Inherit above.

Change-Id: I1766a88c87b1a5c1ce5656d10d2044d090d9586c
---
 gnu/packages/kde-frameworks.scm | 61 ++++++++++++++++++++++++++-------
 1 file changed, 48 insertions(+), 13 deletions(-)

diff --git a/gnu/packages/kde-frameworks.scm b/gnu/packages/kde-frameworks.scm
index c50404c991..b49a23f022 100644
--- a/gnu/packages/kde-frameworks.scm
+++ b/gnu/packages/kde-frameworks.scm
@@ -2689,8 +2689,53 @@ (define-public kimageannotator
     (description "This library provides tools to annotate images.")
     (license license:lgpl3+)))
 
+(define-public kimageformats-6
+  (package
+    (name "kimageformats")
+    (version "6.1.0")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append
+                    "mirror://kde/stable/frameworks/"
+                    (version-major+minor version) "/"
+                    name "-" version ".tar.xz"))
+              (sha256
+               (base32
+                "0pn9zjx18jmbdbpdskchwy0vi9clra4jls6d3dz6bjdli82zlcxh"))))
+    (build-system cmake-build-system)
+    (native-inputs
+     (list extra-cmake-modules pkg-config))
+    (inputs
+     (list karchive-6 ; for Krita and OpenRaster images
+           openexr ; for OpenEXR high dynamic-range images
+           qtbase
+           libjxl
+           libraw
+           libavif
+           ;; see https://bugs.kde.org/show_bug.cgi?id=468288,
+           ;; kimageformats-read-psd test need QTiffPlugin
+           qtimageformats
+           ;; FIXME: make openexr propagate two package
+           imath zlib))
+    (arguments
+     (list
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-before 'check 'check-setup
+            (lambda _
+              ;; make Qt render "offscreen", required for tests
+              (setenv "QT_QPA_PLATFORM" "offscreen"))))))
+    (home-page "https://community.kde.org/Frameworks")
+    (synopsis "Plugins to allow QImage to support extra file formats")
+    (description "This framework provides additional image format plugins for
+QtGui.  As such it is not required for the compilation of any other software,
+but may be a runtime requirement for Qt-based software to support certain image
+formats.")
+    (license license:lgpl2.1+)))
+
 (define-public kimageformats
   (package
+    (inherit kimageformats-6)
     (name "kimageformats")
     (version "5.114.0")
     (source (origin
@@ -2708,7 +2753,8 @@ (define-public kimageformats
     (inputs
      (list karchive ; for Krita and OpenRaster images
            openexr-2 ; for OpenEXR high dynamic-range images
-           qtbase-5))
+           qtbase-5
+           qtimageformats-5))
     (arguments
      (list
       #:phases
@@ -2716,18 +2762,7 @@ (define-public kimageformats
           (add-before 'check 'check-setup
             (lambda _
               ;; make Qt render "offscreen", required for tests
-              (setenv "QT_QPA_PLATFORM" "offscreen")
-              (setenv "QT_PLUGIN_PATH"
-                      (string-append (getcwd) "/bin:"
-                                     (getenv "QT_PLUGIN_PATH")))))
-          (replace 'check
-            (lambda* (#:key tests? #:allow-other-keys)
-              (when tests?
-                (setenv "HOME"
-                        (getcwd))
-                ;; FIXME: I guess kde's qt no this fail.
-                ;; see https://invent.kde.org/frameworks/kimageformats/-/jobs/1046283
-                (invoke "ctest" "-E" "kimageformats-read-psd")))))
+              (setenv "QT_QPA_PLATFORM" "offscreen"))))
       ;; FIXME: The header files of ilmbase (propagated by openexr) are not
       ;; found when included by the header files of openexr, and an explicit
       ;; flag needs to be set.
-- 
2.41.0