[bug#73717] gnu: Add yosys-clang.
Commit Message
* gnu/packages/fpga.scm (yosys-clang): New variable.
Change-Id: Iedbd418adc152c325d106830d9d33b73f01e65da
---
gnu/packages/fpga.scm | 54 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 54 insertions(+)
base-commit: d44beb9b4ad836781928a0c5667e94c0d6df13f0
@@ -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"))