[PATCH 0/9] gnu: nextpnr-ice40: Update to 0.5.

  • Open
  • quality assurance status badge
Details
One participant
  • Simon South
Owner
unassigned
Submitted by
Simon South
Severity
normal
S
S
Simon South wrote on 9 Jan 2023 20:22
(address . guix-patches@gnu.org)
cover.1673286570.git.simon@simonsouth.net
Continuing on from issue 60429[0], here's a patch series that aims to improve
the package for nextpnr-ice40, a place-and-route tool for Lattice iCE40 FPGAs,
by

- Adding separate packages for implot, qtimgui and sanitizers-cmake, which are
currently bundled with nextpnr;

- Updating its source-repository URL to use HTTPS instead of the git protocol
(no longer supported by GitHub[1]);

- Updating it to the modern style using gexps;

- Enabling the test suite;

- Fixing the version string shown by "nextpnr-ice40 --version", which should
match the output of "git describe --tags --always" at build time but is
currently empty;

- Removing the bundled software and patching the source to use Guix packages
instead; and

- Updating nextpnr-ice40 itself to version 0.5.

I've tested this on x86-64 (command line and GUI) and AArch64 (command line
only) and everything seems fine. Note that as with Yosys, the nextpnr Web
page helpfully includes a short example of using the tool[2] for testing its
basic functionality. (The "blinky" folder is in the nextpnr source tree.)




--
Simon South
simon@simonsouth.net


Simon South (9):
gnu: Add implot.
gnu: Add qtimgui.
gnu: Add sanitizers-cmake.
gnu: nextpnr-ice40: Use HTTPS for source URL.
gnu: nextpnr-ice40: Use gexps.
gnu: nextpnr-ice40: Enable tests.
gnu: nextpnr-ice40: Fix generated version string.
gnu: nextpnr-ice40: Remove bundled software.
gnu: nextpnr-ice40: Update to 0.5.

gnu/packages/cmake.scm | 45 ++++++++++++++++++
gnu/packages/fpga.scm | 99 +++++++++++++++++++++++++++++++--------
gnu/packages/qt.scm | 63 +++++++++++++++++++++++++
gnu/packages/toolkits.scm | 50 ++++++++++++++++++++
4 files changed, 238 insertions(+), 19 deletions(-)


base-commit: de48bcee070b8d1ea6f3abe24be28d3b7d1aff68
--
2.38.1
S
S
Simon South wrote on 9 Jan 2023 20:25
[PATCH 1/9] gnu: Add implot.
(address . 60695@debbugs.gnu.org)
413b2f8271dcae1fa1b79a71874e1028fe826651.1673286570.git.simon@simonsouth.net
* gnu/packages/toolkits.scm (implot): New variable.
---
gnu/packages/toolkits.scm | 50 +++++++++++++++++++++++++++++++++++++++
1 file changed, 50 insertions(+)

Toggle diff (67 lines)
diff --git a/gnu/packages/toolkits.scm b/gnu/packages/toolkits.scm
index 3030e3aa49..81de853572 100644
--- a/gnu/packages/toolkits.scm
+++ b/gnu/packages/toolkits.scm
@@ -2,6 +2,7 @@
;;; Copyright © 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; Copyright © 2020, 2022 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2022 John Kehayias <john.kehayias@protonmail.com>
+;;; Copyright © 2023 Simon South <simon@simonsouth.net>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -141,3 +142,52 @@ (define-public imgui-1.86
(sha256
(base32
"02a7b05zrka20jhzag2jb4jl624i1m456bsv69jb9zgys2p9dv1n"))))))
+
+(define-public implot
+ (package
+ (name "implot")
+ (version "0.14")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/epezent/implot")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "0kp0h5s9dh7380yink5f091ss5cwfj321n6ym87j4skcp0giiym6"))))
+ (build-system gnu-build-system)
+ (arguments
+ (list
+ #:phases
+ #~(modify-phases %standard-phases
+ (delete 'bootstrap)
+ (delete 'configure)
+ (replace 'build
+ ;; Build a shared library from the source code.
+ (lambda* (#:key inputs #:allow-other-keys)
+ (invoke #$(cc-for-target) "-I" (getcwd)
+ "-I" (search-input-directory inputs "include/imgui")
+ "-g" "-O2" "-fPIC" "-shared"
+ "-o" "libimplot.so"
+ "implot.cpp"
+ "implot_items.cpp")))
+ (replace 'install
+ ;; Copy the library and header files to the output.
+ (lambda _
+ (install-file "libimplot.so" (string-append #$output "/lib"))
+ (for-each (lambda (file-name)
+ (install-file file-name
+ (string-append #$output
+ "/include/implot")))
+ '("implot.h" "implot_internal.h")))))
+ #:tests? #f)) ; no test suite
+ (inputs
+ (list imgui))
+ (home-page "https://github.com/epezent/implot")
+ (synopsis "Immediate-mode C++ plotting library for ImGui")
+ (description "ImPlot is an immediate-mode, GPU-accelerated plotting
+library in C++ for the ImGui GUI library, suitable for creating real-time
+visualizations or interactive plots. Like ImGui, ImPlot is self-contained and
+requires only minimal code to integrate with existing applications.")
+ (license license:expat)))
--
2.38.1
S
S
Simon South wrote on 9 Jan 2023 20:25
[PATCH 2/9] gnu: Add qtimgui.
(address . 60695@debbugs.gnu.org)
655b7031be0bb48f2c805e592357ffff430221ee.1673286570.git.simon@simonsouth.net
* gnu/packages/qt.scm (qtimgui): New variable.
---
gnu/packages/qt.scm | 63 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 63 insertions(+)

Toggle diff (90 lines)
diff --git a/gnu/packages/qt.scm b/gnu/packages/qt.scm
index 6406fd5c49..7ffb52492d 100644
--- a/gnu/packages/qt.scm
+++ b/gnu/packages/qt.scm
@@ -26,6 +26,7 @@
;;; Copyright © 2022 Foo Chuan Wei <chuanwei.foo@hotmail.com>
;;; Copyright © 2022 Zhu Zihao <all_but_last@163.com>
;;; Copyright © 2022 Petr Hodina <phodina@protonmail.com>
+;;; Copyright © 2023 Simon South <simon@simonsouth.net>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -114,6 +115,7 @@ (define-module (gnu packages qt)
#:use-module (gnu packages sqlite)
#:use-module (gnu packages telephony)
#:use-module (gnu packages tls)
+ #:use-module (gnu packages toolkits)
#:use-module (gnu packages valgrind)
#:use-module (gnu packages video)
#:use-module (gnu packages vulkan)
@@ -3548,6 +3550,67 @@ (define-public python-pyqt+qscintilla
(description
"This package contains the union of PyQt and the Qscintilla extension.")))
+(define-public qtimgui
+ (let ((commit "48d64a715b75dee24e398f7e5b0942c2ca329334")
+ (revision "0"))
+ (package
+ (name "qtimgui")
+ (version (git-version "0.0" revision commit))
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/seanchas116/qtimgui")
+ (commit commit)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "0x71j8m15w003ak0d7q346rlwyvklkda9l0dwbxfx6kny3gsl11k"))))
+ (build-system cmake-build-system)
+ (arguments
+ (list
+ #:configure-flags #~(list "-DQTIMGUI_BUILD_IMGUI=OFF"
+ "-DQTIMGUI_BUILD_IMPLOT=OFF")
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'unpack 'patch-source
+ (lambda* (#:key inputs #:allow-other-keys)
+ (substitute* "CMakeLists.txt"
+ ;; Disable building the examples.
+ (("^add_subdirectory\\(examples\\)") ""))
+ (substitute* "src/CMakeLists.txt"
+ ;; Build shared libraries, not static.
+ (("STATIC") "SHARED")
+ ;; Compile with the system imgui headers.
+ (("^(target_include_directories.*)\\)" _ prefix)
+ (string-append prefix
+ " "
+ (search-input-directory inputs
+ "include/imgui")
+ ")")))))
+ (replace 'install
+ ;; No install target provided; manually copy the header and
+ ;; library files to the output.
+ (lambda* (#:key source #:allow-other-keys)
+ (for-each
+ (lambda (file-name)
+ (install-file (string-append source "/src/" file-name)
+ (string-append #$output "/include/qtimgui")))
+ '("ImGuiRenderer.h" "QtImGui.h"))
+ (for-each
+ (lambda (file-name)
+ (install-file (string-append "src/" file-name)
+ (string-append #$output "/lib")))
+ '("libqt_imgui_quick.so" "libqt_imgui_widgets.so")))))
+ #:tests? #f)) ; no test suite
+ (inputs
+ (list imgui-1.86 implot qtbase-5 qtdeclarative-5))
+ (home-page "https://github.com/seanchas116/qtimgui")
+ (synopsis "Qt backend for the ImGui GUI library")
+ (description "QtImGui allows the ImGui C++ GUI library to be used by Qt
+applications within subclasses of @code{QOpenGLWidget} and
+@code{QOpenGLWindow}.")
+ (license license:expat))))
+
(define-public qtkeychain
(package
(name "qtkeychain")
--
2.38.1
S
S
Simon South wrote on 9 Jan 2023 20:25
[PATCH 3/9] gnu: Add sanitizers-cmake.
(address . 60695@debbugs.gnu.org)
cdabd724a4a1fbeeac50c7886a2f8ca88019a57b.1673286570.git.simon@simonsouth.net
* gnu/packages/cmake.scm (sanitizers-cmake): New variable.
---
gnu/packages/cmake.scm | 45 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 45 insertions(+)

Toggle diff (69 lines)
diff --git a/gnu/packages/cmake.scm b/gnu/packages/cmake.scm
index 87fde01f63..f0d25b707d 100644
--- a/gnu/packages/cmake.scm
+++ b/gnu/packages/cmake.scm
@@ -12,6 +12,7 @@
;;; Copyright © 2019 Pierre-Moana Levesque <pierre.moana.levesque@gmail.com>
;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
;;; Copyright © 2021 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2023 Simon South <simon@simonsouth.net>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -32,6 +33,7 @@ (define-module (gnu packages cmake)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix packages)
#:use-module (guix download)
+ #:use-module (guix gexp)
#:use-module (guix git-download)
#:use-module (guix utils)
#:use-module (guix deprecation)
@@ -422,3 +424,46 @@ (define-public emacs-cmake-mode
(description "@code{cmakeos-mode} provides an Emacs major mode for editing
Cmake files. It supports syntax highlighting, indenting and refilling of
comments.")))
+
+(define-public sanitizers-cmake
+ (let ((commit "a6748f4f51273d86312e3d27ebe5277c9b1ff870")
+ (revision "0"))
+ (package
+ (name "sanitizers-cmake")
+ (version (git-version "0.0" revision commit))
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/arsenm/sanitizers-cmake")
+ (commit commit)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "0shja5qipcsxgj5v6aic9q3dik0cbahllriigwgpayv5ng3ki1ij"))))
+ (build-system cmake-build-system)
+ (arguments
+ (list
+ #:configure-flags
+ #~(list
+ ;; Enable the "new" behavior established by CMake policy CMP0077,
+ ;; which pertains to CMake's "option()" command. This is required
+ ;; for the package's test suite to complete successfully.
+ ;; Note this setting may become redundant with future versions of
+ ;; CMake (past 3.24.2).
+ "-DCMAKE_POLICY_DEFAULT_CMP0077=NEW")
+ #:phases
+ #~(modify-phases %standard-phases
+ ;; No install target provided; manually copy files to a suitable
+ ;; folder in the output.
+ (replace 'install
+ (lambda* (#:key source #:allow-other-keys)
+ (copy-recursively
+ (string-append source "/cmake")
+ (string-append #$output "/share/" #$name "/cmake")))))))
+ (synopsis "CMake module to enable sanitizers for binary targets")
+ (description "@code{sanitizers-cmake} provides a module for the CMake
+build system that can enable address, memory, thread and undefined-behavior
+sanitizers for binary targets using flags appropriate for the compiler in
+use.")
+ (home-page "https://github.com/arsenm/sanitizers-cmake")
+ (license license:expat))))
--
2.38.1
S
S
Simon South wrote on 9 Jan 2023 20:25
[PATCH 4/9] gnu: nextpnr-ice40: Use HTTPS for source URL.
(address . 60695@debbugs.gnu.org)
ae6bc3cee7d72b30de66e6ea7c6dc823e01cec99.1673286570.git.simon@simonsouth.net
* gnu/packages/fpga.scm (nextpnr-ice40)[source]: Use HTTPS for URL.
---
gnu/packages/fpga.scm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Toggle diff (15 lines)
diff --git a/gnu/packages/fpga.scm b/gnu/packages/fpga.scm
index acce5f8f82..0924c34e0c 100644
--- a/gnu/packages/fpga.scm
+++ b/gnu/packages/fpga.scm
@@ -283,7 +283,7 @@ (define-public nextpnr-ice40
(origin
(method git-fetch)
(uri (git-reference
- (url "git://github.com/YosysHQ/nextpnr")
+ (url "https://github.com/YosysHQ/nextpnr")
(commit commit)))
(file-name (git-file-name name version))
(sha256
--
2.38.1
S
S
Simon South wrote on 9 Jan 2023 20:26
[PATCH 8/9] gnu: nextpnr-ice40: Remove bundled software.
(address . 60695@debbugs.gnu.org)
cd19342b85037ba00bea5308e4855354f2b1172c.1673286570.git.simon@simonsouth.net
* gnu/packages/fpga.scm (nextpnr-ice40)[source]: Add modules, snippet.
[native-inputs]: Add googletest, sanitizers-cmake.
[inputs]: Add imgui-1.86, pybind11, qtimgui.
[arguments]: Add "patch-source" phase; reformat gently.
---
gnu/packages/fpga.scm | 70 ++++++++++++++++++++++++++++++++++++++-----
1 file changed, 62 insertions(+), 8 deletions(-)

Toggle diff (110 lines)
diff --git a/gnu/packages/fpga.scm b/gnu/packages/fpga.scm
index 7649b2bbd6..3cb96a1cd1 100644
--- a/gnu/packages/fpga.scm
+++ b/gnu/packages/fpga.scm
@@ -7,6 +7,7 @@
;;; Copyright © 2021 Andrew Miloradovsky <andrew@interpretmath.pw>
;;; Copyright © 2022 Christian Gelinek <cgelinek@radlogic.com.au>
;;; Copyright © 2022 jgart <jgart@dismail.de>
+;;; Copyright © 2023 Simon South <simon@simonsouth.net>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -36,10 +37,12 @@ (define-module (gnu packages fpga)
#:use-module (gnu packages)
#:use-module (gnu packages autotools)
#:use-module (gnu packages base)
+ #:use-module (gnu packages cmake)
#:use-module (gnu packages compression)
#:use-module (gnu packages elf)
#:use-module (gnu packages pkg-config)
#:use-module (gnu packages tcl)
+ #:use-module (gnu packages toolkits)
#:use-module (gnu packages readline)
#:use-module (gnu packages python)
#:use-module (gnu packages python-xyz)
@@ -289,23 +292,74 @@ (define-public nextpnr-ice40
(file-name (git-file-name name version))
(sha256
(base32
- "1llkrh8rk1a1xxzx54apbg49ny2jqzzl2rmbkb8188idipq568ws"))))
+ "1llkrh8rk1a1xxzx54apbg49ny2jqzzl2rmbkb8188idipq568ws"))
+ (modules '((guix build utils)))
+ (snippet
+ #~(begin
+ ;; Remove bundled source code for which Guix has packages.
+ ;; Note the bundled copies of json11 and python-console contain
+ ;; modifications, while QtPropertyBrowser appears to be
+ ;; abandoned and without an official source.
+ (with-directory-excursion "3rdparty"
+ (for-each delete-file-recursively
+ '("googletest" "imgui" "pybind11" "qtimgui"
+ "sanitizers-cmake")))
+
+ ;; Remove references to unbundled code and link against
+ ;; external libraries instead.
+ (substitute* "CMakeLists.txt"
+ (("^\\s+add_subdirectory\\(3rdparty/googletest.*") "")
+ (("^(\\s+target_link_libraries.*)( gtest_main\\))"
+ _ prefix suffix)
+ (string-append prefix " gtest" suffix)))
+ (substitute* "gui/CMakeLists.txt"
+ (("^\\s+../3rdparty/(qt)?imgui.*") "")
+ (("^(target_link_libraries.*)\\)" _ prefix)
+ (string-append prefix " imgui qt_imgui_widgets)")))))))
+ (native-inputs
+ (list googletest sanitizers-cmake))
(inputs
(list boost
eigen
icestorm
+ imgui-1.86
+ pybind11
python
qtbase-5
+ qtimgui
yosys))
(build-system cmake-build-system)
(arguments
- (list #:configure-flags #~(list "-DARCH=ice40"
- "-DBUILD_TESTS=ON"
- (string-append "-DCURRENT_GIT_VERSION="
- #$(string-take commit 8))
- (string-append "-DICEBOX_ROOT="
- #$icestorm
- "/share/icebox"))))
+ (list
+ #:configure-flags
+ #~(list "-DARCH=ice40"
+ "-DBUILD_TESTS=ON"
+ (string-append "-DCURRENT_GIT_VERSION="
+ #$(string-take commit 8))
+ (string-append "-DICEBOX_ROOT=" #$icestorm "/share/icebox"))
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'unpack 'patch-source
+ (lambda* (#:key inputs #:allow-other-keys)
+ (substitute* "CMakeLists.txt"
+ ;; Use the system sanitizers-cmake module.
+ (("\\$\\{CMAKE_SOURCE_DIR\\}/3rdparty/sanitizers-cmake/cmake")
+ (string-append #$sanitizers-cmake
+ "/share/sanitizers-cmake/cmake")))
+ (substitute* "gui/CMakeLists.txt"
+ ;; Compile with system imgui and qtimgui headers.
+ (("^(target_include_directories.*)../3rdparty/imgui(.*)$"
+ _ prefix suffix)
+ (string-append prefix
+ (search-input-directory inputs
+ "include/imgui")
+ suffix))
+ (("^(target_include_directories.*)../3rdparty/qtimgui/(.*)$"
+ _ prefix suffix)
+ (string-append prefix
+ (search-input-directory inputs
+ "include/qtimgui")
+ suffix))))))))
(synopsis "Place-and-Route tool for FPGAs")
(description "Nextpnr aims to be a vendor neutral, timing driven,
FOSS FPGA place and route tool.")
--
2.38.1
S
S
Simon South wrote on 9 Jan 2023 20:26
[PATCH 6/9] gnu: nextpnr-ice40: Enable tests.
(address . 60695@debbugs.gnu.org)
51964922a525a03b82b8eb0256228a9d1f132c22.1673286570.git.simon@simonsouth.net
* gnu/packages/fpga.scm (nextpnr-ice40)[source]: Enable recursive checkout.
[arguments]<#:configure-flags>: Add "-DBUILD_TESTS".
<#:tests?>: Remove.
---
gnu/packages/fpga.scm | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)

Toggle diff (34 lines)
diff --git a/gnu/packages/fpga.scm b/gnu/packages/fpga.scm
index 817ebe3f6b..947fe05dd0 100644
--- a/gnu/packages/fpga.scm
+++ b/gnu/packages/fpga.scm
@@ -284,11 +284,12 @@ (define-public nextpnr-ice40
(method git-fetch)
(uri (git-reference
(url "https://github.com/YosysHQ/nextpnr")
- (commit commit)))
+ (commit commit)
+ (recursive? #t)))
(file-name (git-file-name name version))
(sha256
(base32
- "1fmxsywgs45g88ra7ips5s2niiiwrkyxdcy742ws18dfk2y4vi9c"))))
+ "1llkrh8rk1a1xxzx54apbg49ny2jqzzl2rmbkb8188idipq568ws"))))
(inputs
(list boost
eigen
@@ -299,10 +300,10 @@ (define-public nextpnr-ice40
(build-system cmake-build-system)
(arguments
(list #:configure-flags #~(list "-DARCH=ice40"
+ "-DBUILD_TESTS=ON"
(string-append "-DICEBOX_ROOT="
#$icestorm
- "/share/icebox"))
- #:tests? #f))
+ "/share/icebox"))))
(synopsis "Place-and-Route tool for FPGAs")
(description "Nextpnr aims to be a vendor neutral, timing driven,
FOSS FPGA place and route tool.")
--
2.38.1
S
S
Simon South wrote on 9 Jan 2023 20:25
[PATCH 5/9] gnu: nextpnr-ice40: Use gexps.
(address . 60695@debbugs.gnu.org)
3a7ade2a7100f62cf7d3e7b4a25bb7829465f404.1673286570.git.simon@simonsouth.net
* gnu/packages/fpga.scm (nextpnr-ice40)[arguments]: Use gexps.
---
gnu/packages/fpga.scm | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

Toggle diff (23 lines)
diff --git a/gnu/packages/fpga.scm b/gnu/packages/fpga.scm
index 0924c34e0c..817ebe3f6b 100644
--- a/gnu/packages/fpga.scm
+++ b/gnu/packages/fpga.scm
@@ -298,11 +298,11 @@ (define-public nextpnr-ice40
yosys))
(build-system cmake-build-system)
(arguments
- `(#:configure-flags `("-DARCH=ice40"
- ,(string-append "-DICEBOX_ROOT="
- (assoc-ref %build-inputs "icestorm")
- "/share/icebox"))
- #:tests? #f))
+ (list #:configure-flags #~(list "-DARCH=ice40"
+ (string-append "-DICEBOX_ROOT="
+ #$icestorm
+ "/share/icebox"))
+ #:tests? #f))
(synopsis "Place-and-Route tool for FPGAs")
(description "Nextpnr aims to be a vendor neutral, timing driven,
FOSS FPGA place and route tool.")
--
2.38.1
S
S
Simon South wrote on 9 Jan 2023 20:26
[PATCH 7/9] gnu: nextpnr-ice40: Fix generated version string.
(address . 60695@debbugs.gnu.org)
c9eea74696e1180307ba56ff15d0e4dc1a7ad41a.1673286570.git.simon@simonsouth.net
* gnu/packages/fpga.scm (nextpnr-ice40)[arguments]<#:configure-flags>: Add
"-DCURRENT_GIT_VERSION".
---
gnu/packages/fpga.scm | 2 ++
1 file changed, 2 insertions(+)

Toggle diff (15 lines)
diff --git a/gnu/packages/fpga.scm b/gnu/packages/fpga.scm
index 947fe05dd0..7649b2bbd6 100644
--- a/gnu/packages/fpga.scm
+++ b/gnu/packages/fpga.scm
@@ -301,6 +301,8 @@ (define-public nextpnr-ice40
(arguments
(list #:configure-flags #~(list "-DARCH=ice40"
"-DBUILD_TESTS=ON"
+ (string-append "-DCURRENT_GIT_VERSION="
+ #$(string-take commit 8))
(string-append "-DICEBOX_ROOT="
#$icestorm
"/share/icebox"))))
--
2.38.1
S
S
Simon South wrote on 9 Jan 2023 20:26
[PATCH 9/9] gnu: nextpnr-ice40: Update to 0.5.
(address . 60695@debbugs.gnu.org)
be3e08108aa9af5315176fbda368dbdfa4aa9b0a.1673286570.git.simon@simonsouth.net
* gnu/packages/fpga.scm (nextpnr-ice40): Update to 0.5.
[arguments]<#:configure-flags>: Add "-DBUILD_GUI", "-DUSE_IPO"; update
"-DCURRENT_GIT_VERSION"; rename "-DICEBOX_ROOT" to
"-DICESTORM_INSTALL_PREFIX".
---
gnu/packages/fpga.scm | 84 ++++++++++++++++++++++---------------------
1 file changed, 44 insertions(+), 40 deletions(-)

Toggle diff (116 lines)
diff --git a/gnu/packages/fpga.scm b/gnu/packages/fpga.scm
index 3cb96a1cd1..ed1323346a 100644
--- a/gnu/packages/fpga.scm
+++ b/gnu/packages/fpga.scm
@@ -277,45 +277,48 @@ (define-public icestorm
(license license:isc))))
(define-public nextpnr-ice40
- (let [(commit "fbe486df459909065d6852a7495a212dfd2accef")
- (revision "1")]
+ (let* ((version "0.5")
+ (tag (string-append "nextpnr-" version)))
(package
(name "nextpnr-ice40")
- (version (git-version "0.0.0" revision commit))
+ (version version)
(source
- (origin
- (method git-fetch)
- (uri (git-reference
- (url "https://github.com/YosysHQ/nextpnr")
- (commit commit)
- (recursive? #t)))
- (file-name (git-file-name name version))
- (sha256
- (base32
- "1llkrh8rk1a1xxzx54apbg49ny2jqzzl2rmbkb8188idipq568ws"))
- (modules '((guix build utils)))
- (snippet
- #~(begin
- ;; Remove bundled source code for which Guix has packages.
- ;; Note the bundled copies of json11 and python-console contain
- ;; modifications, while QtPropertyBrowser appears to be
- ;; abandoned and without an official source.
- (with-directory-excursion "3rdparty"
- (for-each delete-file-recursively
- '("googletest" "imgui" "pybind11" "qtimgui"
- "sanitizers-cmake")))
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/YosysHQ/nextpnr")
+ (commit tag)
+ (recursive? #t)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "119iqxxzbxq2qy8x20awf9gr0nf3y1yjmk36adsg89ly3rb9gwzk"))
+ (modules '((guix build utils)))
+ (snippet
+ #~(begin
+ ;; Remove bundled source code for which Guix has packages.
+ ;; Note the bundled copies of json11 and python-console contain
+ ;; modifications, while QtPropertyBrowser appears to be
+ ;; abandoned and without an official source.
+ ;; fpga-interchange-schema is used only by the
+ ;; "fpga_interchange" architecture target, which this package
+ ;; doesn't build.
+ (with-directory-excursion "3rdparty"
+ (for-each delete-file-recursively
+ '("googletest" "imgui" "pybind11" "qtimgui"
+ "sanitizers-cmake")))
- ;; Remove references to unbundled code and link against
- ;; external libraries instead.
- (substitute* "CMakeLists.txt"
- (("^\\s+add_subdirectory\\(3rdparty/googletest.*") "")
- (("^(\\s+target_link_libraries.*)( gtest_main\\))"
- _ prefix suffix)
- (string-append prefix " gtest" suffix)))
- (substitute* "gui/CMakeLists.txt"
- (("^\\s+../3rdparty/(qt)?imgui.*") "")
- (("^(target_link_libraries.*)\\)" _ prefix)
- (string-append prefix " imgui qt_imgui_widgets)")))))))
+ ;; Remove references to unbundled code and link against external
+ ;; libraries instead.
+ (substitute* "CMakeLists.txt"
+ (("^\\s+add_subdirectory\\(3rdparty/googletest.*") "")
+ (("^(\\s+target_link_libraries.*)( gtest_main\\))"
+ _ prefix suffix)
+ (string-append prefix " gtest" suffix)))
+ (substitute* "gui/CMakeLists.txt"
+ (("^\\s+../3rdparty/(qt)?imgui.*") "")
+ (("^(target_link_libraries.*)\\)" _ prefix)
+ (string-append prefix " imgui qt_imgui_widgets)")))))))
(native-inputs
(list googletest sanitizers-cmake))
(inputs
@@ -333,10 +336,11 @@ (define-public nextpnr-ice40
(list
#:configure-flags
#~(list "-DARCH=ice40"
+ "-DBUILD_GUI=ON"
"-DBUILD_TESTS=ON"
- (string-append "-DCURRENT_GIT_VERSION="
- #$(string-take commit 8))
- (string-append "-DICEBOX_ROOT=" #$icestorm "/share/icebox"))
+ (string-append "-DCURRENT_GIT_VERSION=" #$tag)
+ (string-append "-DICESTORM_INSTALL_PREFIX=" #$icestorm)
+ "-DUSE_IPO=OFF")
#:phases
#~(modify-phases %standard-phases
(add-after 'unpack 'patch-source
@@ -361,8 +365,8 @@ (define-public nextpnr-ice40
"include/qtimgui")
suffix))))))))
(synopsis "Place-and-Route tool for FPGAs")
- (description "Nextpnr aims to be a vendor neutral, timing driven,
-FOSS FPGA place and route tool.")
+ (description "Nextpnr aims to be a vendor neutral, timing driven, FOSS
+FPGA place and route tool.")
(home-page "https://github.com/YosysHQ/nextpnr")
(license license:expat))))
--
2.38.1
S
S
Simon South wrote on 27 Jan 2023 21:34
[PATCH v2 2/9] gnu: Add qtimgui.
(address . 60695@debbugs.gnu.org)
a1552902349ee81d6038298215f04f988b06c89b.1674850363.git.simon@simonsouth.net
* gnu/packages/qt.scm (qtimgui): New variable.
---
gnu/packages/qt.scm | 63 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 63 insertions(+)

Toggle diff (90 lines)
diff --git a/gnu/packages/qt.scm b/gnu/packages/qt.scm
index 14fc73ef28..d513794484 100644
--- a/gnu/packages/qt.scm
+++ b/gnu/packages/qt.scm
@@ -26,6 +26,7 @@
;;; Copyright © 2022 Foo Chuan Wei <chuanwei.foo@hotmail.com>
;;; Copyright © 2022 Zhu Zihao <all_but_last@163.com>
;;; Copyright © 2022 Petr Hodina <phodina@protonmail.com>
+;;; Copyright © 2023 Simon South <simon@simonsouth.net>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -114,6 +115,7 @@ (define-module (gnu packages qt)
#:use-module (gnu packages sqlite)
#:use-module (gnu packages telephony)
#:use-module (gnu packages tls)
+ #:use-module (gnu packages toolkits)
#:use-module (gnu packages valgrind)
#:use-module (gnu packages video)
#:use-module (gnu packages vulkan)
@@ -3550,6 +3552,67 @@ (define-public python-pyqt+qscintilla
(description
"This package contains the union of PyQt and the Qscintilla extension.")))
+(define-public qtimgui
+ (let ((commit "48d64a715b75dee24e398f7e5b0942c2ca329334")
+ (revision "0"))
+ (package
+ (name "qtimgui")
+ (version (git-version "0.0" revision commit))
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/seanchas116/qtimgui")
+ (commit commit)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "0x71j8m15w003ak0d7q346rlwyvklkda9l0dwbxfx6kny3gsl11k"))))
+ (build-system cmake-build-system)
+ (arguments
+ (list
+ #:configure-flags #~(list "-DQTIMGUI_BUILD_IMGUI=OFF"
+ "-DQTIMGUI_BUILD_IMPLOT=OFF")
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'unpack 'patch-source
+ (lambda* (#:key inputs #:allow-other-keys)
+ (substitute* "CMakeLists.txt"
+ ;; Disable building the examples.
+ (("^add_subdirectory\\(examples\\)") ""))
+ (substitute* "src/CMakeLists.txt"
+ ;; Build shared libraries, not static.
+ (("STATIC") "SHARED")
+ ;; Compile with the system imgui headers.
+ (("^(target_include_directories.*)\\)" _ prefix)
+ (string-append prefix
+ " "
+ (search-input-directory inputs
+ "include/imgui")
+ ")")))))
+ (replace 'install
+ ;; No install target provided; manually copy the header and
+ ;; library files to the output.
+ (lambda* (#:key source #:allow-other-keys)
+ (for-each
+ (lambda (file-name)
+ (install-file (string-append source "/src/" file-name)
+ (string-append #$output "/include/qtimgui")))
+ '("ImGuiRenderer.h" "QtImGui.h"))
+ (for-each
+ (lambda (file-name)
+ (install-file (string-append "src/" file-name)
+ (string-append #$output "/lib")))
+ '("libqt_imgui_quick.so" "libqt_imgui_widgets.so")))))
+ #:tests? #f)) ; no test suite
+ (inputs
+ (list imgui-1.86 implot qtbase-5 qtdeclarative-5))
+ (home-page "https://github.com/seanchas116/qtimgui")
+ (synopsis "Qt backend for the ImGui GUI library")
+ (description "QtImGui allows the ImGui C++ GUI library to be used by Qt
+applications within subclasses of @code{QOpenGLWidget} and
+@code{QOpenGLWindow}.")
+ (license license:expat))))
+
(define-public qtkeychain
(package
(name "qtkeychain")
--
2.38.1
S
S
Simon South wrote on 27 Jan 2023 21:34
[PATCH v2 0/9] gnu: nextpnr-ice40: Update to 0.5.
(address . 60695@debbugs.gnu.org)
cover.1674850363.git.simon@simonsouth.net
Following a comment[0] from ( on another issue, here's a v2 of this patch
series that refers to package inputs appropriately using "this-package-input"
and "this-package-native-input" instead of by variable name.

This affects primarily patches 5 and 8, in references to icestorm and
sanitizers-cmake; aside from differences in formatting resulting from these
changes, the remaining patches are the same as before.

I've re-tested this on AArch64 and everything appears fine. The original
cover letter follows below.


--
Simon South
simon@simonsouth.net


Continuing on from issue 60429[0], here's a patch series that aims to improve
the package for nextpnr-ice40, a place-and-route tool for Lattice iCE40 FPGAs,
by

- Adding separate packages for implot, qtimgui and sanitizers-cmake, which are
currently bundled with nextpnr;

- Updating its source-repository URL to use HTTPS instead of the git protocol
(no longer supported by GitHub[1]);

- Updating it to the modern style using gexps;

- Enabling the test suite;

- Fixing the version string shown by "nextpnr-ice40 --version", which should
match the output of "git describe --tags --always" at build time but is
currently empty;

- Removing the bundled software and patching the source to use Guix packages
instead; and

- Updating nextpnr-ice40 itself to version 0.5.

I've tested this on x86-64 (command line and GUI) and AArch64 (command line
only) and everything seems fine. Note that as with Yosys, the nextpnr Web
page helpfully includes a short example of using the tool[2] for testing its
basic functionality. (The "blinky" folder is in the nextpnr source tree.)




--
Simon South
simon@simonsouth.net


Simon South (9):
gnu: Add implot.
gnu: Add qtimgui.
gnu: Add sanitizers-cmake.
gnu: nextpnr-ice40: Use HTTPS for source URL.
gnu: nextpnr-ice40: Use gexps.
gnu: nextpnr-ice40: Enable tests.
gnu: nextpnr-ice40: Fix generated version string.
gnu: nextpnr-ice40: Remove bundled software.
gnu: nextpnr-ice40: Update to 0.5.

gnu/packages/cmake.scm | 45 +++++++++++++++++
gnu/packages/fpga.scm | 101 +++++++++++++++++++++++++++++++-------
gnu/packages/qt.scm | 63 ++++++++++++++++++++++++
gnu/packages/toolkits.scm | 50 +++++++++++++++++++
4 files changed, 240 insertions(+), 19 deletions(-)


base-commit: 8e1cca32b938cef0812ce042c6c2e8bccb326ec7
prerequisite-patch-id: 63e61bd0fe7b4cd3b7f4b15c594172579674e67b
prerequisite-patch-id: 14469ab44ea45c68c034574747dcf39f1b0d4c8c
prerequisite-patch-id: 22efe5c3a9047003160bc343e7b1e12d813b5fcf
prerequisite-patch-id: dfbdd64c8cb4841ee2d6d6e0498f9336de21888b
prerequisite-patch-id: 033f40ecd2d1ff437359b411482b9fe57b64baf3
--
2.38.1
S
S
Simon South wrote on 27 Jan 2023 21:34
[PATCH v2 5/9] gnu: nextpnr-ice40: Use gexps.
(address . 60695@debbugs.gnu.org)
474ea48b61450f18d8518e3c4bbbab13e5efe4af.1674850363.git.simon@simonsouth.net
* gnu/packages/fpga.scm (nextpnr-ice40)[arguments]: Use gexps.
---
gnu/packages/fpga.scm | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)

Toggle diff (24 lines)
diff --git a/gnu/packages/fpga.scm b/gnu/packages/fpga.scm
index bf5ce0e516..b710bce553 100644
--- a/gnu/packages/fpga.scm
+++ b/gnu/packages/fpga.scm
@@ -268,11 +268,12 @@ (define-public nextpnr-ice40
yosys))
(build-system cmake-build-system)
(arguments
- `(#:configure-flags `("-DARCH=ice40"
- ,(string-append "-DICEBOX_ROOT="
- (assoc-ref %build-inputs "icestorm")
- "/share/icebox"))
- #:tests? #f))
+ (list #:configure-flags
+ #~(list "-DARCH=ice40"
+ (string-append "-DICEBOX_ROOT="
+ #$(this-package-input "icestorm")
+ "/share/icebox"))
+ #:tests? #f))
(synopsis "Place-and-Route tool for FPGAs")
(description "Nextpnr aims to be a vendor neutral, timing driven,
FOSS FPGA place and route tool.")
--
2.38.1
S
S
Simon South wrote on 27 Jan 2023 21:34
[PATCH v2 3/9] gnu: Add sanitizers-cmake.
(address . 60695@debbugs.gnu.org)
c22b9e71249384e6f61ed27b4d2e14afab291c18.1674850363.git.simon@simonsouth.net
* gnu/packages/cmake.scm (sanitizers-cmake): New variable.
---
gnu/packages/cmake.scm | 45 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 45 insertions(+)

Toggle diff (69 lines)
diff --git a/gnu/packages/cmake.scm b/gnu/packages/cmake.scm
index 87fde01f63..f0d25b707d 100644
--- a/gnu/packages/cmake.scm
+++ b/gnu/packages/cmake.scm
@@ -12,6 +12,7 @@
;;; Copyright © 2019 Pierre-Moana Levesque <pierre.moana.levesque@gmail.com>
;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
;;; Copyright © 2021 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2023 Simon South <simon@simonsouth.net>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -32,6 +33,7 @@ (define-module (gnu packages cmake)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix packages)
#:use-module (guix download)
+ #:use-module (guix gexp)
#:use-module (guix git-download)
#:use-module (guix utils)
#:use-module (guix deprecation)
@@ -422,3 +424,46 @@ (define-public emacs-cmake-mode
(description "@code{cmakeos-mode} provides an Emacs major mode for editing
Cmake files. It supports syntax highlighting, indenting and refilling of
comments.")))
+
+(define-public sanitizers-cmake
+ (let ((commit "a6748f4f51273d86312e3d27ebe5277c9b1ff870")
+ (revision "0"))
+ (package
+ (name "sanitizers-cmake")
+ (version (git-version "0.0" revision commit))
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/arsenm/sanitizers-cmake")
+ (commit commit)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "0shja5qipcsxgj5v6aic9q3dik0cbahllriigwgpayv5ng3ki1ij"))))
+ (build-system cmake-build-system)
+ (arguments
+ (list
+ #:configure-flags
+ #~(list
+ ;; Enable the "new" behavior established by CMake policy CMP0077,
+ ;; which pertains to CMake's "option()" command. This is required
+ ;; for the package's test suite to complete successfully.
+ ;; Note this setting may become redundant with future versions of
+ ;; CMake (past 3.24.2).
+ "-DCMAKE_POLICY_DEFAULT_CMP0077=NEW")
+ #:phases
+ #~(modify-phases %standard-phases
+ ;; No install target provided; manually copy files to a suitable
+ ;; folder in the output.
+ (replace 'install
+ (lambda* (#:key source #:allow-other-keys)
+ (copy-recursively
+ (string-append source "/cmake")
+ (string-append #$output "/share/" #$name "/cmake")))))))
+ (synopsis "CMake module to enable sanitizers for binary targets")
+ (description "@code{sanitizers-cmake} provides a module for the CMake
+build system that can enable address, memory, thread and undefined-behavior
+sanitizers for binary targets using flags appropriate for the compiler in
+use.")
+ (home-page "https://github.com/arsenm/sanitizers-cmake")
+ (license license:expat))))
--
2.38.1
S
S
Simon South wrote on 27 Jan 2023 21:34
[PATCH v2 1/9] gnu: Add implot.
(address . 60695@debbugs.gnu.org)
a0b76d6447d711358ad45db6d6c12c7601dde214.1674850363.git.simon@simonsouth.net
* gnu/packages/toolkits.scm (implot): New variable.
---
gnu/packages/toolkits.scm | 50 +++++++++++++++++++++++++++++++++++++++
1 file changed, 50 insertions(+)

Toggle diff (67 lines)
diff --git a/gnu/packages/toolkits.scm b/gnu/packages/toolkits.scm
index 3030e3aa49..81de853572 100644
--- a/gnu/packages/toolkits.scm
+++ b/gnu/packages/toolkits.scm
@@ -2,6 +2,7 @@
;;; Copyright © 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; Copyright © 2020, 2022 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2022 John Kehayias <john.kehayias@protonmail.com>
+;;; Copyright © 2023 Simon South <simon@simonsouth.net>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -141,3 +142,52 @@ (define-public imgui-1.86
(sha256
(base32
"02a7b05zrka20jhzag2jb4jl624i1m456bsv69jb9zgys2p9dv1n"))))))
+
+(define-public implot
+ (package
+ (name "implot")
+ (version "0.14")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/epezent/implot")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "0kp0h5s9dh7380yink5f091ss5cwfj321n6ym87j4skcp0giiym6"))))
+ (build-system gnu-build-system)
+ (arguments
+ (list
+ #:phases
+ #~(modify-phases %standard-phases
+ (delete 'bootstrap)
+ (delete 'configure)
+ (replace 'build
+ ;; Build a shared library from the source code.
+ (lambda* (#:key inputs #:allow-other-keys)
+ (invoke #$(cc-for-target) "-I" (getcwd)
+ "-I" (search-input-directory inputs "include/imgui")
+ "-g" "-O2" "-fPIC" "-shared"
+ "-o" "libimplot.so"
+ "implot.cpp"
+ "implot_items.cpp")))
+ (replace 'install
+ ;; Copy the library and header files to the output.
+ (lambda _
+ (install-file "libimplot.so" (string-append #$output "/lib"))
+ (for-each (lambda (file-name)
+ (install-file file-name
+ (string-append #$output
+ "/include/implot")))
+ '("implot.h" "implot_internal.h")))))
+ #:tests? #f)) ; no test suite
+ (inputs
+ (list imgui))
+ (home-page "https://github.com/epezent/implot")
+ (synopsis "Immediate-mode C++ plotting library for ImGui")
+ (description "ImPlot is an immediate-mode, GPU-accelerated plotting
+library in C++ for the ImGui GUI library, suitable for creating real-time
+visualizations or interactive plots. Like ImGui, ImPlot is self-contained and
+requires only minimal code to integrate with existing applications.")
+ (license license:expat)))
--
2.38.1
S
S
Simon South wrote on 27 Jan 2023 21:34
[PATCH v2 4/9] gnu: nextpnr-ice40: Use HTTPS for source URL.
(address . 60695@debbugs.gnu.org)
9ec251f971ba053eb336b41fd0471905241d96a5.1674850363.git.simon@simonsouth.net
* gnu/packages/fpga.scm (nextpnr-ice40)[source]: Use HTTPS for URL.
---
gnu/packages/fpga.scm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Toggle diff (15 lines)
diff --git a/gnu/packages/fpga.scm b/gnu/packages/fpga.scm
index 45cf0e74cf..bf5ce0e516 100644
--- a/gnu/packages/fpga.scm
+++ b/gnu/packages/fpga.scm
@@ -253,7 +253,7 @@ (define-public nextpnr-ice40
(origin
(method git-fetch)
(uri (git-reference
- (url "git://github.com/YosysHQ/nextpnr")
+ (url "https://github.com/YosysHQ/nextpnr")
(commit commit)))
(file-name (git-file-name name version))
(sha256
--
2.38.1
S
S
Simon South wrote on 27 Jan 2023 21:34
[PATCH v2 6/9] gnu: nextpnr-ice40: Enable tests.
(address . 60695@debbugs.gnu.org)
1a9d17ed3f7b4493c6dc90603497b83b8f69e125.1674850363.git.simon@simonsouth.net
* gnu/packages/fpga.scm (nextpnr-ice40)[source]: Enable recursive checkout.
[arguments]<#:configure-flags>: Add "-DBUILD_TESTS".
<#:tests?>: Remove.
---
gnu/packages/fpga.scm | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)

Toggle diff (34 lines)
diff --git a/gnu/packages/fpga.scm b/gnu/packages/fpga.scm
index b710bce553..ae70c5e6ab 100644
--- a/gnu/packages/fpga.scm
+++ b/gnu/packages/fpga.scm
@@ -254,11 +254,12 @@ (define-public nextpnr-ice40
(method git-fetch)
(uri (git-reference
(url "https://github.com/YosysHQ/nextpnr")
- (commit commit)))
+ (commit commit)
+ (recursive? #t)))
(file-name (git-file-name name version))
(sha256
(base32
- "1fmxsywgs45g88ra7ips5s2niiiwrkyxdcy742ws18dfk2y4vi9c"))))
+ "1llkrh8rk1a1xxzx54apbg49ny2jqzzl2rmbkb8188idipq568ws"))))
(inputs
(list boost
eigen
@@ -270,10 +271,10 @@ (define-public nextpnr-ice40
(arguments
(list #:configure-flags
#~(list "-DARCH=ice40"
+ "-DBUILD_TESTS=ON"
(string-append "-DICEBOX_ROOT="
#$(this-package-input "icestorm")
- "/share/icebox"))
- #:tests? #f))
+ "/share/icebox"))))
(synopsis "Place-and-Route tool for FPGAs")
(description "Nextpnr aims to be a vendor neutral, timing driven,
FOSS FPGA place and route tool.")
--
2.38.1
S
S
Simon South wrote on 27 Jan 2023 21:34
[PATCH v2 7/9] gnu: nextpnr-ice40: Fix generated version string.
(address . 60695@debbugs.gnu.org)
b462625a6b1bea897b72fd5771dcd2f85a2ccaa4.1674850363.git.simon@simonsouth.net
* gnu/packages/fpga.scm (nextpnr-ice40)[arguments]<#:configure-flags>: Add
"-DCURRENT_GIT_VERSION".
---
gnu/packages/fpga.scm | 2 ++
1 file changed, 2 insertions(+)

Toggle diff (15 lines)
diff --git a/gnu/packages/fpga.scm b/gnu/packages/fpga.scm
index ae70c5e6ab..60a6a143c9 100644
--- a/gnu/packages/fpga.scm
+++ b/gnu/packages/fpga.scm
@@ -272,6 +272,8 @@ (define-public nextpnr-ice40
(list #:configure-flags
#~(list "-DARCH=ice40"
"-DBUILD_TESTS=ON"
+ (string-append "-DCURRENT_GIT_VERSION="
+ #$(string-take commit 8))
(string-append "-DICEBOX_ROOT="
#$(this-package-input "icestorm")
"/share/icebox"))))
--
2.38.1
S
S
Simon South wrote on 27 Jan 2023 21:34
[PATCH v2 9/9] gnu: nextpnr-ice40: Update to 0.5.
(address . 60695@debbugs.gnu.org)
f6d9d83768d52b96bfde8c837c8e822caef60b8d.1674850363.git.simon@simonsouth.net
* gnu/packages/fpga.scm (nextpnr-ice40): Update to 0.5.
[arguments]<#:configure-flags>: Add "-DBUILD_GUI", "-DUSE_IPO"; update
"-DCURRENT_GIT_VERSION"; rename "-DICEBOX_ROOT" to
"-DICESTORM_INSTALL_PREFIX".
---
gnu/packages/fpga.scm | 87 ++++++++++++++++++++++---------------------
1 file changed, 45 insertions(+), 42 deletions(-)

Toggle diff (119 lines)
diff --git a/gnu/packages/fpga.scm b/gnu/packages/fpga.scm
index 912b6cfb77..54a8d9550e 100644
--- a/gnu/packages/fpga.scm
+++ b/gnu/packages/fpga.scm
@@ -247,45 +247,48 @@ (define-public icestorm
(license license:isc))))
(define-public nextpnr-ice40
- (let [(commit "fbe486df459909065d6852a7495a212dfd2accef")
- (revision "1")]
+ (let* ((version "0.5")
+ (tag (string-append "nextpnr-" version)))
(package
(name "nextpnr-ice40")
- (version (git-version "0.0.0" revision commit))
+ (version version)
(source
- (origin
- (method git-fetch)
- (uri (git-reference
- (url "https://github.com/YosysHQ/nextpnr")
- (commit commit)
- (recursive? #t)))
- (file-name (git-file-name name version))
- (sha256
- (base32
- "1llkrh8rk1a1xxzx54apbg49ny2jqzzl2rmbkb8188idipq568ws"))
- (modules '((guix build utils)))
- (snippet
- #~(begin
- ;; Remove bundled source code for which Guix has packages.
- ;; Note the bundled copies of json11 and python-console contain
- ;; modifications, while QtPropertyBrowser appears to be
- ;; abandoned and without an official source.
- (with-directory-excursion "3rdparty"
- (for-each delete-file-recursively
- '("googletest" "imgui" "pybind11" "qtimgui"
- "sanitizers-cmake")))
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/YosysHQ/nextpnr")
+ (commit tag)
+ (recursive? #t)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "119iqxxzbxq2qy8x20awf9gr0nf3y1yjmk36adsg89ly3rb9gwzk"))
+ (modules '((guix build utils)))
+ (snippet
+ #~(begin
+ ;; Remove bundled source code for which Guix has packages.
+ ;; Note the bundled copies of json11 and python-console contain
+ ;; modifications, while QtPropertyBrowser appears to be
+ ;; abandoned and without an official source.
+ ;; fpga-interchange-schema is used only by the
+ ;; "fpga_interchange" architecture target, which this package
+ ;; doesn't build.
+ (with-directory-excursion "3rdparty"
+ (for-each delete-file-recursively
+ '("googletest" "imgui" "pybind11" "qtimgui"
+ "sanitizers-cmake")))
- ;; Remove references to unbundled code and link against
- ;; external libraries instead.
- (substitute* "CMakeLists.txt"
- (("^\\s+add_subdirectory\\(3rdparty/googletest.*") "")
- (("^(\\s+target_link_libraries.*)( gtest_main\\))"
- _ prefix suffix)
- (string-append prefix " gtest" suffix)))
- (substitute* "gui/CMakeLists.txt"
- (("^\\s+../3rdparty/(qt)?imgui.*") "")
- (("^(target_link_libraries.*)\\)" _ prefix)
- (string-append prefix " imgui qt_imgui_widgets)")))))))
+ ;; Remove references to unbundled code and link against external
+ ;; libraries instead.
+ (substitute* "CMakeLists.txt"
+ (("^\\s+add_subdirectory\\(3rdparty/googletest.*") "")
+ (("^(\\s+target_link_libraries.*)( gtest_main\\))"
+ _ prefix suffix)
+ (string-append prefix " gtest" suffix)))
+ (substitute* "gui/CMakeLists.txt"
+ (("^\\s+../3rdparty/(qt)?imgui.*") "")
+ (("^(target_link_libraries.*)\\)" _ prefix)
+ (string-append prefix " imgui qt_imgui_widgets)")))))))
(native-inputs
(list googletest sanitizers-cmake))
(inputs
@@ -303,12 +306,12 @@ (define-public nextpnr-ice40
(list
#:configure-flags
#~(list "-DARCH=ice40"
+ "-DBUILD_GUI=ON"
"-DBUILD_TESTS=ON"
- (string-append "-DCURRENT_GIT_VERSION="
- #$(string-take commit 8))
- (string-append "-DICEBOX_ROOT="
- #$(this-package-input "icestorm")
- "/share/icebox"))
+ (string-append "-DCURRENT_GIT_VERSION=" #$tag)
+ (string-append "-DICESTORM_INSTALL_PREFIX="
+ #$(this-package-input "icestorm"))
+ "-DUSE_IPO=OFF")
#:phases
#~(modify-phases %standard-phases
(add-after 'unpack 'patch-source
@@ -334,8 +337,8 @@ (define-public nextpnr-ice40
"include/qtimgui")
suffix))))))))
(synopsis "Place-and-Route tool for FPGAs")
- (description "Nextpnr aims to be a vendor neutral, timing driven,
-FOSS FPGA place and route tool.")
+ (description "Nextpnr aims to be a vendor neutral, timing driven, FOSS
+FPGA place and route tool.")
(home-page "https://github.com/YosysHQ/nextpnr")
(license license:expat))))
--
2.38.1
S
S
Simon South wrote on 27 Jan 2023 21:34
[PATCH v2 8/9] gnu: nextpnr-ice40: Remove bundled software.
(address . 60695@debbugs.gnu.org)
3399249f469cb657463e213a8295c62f81d85780.1674850363.git.simon@simonsouth.net
* gnu/packages/fpga.scm (nextpnr-ice40)[source]: Add modules, snippet.
[native-inputs]: Add googletest, sanitizers-cmake.
[inputs]: Add imgui-1.86, pybind11, qtimgui.
[arguments]: Add "patch-source" phase; reformat gently.
---
gnu/packages/fpga.scm | 74 +++++++++++++++++++++++++++++++++++++------
1 file changed, 65 insertions(+), 9 deletions(-)

Toggle diff (114 lines)
diff --git a/gnu/packages/fpga.scm b/gnu/packages/fpga.scm
index 60a6a143c9..912b6cfb77 100644
--- a/gnu/packages/fpga.scm
+++ b/gnu/packages/fpga.scm
@@ -7,6 +7,7 @@
;;; Copyright © 2021 Andrew Miloradovsky <andrew@interpretmath.pw>
;;; Copyright © 2022 Christian Gelinek <cgelinek@radlogic.com.au>
;;; Copyright © 2022 jgart <jgart@dismail.de>
+;;; Copyright © 2023 Simon South <simon@simonsouth.net>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -36,10 +37,12 @@ (define-module (gnu packages fpga)
#:use-module (gnu packages)
#:use-module (gnu packages autotools)
#:use-module (gnu packages base)
+ #:use-module (gnu packages cmake)
#:use-module (gnu packages compression)
#:use-module (gnu packages elf)
#:use-module (gnu packages pkg-config)
#:use-module (gnu packages tcl)
+ #:use-module (gnu packages toolkits)
#:use-module (gnu packages readline)
#:use-module (gnu packages python)
#:use-module (gnu packages python-xyz)
@@ -259,24 +262,77 @@ (define-public nextpnr-ice40
(file-name (git-file-name name version))
(sha256
(base32
- "1llkrh8rk1a1xxzx54apbg49ny2jqzzl2rmbkb8188idipq568ws"))))
+ "1llkrh8rk1a1xxzx54apbg49ny2jqzzl2rmbkb8188idipq568ws"))
+ (modules '((guix build utils)))
+ (snippet
+ #~(begin
+ ;; Remove bundled source code for which Guix has packages.
+ ;; Note the bundled copies of json11 and python-console contain
+ ;; modifications, while QtPropertyBrowser appears to be
+ ;; abandoned and without an official source.
+ (with-directory-excursion "3rdparty"
+ (for-each delete-file-recursively
+ '("googletest" "imgui" "pybind11" "qtimgui"
+ "sanitizers-cmake")))
+
+ ;; Remove references to unbundled code and link against
+ ;; external libraries instead.
+ (substitute* "CMakeLists.txt"
+ (("^\\s+add_subdirectory\\(3rdparty/googletest.*") "")
+ (("^(\\s+target_link_libraries.*)( gtest_main\\))"
+ _ prefix suffix)
+ (string-append prefix " gtest" suffix)))
+ (substitute* "gui/CMakeLists.txt"
+ (("^\\s+../3rdparty/(qt)?imgui.*") "")
+ (("^(target_link_libraries.*)\\)" _ prefix)
+ (string-append prefix " imgui qt_imgui_widgets)")))))))
+ (native-inputs
+ (list googletest sanitizers-cmake))
(inputs
(list boost
eigen
icestorm
+ imgui-1.86
+ pybind11
python
qtbase-5
+ qtimgui
yosys))
(build-system cmake-build-system)
(arguments
- (list #:configure-flags
- #~(list "-DARCH=ice40"
- "-DBUILD_TESTS=ON"
- (string-append "-DCURRENT_GIT_VERSION="
- #$(string-take commit 8))
- (string-append "-DICEBOX_ROOT="
- #$(this-package-input "icestorm")
- "/share/icebox"))))
+ (list
+ #:configure-flags
+ #~(list "-DARCH=ice40"
+ "-DBUILD_TESTS=ON"
+ (string-append "-DCURRENT_GIT_VERSION="
+ #$(string-take commit 8))
+ (string-append "-DICEBOX_ROOT="
+ #$(this-package-input "icestorm")
+ "/share/icebox"))
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'unpack 'patch-source
+ (lambda* (#:key inputs #:allow-other-keys)
+ (substitute* "CMakeLists.txt"
+ ;; Use the system sanitizers-cmake module.
+ (("\\$\\{CMAKE_SOURCE_DIR\\}/3rdparty/sanitizers-cmake/cmake")
+ (string-append
+ #$(this-package-native-input "sanitizers-cmake")
+ "/share/sanitizers-cmake/cmake")))
+ (substitute* "gui/CMakeLists.txt"
+ ;; Compile with system imgui and qtimgui headers.
+ (("^(target_include_directories.*)../3rdparty/imgui(.*)$"
+ _ prefix suffix)
+ (string-append prefix
+ (search-input-directory inputs
+ "include/imgui")
+ suffix))
+ (("^(target_include_directories.*)../3rdparty/qtimgui/(.*)$"
+ _ prefix suffix)
+ (string-append prefix
+ (search-input-directory inputs
+ "include/qtimgui")
+ suffix))))))))
(synopsis "Place-and-Route tool for FPGAs")
(description "Nextpnr aims to be a vendor neutral, timing driven,
FOSS FPGA place and route tool.")
--
2.38.1
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 60695@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 60695
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch