gnu: yosys: Use new package style.

* gnu/packages/fpga.scm (yosys)[source]: Use gexp in snippet and don't
explicitly return #t.
[arguments]: Use gexps; use search-input-file to locate executables; simplify
parameters to "configure" phase; don't explicitly return #t from phases.
[native-inputs]: Sort alphabetically.
[inputs]: Sort alphabetically.

Signed-off-by: Christopher Baines <mail@cbaines.net>
This commit is contained in:
Simon South 2023-01-08 13:31:28 -05:00 committed by Christopher Baines
parent 535c61ccc3
commit 8b0024f8da
No known key found for this signature in database
GPG key ID: 5E28A33B0B84F577

View file

@ -150,77 +150,75 @@ (define-public yosys
(file-name (git-file-name name version)) (file-name (git-file-name name version))
(modules '((guix build utils))) (modules '((guix build utils)))
(snippet (snippet
'(begin #~(begin
(substitute* "Makefile" (substitute* "Makefile"
(("ABCREV = .*") "ABCREV = default\n")) (("ABCREV = .*") "ABCREV = default\n"))))))
#t))))
(build-system gnu-build-system) (build-system gnu-build-system)
(arguments (arguments
`(#:test-target "test" (list
#:make-flags (list "CC=gcc" #:test-target "test"
"CXX=g++" #:make-flags #~(list "CC=gcc"
(string-append "PREFIX=" %output)) "CXX=g++"
#:phases (string-append "PREFIX=" #$output))
(modify-phases %standard-phases #:phases
(add-before 'configure 'fix-paths #~(modify-phases %standard-phases
(lambda _ (add-before 'configure 'fix-paths
(substitute* "./passes/cmds/show.cc" (lambda* (#:key inputs #:allow-other-keys)
(("exec xdot") (string-append "exec " (which "xdot"))) (substitute* "./passes/cmds/show.cc"
(("dot -") (string-append (which "dot") " -")) (("exec xdot")
(("fuser") (which "fuser"))) (string-append "exec " (search-input-file inputs
#t)) "/bin/xdot")))
(replace 'configure (("dot -")
(lambda* (#:key inputs (make-flags '()) #:allow-other-keys) (string-append (search-input-file inputs "/bin/dot") " -"))
(apply invoke "make" "config-gcc" make-flags))) (("fuser")
(add-after 'configure 'prepare-abc (search-input-file inputs "/bin/fuser")))))
(lambda* (#:key inputs #:allow-other-keys) (replace 'configure
(let* ((sourceabc (assoc-ref inputs "abc")) (lambda* (#:key make-flags #:allow-other-keys)
(sourcebin (string-append sourceabc "/bin")) (apply invoke "make" "config-gcc" make-flags)))
(source (string-append sourcebin "/abc"))) (add-after 'configure 'prepare-abc
(mkdir-p "abc") (lambda* (#:key inputs #:allow-other-keys)
(call-with-output-file "abc/Makefile" (mkdir-p "abc")
(lambda (port) (call-with-output-file "abc/Makefile"
(format port ".PHONY: all\nall:\n\tcp -f abc abc-default\n"))) (lambda (port)
(copy-file source "abc/abc") (format port ".PHONY: all\nall:\n\tcp -f abc abc-default\n")))
(invoke "chmod" "+w" "abc/abc")))) (copy-file (search-input-file inputs "/bin/abc") "abc/abc")
(invoke "chmod" "+w" "abc/abc")))
(add-before 'check 'fix-iverilog-references (add-before 'check 'fix-iverilog-references
(lambda* (#:key inputs native-inputs #:allow-other-keys) (lambda* (#:key inputs native-inputs #:allow-other-keys)
(let* ((xinputs (or native-inputs inputs)) (let ((iverilog (search-input-file (or native-inputs inputs)
(xdirname (assoc-ref xinputs "iverilog")) "/bin/iverilog")))
(iverilog (string-append xdirname "/bin/iverilog"))) (substitute* '("./manual/CHAPTER_StateOfTheArt/synth.sh"
(substitute* '("./manual/CHAPTER_StateOfTheArt/synth.sh" "./manual/CHAPTER_StateOfTheArt/validate_tb.sh"
"./manual/CHAPTER_StateOfTheArt/validate_tb.sh" "./techlibs/ice40/tests/test_bram.sh"
"./techlibs/ice40/tests/test_bram.sh" "./techlibs/ice40/tests/test_ffs.sh"
"./techlibs/ice40/tests/test_ffs.sh" "./techlibs/xilinx/tests/bram1.sh"
"./techlibs/xilinx/tests/bram1.sh" "./techlibs/xilinx/tests/bram2.sh"
"./techlibs/xilinx/tests/bram2.sh" "./tests/bram/run-single.sh"
"./tests/bram/run-single.sh" "./tests/realmath/run-test.sh"
"./tests/realmath/run-test.sh" "./tests/simple/run-test.sh"
"./tests/simple/run-test.sh" "./tests/techmap/mem_simple_4x1_runtest.sh"
"./tests/techmap/mem_simple_4x1_runtest.sh" "./tests/tools/autotest.sh"
"./tests/tools/autotest.sh" "./tests/vloghtb/common.sh")
"./tests/vloghtb/common.sh") (("if ! which iverilog") "if ! true")
(("if ! which iverilog") "if ! true") (("iverilog ") (string-append iverilog " "))
(("iverilog ") (string-append iverilog " ")) (("iverilog_bin=\".*\"") (string-append "iverilog_bin=\""
(("iverilog_bin=\".*\"") (string-append "iverilog_bin=\"" iverilog "\"")))))))))
iverilog "\"")))
#t))))))
(native-inputs (native-inputs
(list pkg-config (list bison
python
bison
flex flex
gawk ; for the tests and "make" progress pretty-printing gawk ; for the tests and "make" progress pretty-printing
tcl ; tclsh for the tests iverilog ; for the tests
iverilog)) ; for the tests pkg-config
python
tcl)) ; tclsh for the tests
(inputs (inputs
(list tcl (list abc
readline
libffi
graphviz graphviz
libffi
psmisc psmisc
xdot readline
abc)) tcl
xdot))
(propagated-inputs (propagated-inputs
(list z3)) ; should be in path for yosys-smtbmc (list z3)) ; should be in path for yosys-smtbmc
(home-page "https://yosyshq.net/yosys/") (home-page "https://yosyshq.net/yosys/")