Subject: [bug#76570] [PATCH 6/6] gnu: kodi: Update to 21.2.

From: André Batista <[email-masked]>
Date: Tue, 25 Feb 2025 19:44:52 -0300

* gnu/packages/kodi.scm (kodi): Update to 21.2.
[source] <commit>: Adjust for new release name.
<patches>: Remove obsolete.
<snippet>: Remove references to unexisting files, add new ones.
[arguments] <#:phases> ('patch-stuff): Adjust substitute regex to match
current cmake files; Remove regex substitution for already disabled test
(GetOsVersion); Add regex to match new failing test (PingHost).
[native-inputs]: Update java-commons-lang to version 3;
Add java-commons-text.
[inputs]: Update ffmpeg to default; Add libudfread and tinyxml2.

* gnu/local.mk (dist_patch_DATA): Remove obsolete patch.
* gnu/packages/patches/kodi-mesa-eglchromium.patch: Remove file.

Change-Id: I03c79620cd89d7a29c7993f9839d35f2c2387b2b
---
 gnu/local.mk                                  |  1 -
 gnu/packages/kodi.scm                         | 67 +++++++++++++------
 .../patches/kodi-mesa-eglchromium.patch       | 56 ----------------
 3 files changed, 48 insertions(+), 76 deletions(-)

diff --git a/gnu/local.mk b/gnu/local.mk
index c8a29bf98b..e38de5ec62 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1696,7 +1696,6 @@ dist_patch_DATA =						\
   %D%/packages/patches/kobodeluxe-midicon-segmentation-fault.patch	\
   %D%/packages/patches/kobodeluxe-graphics-window-signed-char.patch	\
   %D%/packages/patches/kodi-set-libcurl-ssl-parameters.patch		\
-  %D%/packages/patches/kodi-mesa-eglchromium.patch		\
   %D%/packages/patches/krita-bump-sip-abi-version-to-12.8.patch	\
   %D%/packages/patches/kvmfr-linux-module-fix-build.patch	\
   %D%/packages/patches/kwin-unwrap-executable-name-for-dot-desktop-search.patch\
diff --git a/gnu/packages/kodi.scm b/gnu/packages/kodi.scm
index 103329a82b..938fa35e80 100644
--- a/gnu/packages/kodi.scm
+++ b/gnu/packages/kodi.scm
@@ -8,6 +8,7 @@
 ;;; Copyright © 2021 Greg Hogan <[email-masked]>
 ;;; Copyright © 2022 Ricardo Wurmus <[email-masked]>
 ;;; Copyright © 2024 Nicolas Graves <[email-masked]>
+;;; Copyright © 2025 André Batista <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -256,31 +257,31 @@ (define-public fstrcmp
 (define-public kodi
   (package
     (name "kodi")
-    (version "19.5")
+    (version "21.2")
     (source (origin
               (method git-fetch)
               (uri (git-reference
                     (url "https://github.com/xbmc/xbmc")
-                    (commit (string-append version "-Matrix"))))
+                    (commit (string-append version "-Omega"))))
               (file-name (git-file-name name version))
               (sha256
                (base32
-                "1pfd1ajivr865h0fkpbv778626c4czrvq8650bzqv9aqzh8f36my"))
-              (patches (search-patches "kodi-set-libcurl-ssl-parameters.patch"
-                                       "kodi-mesa-eglchromium.patch"))
+                "1kq35hn7fl8fhsv5xvqb7snsh9lbzix56pafqz8flgc5mrrckm25"))
+              (patches (search-patches "kodi-set-libcurl-ssl-parameters.patch"))
               (modules '((guix build utils)))
               (snippet
                '(begin
                   (use-modules (guix build utils))
                   (for-each delete-file-recursively
                             '("project/BuildDependencies/"
-                              "tools/codegenerator/groovy/commons-lang-2.6.jar"
-                              "tools/codegenerator/groovy/groovy-all-2.4.4.jar"
                               ;; Purge these sources:
                               ;; "tools/depend/native/JsonSchemaBuilder"
                               ;; "tools/depend/native/TexturePacker"
                               ;; "lib/libUPnP"
                               "lib/libUPnP/Neptune/ThirdParty"
+                              "lib/libUPnP/Platinum/ThirdParty"
+                              "lib/win32"
+                              "tools/android/packaging/gradle/wrapper/gradle-wrapper.jar"
                               "project/Win32BuildSetup/tools/7z"))))))
     (build-system cmake-build-system)
     (arguments
@@ -321,21 +322,45 @@ (define-public kodi
                 "COMMAND groovy")
                (("ARGS \\$\\{JAVA_OPEN_OPTS\\} -cp \"\\$\\{classpath\\}\" groovy.ui.GroovyMain")
                 "ARGS -cp \"${classpath}\" ")
-               (("classpath \\$\\{GROOVY_DIR\\}/groovy-all-\\$\\{GROOVY_VER\\}.jar")
-                "classpath ")
-               (("\\$\\{GROOVY_DIR\\}/commons-lang-\\$\\{COMMONS_VER\\}.jar")
-                (search-input-file inputs "/share/java/commons-lang-2.6.jar"))
+               (("classpath \\$\\{groovy_SOURCE_DIR\\}")
+                (string-append "classpath " (assoc-ref inputs "groovy")))
+               (("\\$\\{apache-commons-lang_SOURCE_DIR\\}")
+                (dirname
+                 (search-input-file
+                  inputs
+                  "/lib/m2/org/apache/commons/commons-lang3/3.12.0/commons-lang3-3.12.0.jar")))
+               (("\\$\\{apache-commons-text_SOURCE_DIR\\}")
+                (dirname
+                 (search-input-file
+                  inputs
+                  "/lib/m2/org/apache/commons/commons-text/1.9/commons-text-1.9.jar")))
+               (("FetchContent_MakeAvailable\\(groovy\\)")
+                (string-append "set(groovy_SOURCE_DIR " (assoc-ref inputs "groovy") ")"))
+               (("FetchContent_MakeAvailable\\(apache-commons-lang\\)")
+                (string-append "set(apache-commons-lang_SOURCE_DIR "
+                               (assoc-ref inputs "java-commons-lang3")
+                               "/lib/m2/org/apache/commons/commons-lang3/3.12.0)"))
+               (("FetchContent_MakeAvailable\\(apache-commons-text\\)")
+                (string-append "set(apache-commons-text_SOURCE_DIR "
+                               (assoc-ref inputs "java-commons-text")
+                               "/lib/m2/org/apache/commons/commons-text/1.9)"))
                (("^set\\(GROOVY_VER.*")
                 (string-append "set(GROOVY_VER 3.0.5)\n")))
 
              ;; Prevent the build scripts from calling autoreconf in the
              ;; build stage.  Otherwise, it would undo the bootstrapping
              ;; and shebang patching that we worked so hard for.
-             (substitute* "cmake/modules/FindLibDvd.cmake"
+             (substitute* "cmake/modules/FindLibDvdCSS.cmake"
                ;; The libdvd* sources that we bootstrapped separately are
                ;; unpacked in the build phase. This is our best opportunity
                ;; to make them writable before the build process starts.
-               (("autoreconf -vif") "chmod -R u+w ."))
+               (("\\$\\{AUTORECONF\\} -vif") "chmod -R u+w ."))
+
+             (substitute* "cmake/modules/FindLibDvdNav.cmake"
+               (("\\$\\{AUTORECONF\\} -vif") "chmod -R u+w ."))
+
+             (substitute* "cmake/modules/FindLibDvdRead.cmake"
+               (("\\$\\{AUTORECONF\\} -vif") "chmod -R u+w ."))
 
              (substitute* "xbmc/platform/posix/PosixTimezone.cpp"
                (("/usr/share/zoneinfo")
@@ -353,9 +378,7 @@ (define-public kodi
                (("TEST_F\\(TestSystemInfo, GetOsPrettyNameWithVersion\\)")
                 "TEST_F(TestSystemInfo, DISABLED_GetOsPrettyNameWithVersion)")
                (("TEST_F\\(TestSystemInfo, GetOsName\\)")
-                "TEST_F(TestSystemInfo, DISABLED_GetOsName)")
-               (("TEST_F\\(TestSystemInfo, GetOsVersion\\)")
-                "TEST_F(TestSystemInfo, DISABLED_GetOsVersion)"))
+                "TEST_F(TestSystemInfo, DISABLED_GetOsName)"))
              (substitute* "xbmc/utils/test/TestCPUInfo.cpp"
                (("TEST_F\\(TestCPUInfo, GetCPUFrequency\\)")
                 "TEST_F(TestCPUInfo, DISABLED_GetCPUFrequency)"))
@@ -363,7 +386,10 @@ (define-public kodi
                (("TEST_F\\(TestDateTime, TmOperators\\)")
                 "TEST_F(TestDateTime, DISABLED_TmOperators)")
                (("TEST_F\\(TestDateTime, GetAsTm\\)")
-                "TEST_F(TestDateTime, DISABLED_GetAsTm)"))))
+                "TEST_F(TestDateTime, DISABLED_GetAsTm)"))
+             (substitute* "xbmc/network/test/TestNetwork.cpp"
+               (("TEST_F\\(TestNetwork, PingHost\\)")
+                "TEST_F(TestNetwork, DISABLED_PingHost)"))))
          (add-before 'build 'set-build-environment
            (lambda _
              ;; Some bundled build scripts fall back to /bin/sh
@@ -383,7 +409,8 @@ (define-public kodi
            googletest
            groovy
            openjdk9                     ;like groovy
-           java-commons-lang
+           java-commons-lang3
+           java-commons-text
            libdvdcss/kodi
            libdvdnav/kodi
            libdvdread/kodi
@@ -400,7 +427,7 @@ (define-public kodi
            dcadec
            dbus
            eudev
-           ffmpeg-4
+           ffmpeg
            flac
            flatbuffers
            fmt
@@ -429,6 +456,7 @@ (define-public kodi
            libpng
            libssh
            libtiff
+           libudfread
            libva
            libvorbis
            libxcrypt
@@ -449,6 +477,7 @@ (define-public kodi
            sqlite
            taglib
            tinyxml
+           tinyxml2
            tzdata
            util-linux
            zip
diff --git a/gnu/packages/patches/kodi-mesa-eglchromium.patch b/gnu/packages/patches/kodi-mesa-eglchromium.patch
deleted file mode 100644
index 3324062274..0000000000
--- a/gnu/packages/patches/kodi-mesa-eglchromium.patch
+++ /dev/null
@@ -1,56 +0,0 @@
-From https://github.com/xbmc/xbmc/pull/22291/commits/5449652abf0bb9dddd0d796de4120e60f19f89a5
-
-From 5449652abf0bb9dddd0d796de4120e60f19f89a5 Mon Sep 17 00:00:00 2001
-From: Alan Swanson <[email-masked]>
-Date: Mon, 19 Dec 2022 21:28:13 +0200
-Subject: [PATCH] Work around Mesa eglchromium.h removal
-
-I have polished Alan's snippet to buildable state and tested
-on Kodi from Debian sid.
-
-Signed-off-by: Vasyl Gello <[email-masked]>
----
- cmake/modules/FindEGL.cmake       | 6 ++++++
- xbmc/windowing/X11/GLContextEGL.h | 4 ++++
- 2 files changed, 10 insertions(+)
-
-diff --git a/cmake/modules/FindEGL.cmake b/cmake/modules/FindEGL.cmake
-index b00fe08a25f95..a68a8db901222 100644
---- a/cmake/modules/FindEGL.cmake
-+++ b/cmake/modules/FindEGL.cmake
-@@ -9,6 +9,7 @@
- # EGL_INCLUDE_DIRS - the EGL include directory
- # EGL_LIBRARIES - the EGL libraries
- # EGL_DEFINITIONS - the EGL definitions
-+# HAVE_EGLEXTANGLE - if eglext_angle.h exists else use eglextchromium.h
- #
- # and the following imported targets::
- #
-@@ -35,6 +36,11 @@ if(EGL_FOUND)
-   set(EGL_LIBRARIES ${EGL_LIBRARY})
-   set(EGL_INCLUDE_DIRS ${EGL_INCLUDE_DIR})
-   set(EGL_DEFINITIONS -DHAS_EGL=1)
-+  include(CheckIncludeFiles)
-+  check_include_files("EGL/egl.h;EGL/eglext.h;EGL/eglext_angle.h" HAVE_EGLEXTANGLE)
-+  if(HAVE_EGLEXTANGLE)
-+    list(APPEND EGL_DEFINITIONS "-DHAVE_EGLEXTANGLE=1")
-+  endif()
- 
-   if(NOT TARGET EGL::EGL)
-     add_library(EGL::EGL UNKNOWN IMPORTED)
-diff --git a/xbmc/windowing/X11/GLContextEGL.h b/xbmc/windowing/X11/GLContextEGL.h
-index 99a6a9024e8c6..afea0b7c43eac 100644
---- a/xbmc/windowing/X11/GLContextEGL.h
-+++ b/xbmc/windowing/X11/GLContextEGL.h
-@@ -13,7 +13,11 @@
- #include "threads/CriticalSection.h"
- 
- #include <EGL/eglext.h>
-+#ifdef HAVE_EGLEXTANGLE
-+#include <EGL/eglext_angle.h>
-+#else
- #include <EGL/eglextchromium.h>
-+#endif
- #include <X11/Xutil.h>
- 
- class CGLContextEGL : public CGLContext
-- 
2.48.1