Subject: [PATCH 02/88] gnu: epic5: Improve style.

From: Nicolas Graves <[email-masked]>
Date: Wed, 18 Jun 2025 16:26:49 +0200

* gnu/packages/irc.scm (epic5)[arguments]{phases}: Partial rewrite to
use modern style and Gexps. Replace which by search-input-file. Use
substitute regexp capabilities.
---
 gnu/packages/irc.scm | 72 ++++++++++++++++++--------------------------
 1 file changed, 30 insertions(+), 42 deletions(-)

diff --git a/gnu/packages/irc.scm b/gnu/packages/irc.scm
index d4f8491767..b5df78e209 100644
--- a/gnu/packages/irc.scm
+++ b/gnu/packages/irc.scm
@@ -753,62 +753,50 @@ (define-public epic5
       #:phases
       #~(modify-phases %standard-phases
           (add-after 'unpack 'patch-perl
-            (lambda _
+            (lambda* (#:key inputs #:allow-other-keys)
               (substitute* "regress/crash-irc"
                 (("perl5")
-                 (which "perl")))))
+                 (search-input-file inputs "bin/perl")))))
           (add-after 'unpack 'patch-bsdinstall
             ;; If we just remove /bin/ some part of the bsdinstall breaks.
             ;; Furthermore bsdinstalls has a reference to /etc/chmod here, which
             ;; means if we leave /etc/ in, install fails.
             (lambda _
               (substitute* "bsdinstall"
-                (("/bin/strip")
-                 "strip")
-                (("/bin/cp")
-                 "cp")
-                (("/bin/chmod")
-                 "chmod")
-                (("/bin/chgrp")
-                 "chgrp")
-                (("/bin/mkdir")
-                 "mkdir")
-                (("/bin/rm")
-                 "rm")
-                (("/bin/mv")
-                 "mv")
+                (("/bin/(chgrp|chmod|cp|mkdir|mv|rm|strip)" all bin)
+                 bin)
                 (("/etc/")
                  ""))))
           (replace 'configure
-            (lambda* (#:key outputs #:allow-other-keys)
+            (lambda* (#:key inputs #:allow-other-keys)
               ;; The tarball uses a very old version of autconf. It does not
               ;; understand extra flags like `--enable-fast-install', so
               ;; we need to invoke it with just what it understands.
-              (let ((out (assoc-ref outputs "out")))
-                ;; 'configure' doesn't understand '--host'.
-                #$@(if (%current-target-system)
-                       `((setenv "CHOST"
-                                 ,(%current-target-system)))
-                       '())
-                (setenv "CONFIG_SHELL"
-                        (which "bash"))
-                (setenv "SHELL"
-                        (which "bash"))
-                (invoke "./configure"
-                        (string-append "--prefix=" out)
-                        "--with-ipv6"
-                        "--with-libarchive"
-                        ;; We use libressl because openssl does not come
-                        ;; with the lib/libssl.a which is needed for epic5.
-                        ;; XXX: No matter which implementation is chosen,
-                        ;; epic5 fails to connect to tls ports of roundrobin
-                        ;; irc networks. This however is believed to be an
-                        ;; protocol issue at epic5 related to ircd.
-                        (string-append "--with-ssl="
-                                       (assoc-ref %build-inputs "libressl"))
-                        (string-append "--with-tcl="
-                                       (assoc-ref %build-inputs "tcl")
-                                       "/lib/tclConfig.sh"))))))))
+              ;; 'configure' doesn't understand '--host'.
+              #$@(if (%current-target-system)
+                     `((setenv "CHOST"
+                               ,(%current-target-system)))
+                     '())
+              (setenv "CONFIG_SHELL"
+                      (search-input-file inputs "bin/bash"))
+              (setenv "SHELL"
+                      (search-input-file inputs "bin/bash"))
+              (invoke "./configure"
+                      (string-append "--prefix="
+                                     #$output)
+                      "--with-ipv6"
+                      "--with-libarchive"
+                      ;; We use libressl because openssl does not come
+                      ;; with the lib/libssl.a which is needed for epic5.
+                      ;; XXX: No matter which implementation is chosen,
+                      ;; epic5 fails to connect to tls ports of roundrobin
+                      ;; irc networks. This however is believed to be an
+                      ;; protocol issue at epic5 related to ircd.
+                      (string-append "--with-ssl="
+                                     #$(this-package-input "libressl"))
+                      (string-append "--with-tcl="
+                                     (search-input-file inputs
+                                                        "/lib/tclConfig.sh"))))))))
     (inputs (list libressl
                   ncurses
                   libarchive ;CHANGELOG: "Support for loading zip files"
-- 
2.49.0