Subject: [bug#77949] [PATCH v3 1/5] gnu: Add utf8proc-bootstrap.

From: John Khoo <[email-masked]>
Date: Wed, 30 Apr 2025 04:42:45 +0800

* gnu/packages/textutils.scm (utf8proc-bootstrap): New variable.
* gnu/packages/julia.scm (julia): Change utf8proc dependency to
  utf8proc-bootstrap to break dependency loop.

Change-Id: Ie2e0c4a83aa9b478b125a390f162c1c69613cd9b
---
 gnu/packages/julia.scm     |  3 ++-
 gnu/packages/textutils.scm | 34 ++++++++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+), 1 deletion(-)

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..5fc21eb7ea 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)
@@ -166,6 +168,38 @@ (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
     (name "utf8proc")

base-commit: 94e7afbb557d3f2709072bf2bf58618293ca7fbd
-- 
2.49.0