unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Cayetano Santos via Guix-patches via <guix-patches@gnu.org>
To: 73717@debbugs.gnu.org
Cc: Cayetano Santos <csantosb@inventati.org>
Subject: [bug#73717] [PATCH] gnu: Add yosys-clang.
Date: Wed,  9 Oct 2024 09:45:02 +0200	[thread overview]
Message-ID: <8b52ca0f1d61c5ff14501fb72658b0bee716af13.1728459902.git.csantosb@inventati.org> (raw)

* gnu/packages/fpga.scm (yosys-clang): New variable.

Change-Id: Iedbd418adc152c325d106830d9d33b73f01e65da
---
 gnu/packages/fpga.scm | 54 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)

diff --git a/gnu/packages/fpga.scm b/gnu/packages/fpga.scm
index 68f36d501f..5204e041f9 100644
--- a/gnu/packages/fpga.scm
+++ b/gnu/packages/fpga.scm
@@ -224,6 +224,60 @@ (define-public yosys
     (description "Yosys synthesizes Verilog-2005.")
     (license license:isc)))
 
+(define-public yosys-clang
+  (package
+    (inherit yosys)
+    (name "yosys-clang")
+    (arguments
+     (list
+      #:test-target "test"
+      #:make-flags #~(list "CC=clang"
+                           "CXX=clang++"
+                           (string-append "PREFIX=" #$output))
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-before 'configure 'fix-paths
+            (lambda* (#:key inputs #:allow-other-keys)
+              (substitute* "./backends/smt2/smtio.py"
+                (("\\['z3")
+                 (string-append "['" (search-input-file inputs "/bin/z3"))))
+              (substitute* "./kernel/fstdata.cc"
+                (("vcd2fst")
+                 (search-input-file inputs "/bin/vcd2fst")))
+              (substitute* '("./passes/cmds/show.cc"
+                             "./passes/cmds/viz.cc")
+                (("exec xdot")
+                 (string-append "exec " (search-input-file inputs
+                                                           "/bin/xdot")))
+                (("dot -")
+                 (string-append (search-input-file inputs "/bin/dot") " -"))
+                (("fuser")
+                 (search-input-file inputs "/bin/fuser")))))
+          (replace 'configure
+            (lambda* (#:key make-flags #:allow-other-keys)
+              (apply invoke "make" "config-clang" make-flags)))
+          (add-after 'configure 'use-external-abc
+            (lambda* (#:key inputs #:allow-other-keys)
+              (substitute* '("./Makefile")
+                (("ABCEXTERNAL \\?=")
+                 (string-append "ABCEXTERNAL = "
+                                (search-input-file inputs "/bin/abc"))))))
+          (add-after 'install 'add-symbolic-link
+            (lambda* (#:key inputs #:allow-other-keys)
+              ;; Previously this package provided a copy of the "abc"
+              ;; executable in its output, named "yosys-abc".  Create a
+              ;; symbolic link so any external uses of that name continue to
+              ;; work.
+              (symlink (search-input-file inputs "/bin/abc")
+                       (string-append #$output "/bin/yosys-abc"))))
+          (add-after 'install 'wrap
+            (lambda* (#:key inputs #:allow-other-keys)
+              (wrap-program (string-append #$output "/bin/yosys-witness")
+                `("GUIX_PYTHONPATH" ":" prefix (,(getenv "GUIX_PYTHONPATH")))))))))
+    (inputs
+     (modify-inputs (package-inputs yosys)
+       (append clang)))))
+
 (define-public icestorm
   (let ((commit "2bc541743ada3542c6da36a50e66303b9cbd2059")
         (revision "4"))

base-commit: d44beb9b4ad836781928a0c5667e94c0d6df13f0
-- 
2.46.0





             reply	other threads:[~2024-10-09  7:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-09  7:45 Cayetano Santos via Guix-patches via [this message]
2024-10-12 17:50 ` [bug#73717] [PATCH v1] gnu: Add yosys-clang Cayetano Santos via Guix-patches via
2024-10-24 10:07   ` Ludovic Courtès
2024-10-24 13:49     ` Cayetano Santos via Guix-patches via
2024-10-29  8:55 ` Cayetano Santos via Guix-patches via
2024-11-21 10:56   ` [bug#73717] Control message for bug #73717 Cayetano Santos via Guix-patches via

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8b52ca0f1d61c5ff14501fb72658b0bee716af13.1728459902.git.csantosb@inventati.org \
    --to=guix-patches@gnu.org \
    --cc=73717@debbugs.gnu.org \
    --cc=csantosb@inventati.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).