Subject: [bug#78385] [PATCH electronics-team] gnu: yosys: Improve package style.

From: Cayetano Santos <[email-masked]>
Date: Sun, 11 May 2025 22:17:21 +0200

* gnu/packages/fpga.scm (yosys): Improve package style.

Change-Id: Ifa88e523d1637ba05166000056830faa53b45706
---

[arguments] <#:phases> {fix-paths}: Replace search-input-file by this-package-input.
{use-external-abc}: Move to fix-paths phase.

 gnu/packages/fpga.scm | 27 +++++++++++++--------------
 1 file changed, 13 insertions(+), 14 deletions(-)

diff --git a/gnu/packages/fpga.scm b/gnu/packages/fpga.scm
index 2298dde595..b1f53560a8 100644
--- a/gnu/packages/fpga.scm
+++ b/gnu/packages/fpga.scm
@@ -205,34 +205,33 @@ (define-public yosys
       #:phases
       #~(modify-phases %standard-phases
           (add-before 'configure 'fix-paths
-            (lambda* (#:key inputs #:allow-other-keys)
+            (lambda _
               (substitute* "backends/smt2/smtio.py"
                 (("\\['z3")
-                 (string-append "['"
-                                (search-input-file inputs "bin/z3"))))
+                 (string-append "['" #$(this-package-input "z3") "/bin/z3")))
               (substitute* "kernel/fstdata.cc"
                 (("vcd2fst")
-                 (search-input-file inputs "bin/vcd2fst")))
+                 (string-append #$(this-package-input "gtkwave")
+                                "/bin/vcd2fst")))
               (substitute* "kernel/driver.cc"
                 (("^#include \"libs/cxxopts/include/cxxopts.hpp\"")
                  "#include <cxxopts.hpp>"))
               (substitute* '("passes/cmds/show.cc" "passes/cmds/viz.cc")
                 (("exec xdot")
-                 (string-append "exec "
-                                (search-input-file inputs "bin/xdot")))
+                 (string-append "exec " #$(this-package-input "xdot")
+                                "/bin/xdot"))
                 (("dot -")
-                 (string-append (search-input-file inputs "bin/dot") " -"))
+                 (string-append #$(this-package-input "graphviz") "/bin/dot -"))
                 (("fuser")
-                 (search-input-file inputs "bin/fuser")))))
-          (replace 'configure
-            (lambda* (#:key make-flags #:allow-other-keys)
-              (apply invoke "make" "config-gcc" make-flags)))
-          (add-after 'configure 'use-external-abc
-            (lambda* (#:key inputs #:allow-other-keys)
+                 (string-append #$(this-package-input "psmisc") "/bin/fuser")))
               (substitute* '("Makefile")
                 (("ABCEXTERNAL \\?=")
                  (string-append "ABCEXTERNAL = "
-                                (search-input-file inputs "/bin/abc"))))))
+                                #$(this-package-input "abc-yosyshq")
+                                "/bin/abc")))))
+          (replace 'configure
+            (lambda* (#:key make-flags #:allow-other-keys)
+              (apply invoke "make" "config-gcc" make-flags)))
           (add-after 'install 'add-symbolic-link
             (lambda* (#:key inputs #:allow-other-keys)
               ;; Previously this package provided a copy of the "abc"

base-commit: 300d29e69988caf23684f08effa51f621c7ec083
--
2.49.0