[bug#78826,02/88] gnu: epic5: Improve style.

Message ID 20250618142822.27945-2-ngraves@ngraves.fr
State New
Headers
Series Switch to ruby@3.3 and build -P1 ruby@3.3 |

Commit Message

Nicolas Graves June 18, 2025, 2:26 p.m. UTC
  * 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(-)
  

Patch

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"