Subject: [bug#78790] [PATCH 6/8] gnu: zxing-cpp: Update to 2.3.0.

From: Homo <[email-masked]>
Date: Sun, 15 Jun 2025 23:26:15 +0300

* gnu/packages/aidc.scm (zxing-cpp): Update to 2.3.0.
[version]: Do not use git-version.
[source]: Update URL.
[native-inputs]: Add pkg-config.
[inputs]: Add libpng, zint and zlib.
[arguments] <#:configure-flags>: Add -DZXING_READERS=ON, -DZXING_WRITERS=BOTH,
  -DZXING_DEPENDENCIES=LOCAL, -DZXING_EXAMPLES=OFF,
  -DZXING_USE_BUNDLED_ZINT=OFF and -DZXING_UNIT_TESTS=ON.
<#:phases> (install-headers): New phase.
(zxing-cpp-1.2a): New variable.
(zxing-cpp-1.2) [source]: Update URL.
* gnu/packages/linphone.scm (liblinphone)[inputs]: Replace zxing-cpp with zxing-cpp-1.2a.
* gnu/packages/messaging.scm (kaidan)[inputs]: Likewise.

Change-Id: Ib03af79feef03f9c9e1a5b97d39b7d6c18d3ff1d
---
 gnu/packages/aidc.scm      | 53 +++++++++++++++++++++++++++++++-------
 gnu/packages/linphone.scm  |  2 +-
 gnu/packages/messaging.scm |  2 +-
 3 files changed, 46 insertions(+), 11 deletions(-)

diff --git a/gnu/packages/aidc.scm b/gnu/packages/aidc.scm
index c48e800b77..bd55ce74ff 100644
--- a/gnu/packages/aidc.scm
+++ b/gnu/packages/aidc.scm
@@ -32,6 +32,7 @@ (define-module (gnu packages aidc)
   #:use-module (guix utils)
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages check)
+  #:use-module (gnu packages compression)
   #:use-module (gnu packages elf)
   #:use-module (gnu packages imagemagick)
   #:use-module (gnu packages gettext)
@@ -83,29 +84,63 @@ (define-public zint
     (license (list license:bsd-3 license:gpl3+))))
 
 (define-public zxing-cpp
+  (package
+    (name "zxing-cpp")
+    (version "2.3.0")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/zxing-cpp/zxing-cpp")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "1hdr73fllnsp3zpmrhw6cjla39lihwg1khgvddsf4v57a0lmiy3f"))))
+    (build-system cmake-build-system)
+    (arguments
+     (list
+      #:configure-flags
+      #~(list "-DZXING_READERS=ON"
+              "-DZXING_WRITERS=BOTH"
+              "-DZXING_DEPENDENCIES=LOCAL"
+              "-DZXING_EXAMPLES=OFF" ;requires stb.pc
+              "-DZXING_USE_BUNDLED_ZINT=OFF"
+              "-DZXING_UNIT_TESTS=ON")
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'install 'install-headers
+            (lambda* (#:key source #:allow-other-keys)
+              (invoke "sh" "-c"
+                           (string-append "cp " source "/core/src/*.h "
+                                                #$output "/include/ZXing/")))))))
+    (native-inputs (list fmt-8 googletest pkg-config))
+    (inputs (list libpng zint zlib))
+    (synopsis "C++ port of ZXing")
+    (description "ZXing-CPP is a barcode scanning library.")
+    (home-page "https://github.com/zxing-cpp/zxing-cpp")
+    (license license:asl2.0)))
+
+;;; This older variant is kept for kaidan, liblinphone and yosys-clang.
+(define-public zxing-cpp-1.2a
   ;; Use the master branch as it includes unreleased build system improvements
   ;; allowing to use system libraries (instead of attempting to fetch them
   ;; from the Internet).
   (let ((revision "0")
         (commit "00783db7aa3bcf8620a301854ac71c0ceaaca0c1"))
-    (package
+    (package/inherit zxing-cpp
       (name "zxing-cpp")
       (version (git-version "1.2.0" revision commit))
       (source (origin
                 (method git-fetch)
                 (uri (git-reference
-                      (url "https://github.com/nu-book/zxing-cpp")
+                      (url "https://github.com/zxing-cpp/zxing-cpp")
                       (commit commit)))
                 (file-name (git-file-name name version))
                 (sha256
                  (base32
                   "1yl2cpaqiv1g4nq9v0xfj1vd5faz55k4541vz6hsffvcxgn9nmc5"))))
-      (build-system cmake-build-system)
-      (native-inputs (list fmt-8 googletest))
-      (synopsis "C++ port of ZXing")
-      (description "ZXing-CPP is a barcode scanning library.")
-      (home-page "https://github.com/nu-book/zxing-cpp")
-      (license license:asl2.0))))
+      (arguments '(#:configure-flags '()))
+      (native-inputs (list fmt-8 googletest)))))
 
 ;;; This older variant is kept for gst-plugins-bad (see:
 ;;; https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/1684).
@@ -116,7 +151,7 @@ (define-public zxing-cpp-1.2
     (source (origin
               (method git-fetch)
               (uri (git-reference
-                    (url "https://github.com/nu-book/zxing-cpp")
+                    (url "https://github.com/zxing-cpp/zxing-cpp")
                     (commit (string-append "v" version))))
               (file-name (git-file-name name version))
               (sha256
diff --git a/gnu/packages/linphone.scm b/gnu/packages/linphone.scm
index 239c18c595..24cd6bbcc8 100644
--- a/gnu/packages/linphone.scm
+++ b/gnu/packages/linphone.scm
@@ -802,7 +802,7 @@ (define-public liblinphone
            sqlite
            xsd
            zlib
-           zxing-cpp))
+           zxing-cpp-1.2a))
     (synopsis "Belledonne Communications Softphone Library")
     (description "Liblinphone is a high-level SIP library integrating
 all calling and instant messaging features into an unified
diff --git a/gnu/packages/messaging.scm b/gnu/packages/messaging.scm
index c2928c0042..bddc4786cd 100644
--- a/gnu/packages/messaging.scm
+++ b/gnu/packages/messaging.scm
@@ -1515,7 +1515,7 @@ (define-public kaidan
                   qqc2-desktop-style
                   qxmpp
                   sonnet
-                  zxing-cpp))
+                  zxing-cpp-1.2a))
     (home-page "https://www.kaidan.im/")
     (synopsis "Qt-based XMPP/Jabber Client")
     (description "Kaidan is a chat client.  It uses the open communication
-- 
2.49.0