Subject: [bug#77949] [PATCH v2 1/3] gnu: utf8proc: Update to 2.10.0.

From: John Khoo <[email-masked]>
Date: Mon, 21 Apr 2025 22:05:15 +0800

* gnu/packages/textutils.scm (utf8proc): Add new utf8proc-bootstrap
  package to break dependency loop with Julia, and update to 2.10.0.
* gnu/packages/julia.scm (julia): Change utf8proc dependency to
  utf8proc-bootstrap to break dependency loop.

Change-Id: I5b75b8de3803032d423ba055a62c39801dd2cf47
---
 gnu/packages/julia.scm     |   3 +-
 gnu/packages/textutils.scm | 134 ++++++++++++++++---------------------
 2 files changed, 60 insertions(+), 77 deletions(-)

diff --git a/gnu/packages/julia.scm b/gnu/packages/julia.scm
index 9668b3fd1e..9a4b38f74e 100644
--- a/gnu/packages/julia.scm
+++ b/gnu/packages/julia.scm
@@ -8,6 +8,7 @@
 ;;; Copyright © 2021 Simon Tournier <[email-masked]>
 ;;; Copyright © 2021 Maxim Cournoyer <[email-masked]>
 ;;; Copyright © 2022 Akira Kyle <[email-masked]>
+;;; Copyright © 2025 John Khoo <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -526,7 +527,7 @@ (define-public julia
        ("p7zip" ,p7zip)
        ("pcre2" ,pcre2)
        ("suitesparse" ,suitesparse)
-       ("utf8proc" ,utf8proc-2.7.0)
+       ("utf8proc" ,utf8proc-bootstrap) ; Julia used for tests
        ("wget" ,wget)
        ("which" ,which)
        ("zlib" ,zlib)
diff --git a/gnu/packages/textutils.scm b/gnu/packages/textutils.scm
index c886b009be..1814490e97 100644
--- a/gnu/packages/textutils.scm
+++ b/gnu/packages/textutils.scm
@@ -33,6 +33,7 @@
 ;;; Copyright © 2024 Sharlatan Hellseher <[email-masked]>
 ;;; Copyright © 2024, 2025 Ashish SHUKLA <[email-masked]>
 ;;; Copyright © 2024 Artyom V. Poptsov <[email-masked]>
+;;; Copyright © 2025 John Khoo <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -76,6 +77,7 @@ (define-module (gnu packages textutils)
   #:use-module (gnu packages golang-crypto)
   #:use-module (gnu packages golang-xyz)
   #:use-module (gnu packages java)
+  #:use-module (gnu packages julia)
   #:use-module (gnu packages ncurses)
   #:use-module (gnu packages pcre)
   #:use-module (gnu packages perl)
@@ -89,7 +91,8 @@ (define-module (gnu packages textutils)
   #:use-module (gnu packages ruby)
   #:use-module (gnu packages slang)
   #:use-module (gnu packages web)
-  #:use-module (gnu packages xorg))
+  #:use-module (gnu packages xorg)
+  #:use-module (srfi srfi-1))
 
 (define-public dos2unix
   (package
@@ -166,22 +169,44 @@ (define-public enca
 libenca and several charset conversion libraries and tools.")
     (license license:gpl2)))
 
+;; Bootstrap variant of utf8proc, which breaks the dependency cycle between julia
+;; and utf8proc by disabling tests and removing its native-inputs.
+(define-public utf8proc-bootstrap
+  (hidden-package
+    (package
+      (name "utf8proc-bootstrap")
+      (version "2.10.0")
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://github.com/JuliaStrings/utf8proc")
+               (commit (string-append "v" version))))
+         (file-name (git-file-name name version))
+         (sha256
+          (base32 "1n1k67x39sk8xnza4w1xkbgbvgb1g7w2a7j2qrqzqaw1lyilqsy2"))))
+      (build-system gnu-build-system)
+      (arguments
+       `(#:tests? #f
+         #:make-flags (list ,(string-append "CC=" (cc-for-target))
+                            (string-append "prefix=" (assoc-ref %outputs "out")))
+         #:phases
+         (modify-phases %standard-phases
+           (delete 'configure)
+           )))
+      (home-page "https://juliastrings.github.io/utf8proc/")
+      (synopsis "C library for processing UTF-8 Unicode data")
+      (description "utf8proc is a small C library that provides Unicode
+  normalization, case-folding, and other operations for data in the UTF-8
+  encoding, supporting Unicode version 16.0.0.")
+      (license license:expat))))
+
 (define-public utf8proc
   (package
+    (inherit utf8proc-bootstrap)
     (name "utf8proc")
-    (version "2.5.0")
-    (source
-     (origin
-       (method git-fetch)
-       (uri (git-reference
-             (url "https://github.com/JuliaStrings/utf8proc")
-             (commit (string-append "v" version))))
-       (file-name (git-file-name name version))
-       (sha256
-        (base32 "1xlkazhdnja4lksn5c9nf4bln5gjqa35a8gwlam5r0728w0h83qq"))))
-    (build-system gnu-build-system)
-    (native-inputs
-     (let ((UNICODE_VERSION "13.0.0"))  ; defined in data/Makefile
+    (native-inputs ;; For tests.
+      (let ((UNICODE_VERSION "16.0.0"))  ; defined in data/Makefile
        ;; Test data that is otherwise downloaded with curl.
        `(("NormalizationTest.txt"
           ,(origin
@@ -189,7 +214,7 @@ (define-public utf8proc
              (uri (string-append "https://www.unicode.org/Public/"
                                  UNICODE_VERSION "/ucd/NormalizationTest.txt"))
              (sha256
-              (base32 "07g0ya4f6zfzvpp24ccxkb2yq568kh83gls85rjl950nv5fya3nn"))))
+              (base32 "1cffwlxgn6sawxb627xqaw3shnnfxq0v7cbgsld5w1z7aca9f4fq"))))
          ("GraphemeBreakTest.txt"
           ,(origin
              (method url-fetch)
@@ -197,57 +222,26 @@ (define-public utf8proc
                                  UNICODE_VERSION
                                  "/ucd/auxiliary/GraphemeBreakTest.txt"))
              (sha256
-              (base32 "07f8rrvcsq4pibdz6zxggxy8w7zjjqyw2ggclqlhalyv45yv7prj"))))
-
+              (base32 "1d9w6vdfxakjpp38qjvhgvbl2qx0zv5655ph54dhdb3hs9a96azf"))))
+          ("DerivedCoreProperties.txt"
+           ,(origin
+              (method url-fetch)
+              (uri (string-append "https://www.unicode.org/Public/"
+                                  UNICODE_VERSION "/ucd/DerivedCoreProperties.txt"))
+              (sha256
+               (base32 "1gfsq4vdmzi803i2s8ih7mm4fgs907kvkg88kvv9fi4my9hm3lrr"))))
          ;; For tests.
-         ("perl" ,perl))))
+         ("perl" ,perl)
+         ("ruby" ,ruby-2.7)
+         ("julia" ,julia))))
     (arguments
-     `(#:make-flags (list ,(string-append "CC=" (cc-for-target))
-                          (string-append "prefix=" (assoc-ref %outputs "out")))
-       #:phases
-       (modify-phases %standard-phases
-         (delete 'configure)
-         (add-before 'check 'check-data
-           (lambda* (#:key ,@(if (%current-target-system)
-                                 '(native-inputs)
-                                 '())
-                     inputs #:allow-other-keys)
-             (for-each (lambda (i)
-                         (copy-file (assoc-ref ,@(if (%current-target-system)
-                                                     '((or native-inputs inputs))
-                                                     '(inputs)) i)
-                                    (string-append "data/" i)))
-                       '("NormalizationTest.txt" "GraphemeBreakTest.txt"))
-             (substitute* "data/GraphemeBreakTest.txt"
-               (("÷") "/")
-               (("×") "+"))
-             #t)))))
-    (home-page "https://juliastrings.github.io/utf8proc/")
-    (synopsis "C library for processing UTF-8 Unicode data")
-    (description "utf8proc is a small C library that provides Unicode
-normalization, case-folding, and other operations for data in the UTF-8
-encoding, supporting Unicode version 9.0.0.")
-    (license license:expat)))
-
-(define-public utf8proc-2.7.0
-  (package
-    (inherit utf8proc)
-    (name "utf8proc")
-    (version "2.7.0")
-    (source
-     (origin
-       (method git-fetch)
-       (uri (git-reference
-             (url "https://github.com/JuliaStrings/utf8proc")
-             (commit (string-append "v" version))))
-       (file-name (git-file-name name version))
-       (sha256
-        (base32 "1wrsmnaigal94gc3xbzdrrm080zjhihjfdla5admllq2w5dladjj"))))
-    (arguments
-     (substitute-keyword-arguments (package-arguments utf8proc)
+     (substitute-keyword-arguments (package-arguments utf8proc-bootstrap)
+       ((#:tests? _ #f)
+        (not (%current-target-system)))
        ((#:phases phases)
-        `(modify-phases ,phases
-           (replace 'check-data
+        `(modify-phases %standard-phases
+          (delete 'configure)
+          (add-before 'check 'check-data
              (lambda* (#:key inputs native-inputs #:allow-other-keys)
                (display native-inputs)
                (for-each (lambda (i)
@@ -255,19 +249,7 @@ (define-public utf8proc-2.7.0
                                       (string-append "data/" i)))
                          '("NormalizationTest.txt" "GraphemeBreakTest.txt"
                            "DerivedCoreProperties.txt"))))))))
-    (native-inputs
-     (append
-      (package-native-inputs utf8proc)
-      (let ((UNICODE_VERSION "14.0.0"))
-        `(("DerivedCoreProperties.txt"
-           ,(origin
-              (method url-fetch)
-              (uri (string-append "https://www.unicode.org/Public/"
-                                  UNICODE_VERSION "/ucd/DerivedCoreProperties.txt"))
-              (sha256
-               (base32 "1g77s8g9443dd92f82pbkim7rk51s7xdwa3mxpzb1lcw8ryxvvg3"))))
-          ;; For tests
-          ("ruby" ,ruby-2.7)))))))
+    (properties (alist-delete 'hidden? (package-properties utf8proc-bootstrap)))))
 
 (define-public libconfuse
   (package

base-commit: 94e7afbb557d3f2709072bf2bf58618293ca7fbd
-- 
2.49.0