From 9e299926c6922fa3d5988540ea9d1462c5c4d7d6 Mon Sep 17 00:00:00 2001 From: Cayetano Santos Date: Tue, 23 Sep 2025 14:48:45 +0200 Subject: [PATCH] gnu: nextpnr: Add icestorm and prjtrellis checks. * gnu/packages/electronics.scm (nextpnr)[arguments]: Add run-icestorm-examples and run-prjtrellis-examples phases. [native-inputs]: Add icestorm and prjtrellis. Change-Id: Icd94efb4deb53430412422e03acc19d036470f88 Signed-off-by: Gabriel Wicki --- gnu/packages/electronics.scm | 42 +++++++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-) diff --git a/gnu/packages/electronics.scm b/gnu/packages/electronics.scm index 6d469a24dd90e83f041814d6e6b6a308f36f4b1a..3ab1ac83cec59c9010ecd221351c67ae5a371502 100644 --- a/gnu/packages/electronics.scm +++ b/gnu/packages/electronics.scm @@ -921,6 +921,10 @@ which allows one to install the M8 firmware on any Teensy.") (string-append "-DTRELLIS_INSTALL_PREFIX=" #$(this-package-input "prjtrellis")) "-DUSE_IPO=OFF") + #:modules '((guix build qt-build-system) + (guix build utils) + (ice-9 ftw) + (srfi srfi-26)) #:phases #~(modify-phases %standard-phases ;; Required by himbaechel architecture, ng-ultra support. @@ -947,10 +951,42 @@ which allows one to install the M8 firmware on any Teensy.") (("\\$\\{CMAKE_SOURCE_DIR}/3rdparty/sanitizers-cmake/cmake") (string-append #$(this-package-native-input "sanitizers-cmake") - "/share/sanitizers-cmake/cmake")))))))) + "/share/sanitizers-cmake/cmake"))))) + (add-after 'install 'run-icestorm-examples + (lambda* (#:key tests? #:allow-other-keys) + (when tests? + (setenv "PATH" + (string-append #$output "/bin:" (getenv "PATH"))) + ;; Tests need write access. + (copy-recursively + (string-append + #$(this-package-native-input "icestorm") "/examples") + "/tmp/icestorm/examples") + (with-directory-excursion "/tmp/icestorm/examples" + (for-each + (cut invoke "make" "-C" <>) + (scandir "." (negate (cut member <> '("." ".."))))))))) + (add-after 'run-icestorm-examples 'run-prjtrellis-examples + (lambda* (#:key tests? #:allow-other-keys) + (when tests? + (setenv "PATH" + (string-append #$output "/bin:" (getenv "PATH"))) + ;; Tests need write access. + (copy-recursively + (string-append + #$(this-package-native-input "prjtrellis") "/examples") + "/tmp/prjtrellis/examples") + (with-directory-excursion "/tmp/prjtrellis/examples" + (for-each + (cut invoke "make" "-C" <>) + ;; Other tests require unavailable tools. + (list "ecp5_evn" "tinyfpga_rev1" + "tinyfpga_rev2" "versa5g"))))))))) (native-inputs - (list googletest - sanitizers-cmake)) + `(("icestorm" ,(package-source icestorm)) + ("googletest" ,googletest) + ("prjtrellis" ,(package-source prjtrellis)) + ("sanitizers-cmake" ,sanitizers-cmake))) (inputs (list apycula boost