GNU bug report logs - #60695
[PATCH 0/9] gnu: nextpnr-ice40: Update to 0.5.

Previous Next

Package: guix-patches;

Reported by: Simon South <simon <at> simonsouth.net>

Date: Mon, 9 Jan 2023 19:23:02 UTC

Severity: normal

Tags: patch

To reply to this bug, email your comments to 60695 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#60695; Package guix-patches. (Mon, 09 Jan 2023 19:23:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Simon South <simon <at> simonsouth.net>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Mon, 09 Jan 2023 19:23:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Simon South <simon <at> simonsouth.net>
To: guix-patches <at> gnu.org
Subject: [PATCH 0/9] gnu: nextpnr-ice40: Update to 0.5.
Date: Mon,  9 Jan 2023 14:22:25 -0500
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.)

[0] https://issues.guix.gnu.org/60429

[1] https://github.blog/2021-09-01-improving-git-protocol-security-github/

[2] https://github.com/YosysHQ/nextpnr#getting-started

--
Simon South
simon <at> 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





Information forwarded to guix-patches <at> gnu.org:
bug#60695; Package guix-patches. (Mon, 09 Jan 2023 19:27:02 GMT) Full text and rfc822 format available.

Message #8 received at 60695 <at> debbugs.gnu.org (full text, mbox):

From: Simon South <simon <at> simonsouth.net>
To: 60695 <at> debbugs.gnu.org
Subject: [PATCH 1/9] gnu: Add implot.
Date: Mon,  9 Jan 2023 14:25:55 -0500
* gnu/packages/toolkits.scm (implot): New variable.
---
 gnu/packages/toolkits.scm | 50 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)

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 <at> gmail.com>
 ;;; Copyright © 2020, 2022 Tobias Geerinckx-Rice <me <at> tobias.gr>
 ;;; Copyright © 2022 John Kehayias <john.kehayias <at> protonmail.com>
+;;; Copyright © 2023 Simon South <simon <at> 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





Information forwarded to guix-patches <at> gnu.org:
bug#60695; Package guix-patches. (Mon, 09 Jan 2023 19:27:02 GMT) Full text and rfc822 format available.

Message #11 received at 60695 <at> debbugs.gnu.org (full text, mbox):

From: Simon South <simon <at> simonsouth.net>
To: 60695 <at> debbugs.gnu.org
Subject: [PATCH 2/9] gnu: Add qtimgui.
Date: Mon,  9 Jan 2023 14:25:56 -0500
* gnu/packages/qt.scm (qtimgui): New variable.
---
 gnu/packages/qt.scm | 63 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 63 insertions(+)

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 <at> hotmail.com>
 ;;; Copyright © 2022 Zhu Zihao <all_but_last <at> 163.com>
 ;;; Copyright © 2022 Petr Hodina <phodina <at> protonmail.com>
+;;; Copyright © 2023 Simon South <simon <at> 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





Information forwarded to guix-patches <at> gnu.org:
bug#60695; Package guix-patches. (Mon, 09 Jan 2023 19:27:03 GMT) Full text and rfc822 format available.

Message #14 received at 60695 <at> debbugs.gnu.org (full text, mbox):

From: Simon South <simon <at> simonsouth.net>
To: 60695 <at> debbugs.gnu.org
Subject: [PATCH 3/9] gnu: Add sanitizers-cmake.
Date: Mon,  9 Jan 2023 14:25:57 -0500
* gnu/packages/cmake.scm (sanitizers-cmake): New variable.
---
 gnu/packages/cmake.scm | 45 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)

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 <at> gmail.com>
 ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke <at> gnu.org>
 ;;; Copyright © 2021 Ricardo Wurmus <rekado <at> elephly.net>
+;;; Copyright © 2023 Simon South <simon <at> 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





Information forwarded to guix-patches <at> gnu.org:
bug#60695; Package guix-patches. (Mon, 09 Jan 2023 19:27:03 GMT) Full text and rfc822 format available.

Message #17 received at 60695 <at> debbugs.gnu.org (full text, mbox):

From: Simon South <simon <at> simonsouth.net>
To: 60695 <at> debbugs.gnu.org
Subject: [PATCH 4/9] gnu: nextpnr-ice40: Use HTTPS for source URL.
Date: Mon,  9 Jan 2023 14:25:58 -0500
* gnu/packages/fpga.scm (nextpnr-ice40)[source]: Use HTTPS for URL.
---
 gnu/packages/fpga.scm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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





Information forwarded to guix-patches <at> gnu.org:
bug#60695; Package guix-patches. (Mon, 09 Jan 2023 19:27:03 GMT) Full text and rfc822 format available.

Message #20 received at 60695 <at> debbugs.gnu.org (full text, mbox):

From: Simon South <simon <at> simonsouth.net>
To: 60695 <at> debbugs.gnu.org
Subject: [PATCH 8/9] gnu: nextpnr-ice40: Remove bundled software.
Date: Mon,  9 Jan 2023 14:26:02 -0500
* 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(-)

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 <at> interpretmath.pw>
 ;;; Copyright © 2022 Christian Gelinek <cgelinek <at> radlogic.com.au>
 ;;; Copyright © 2022 jgart <jgart <at> dismail.de>
+;;; Copyright © 2023 Simon South <simon <at> 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





Information forwarded to guix-patches <at> gnu.org:
bug#60695; Package guix-patches. (Mon, 09 Jan 2023 19:27:04 GMT) Full text and rfc822 format available.

Message #23 received at 60695 <at> debbugs.gnu.org (full text, mbox):

From: Simon South <simon <at> simonsouth.net>
To: 60695 <at> debbugs.gnu.org
Subject: [PATCH 6/9] gnu: nextpnr-ice40: Enable tests.
Date: Mon,  9 Jan 2023 14:26:00 -0500
* 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(-)

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





Information forwarded to guix-patches <at> gnu.org:
bug#60695; Package guix-patches. (Mon, 09 Jan 2023 19:27:04 GMT) Full text and rfc822 format available.

Message #26 received at 60695 <at> debbugs.gnu.org (full text, mbox):

From: Simon South <simon <at> simonsouth.net>
To: 60695 <at> debbugs.gnu.org
Subject: [PATCH 5/9] gnu: nextpnr-ice40: Use gexps.
Date: Mon,  9 Jan 2023 14:25:59 -0500
* gnu/packages/fpga.scm (nextpnr-ice40)[arguments]: Use gexps.
---
 gnu/packages/fpga.scm | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

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





Information forwarded to guix-patches <at> gnu.org:
bug#60695; Package guix-patches. (Mon, 09 Jan 2023 19:27:05 GMT) Full text and rfc822 format available.

Message #29 received at 60695 <at> debbugs.gnu.org (full text, mbox):

From: Simon South <simon <at> simonsouth.net>
To: 60695 <at> debbugs.gnu.org
Subject: [PATCH 7/9] gnu: nextpnr-ice40: Fix generated version string.
Date: Mon,  9 Jan 2023 14:26:01 -0500
* gnu/packages/fpga.scm (nextpnr-ice40)[arguments]<#:configure-flags>: Add
"-DCURRENT_GIT_VERSION".
---
 gnu/packages/fpga.scm | 2 ++
 1 file changed, 2 insertions(+)

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





Information forwarded to guix-patches <at> gnu.org:
bug#60695; Package guix-patches. (Mon, 09 Jan 2023 19:27:05 GMT) Full text and rfc822 format available.

Message #32 received at 60695 <at> debbugs.gnu.org (full text, mbox):

From: Simon South <simon <at> simonsouth.net>
To: 60695 <at> debbugs.gnu.org
Subject: [PATCH 9/9] gnu: nextpnr-ice40: Update to 0.5.
Date: Mon,  9 Jan 2023 14:26:03 -0500
* 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(-)

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





Information forwarded to guix-patches <at> gnu.org:
bug#60695; Package guix-patches. (Fri, 27 Jan 2023 20:35:02 GMT) Full text and rfc822 format available.

Message #35 received at 60695 <at> debbugs.gnu.org (full text, mbox):

From: Simon South <simon <at> simonsouth.net>
To: 60695 <at> debbugs.gnu.org
Subject: [PATCH v2 2/9] gnu: Add qtimgui.
Date: Fri, 27 Jan 2023 15:34:27 -0500
* gnu/packages/qt.scm (qtimgui): New variable.
---
 gnu/packages/qt.scm | 63 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 63 insertions(+)

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 <at> hotmail.com>
 ;;; Copyright © 2022 Zhu Zihao <all_but_last <at> 163.com>
 ;;; Copyright © 2022 Petr Hodina <phodina <at> protonmail.com>
+;;; Copyright © 2023 Simon South <simon <at> 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





Information forwarded to guix-patches <at> gnu.org:
bug#60695; Package guix-patches. (Fri, 27 Jan 2023 20:35:03 GMT) Full text and rfc822 format available.

Message #38 received at 60695 <at> debbugs.gnu.org (full text, mbox):

From: Simon South <simon <at> simonsouth.net>
To: 60695 <at> debbugs.gnu.org
Subject: [PATCH v2 0/9] gnu: nextpnr-ice40: Update to 0.5.
Date: Fri, 27 Jan 2023 15:34:25 -0500
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.

[0] https://lists.gnu.org/archive/html/guix-patches/2023-01/msg01230.html

--
Simon South
simon <at> 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.)

[0] https://issues.guix.gnu.org/60429

[1] https://github.blog/2021-09-01-improving-git-protocol-security-github/

[2] https://github.com/YosysHQ/nextpnr#getting-started

--
Simon South
simon <at> 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




Information forwarded to guix-patches <at> gnu.org:
bug#60695; Package guix-patches. (Fri, 27 Jan 2023 20:35:03 GMT) Full text and rfc822 format available.

Message #41 received at 60695 <at> debbugs.gnu.org (full text, mbox):

From: Simon South <simon <at> simonsouth.net>
To: 60695 <at> debbugs.gnu.org
Subject: [PATCH v2 5/9] gnu: nextpnr-ice40: Use gexps.
Date: Fri, 27 Jan 2023 15:34:30 -0500
* gnu/packages/fpga.scm (nextpnr-ice40)[arguments]: Use gexps.
---
 gnu/packages/fpga.scm | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

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





Information forwarded to guix-patches <at> gnu.org:
bug#60695; Package guix-patches. (Fri, 27 Jan 2023 20:35:04 GMT) Full text and rfc822 format available.

Message #44 received at 60695 <at> debbugs.gnu.org (full text, mbox):

From: Simon South <simon <at> simonsouth.net>
To: 60695 <at> debbugs.gnu.org
Subject: [PATCH v2 3/9] gnu: Add sanitizers-cmake.
Date: Fri, 27 Jan 2023 15:34:28 -0500
* gnu/packages/cmake.scm (sanitizers-cmake): New variable.
---
 gnu/packages/cmake.scm | 45 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)

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 <at> gmail.com>
 ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke <at> gnu.org>
 ;;; Copyright © 2021 Ricardo Wurmus <rekado <at> elephly.net>
+;;; Copyright © 2023 Simon South <simon <at> 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





Information forwarded to guix-patches <at> gnu.org:
bug#60695; Package guix-patches. (Fri, 27 Jan 2023 20:35:04 GMT) Full text and rfc822 format available.

Message #47 received at 60695 <at> debbugs.gnu.org (full text, mbox):

From: Simon South <simon <at> simonsouth.net>
To: 60695 <at> debbugs.gnu.org
Subject: [PATCH v2 1/9] gnu: Add implot.
Date: Fri, 27 Jan 2023 15:34:26 -0500
* gnu/packages/toolkits.scm (implot): New variable.
---
 gnu/packages/toolkits.scm | 50 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)

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 <at> gmail.com>
 ;;; Copyright © 2020, 2022 Tobias Geerinckx-Rice <me <at> tobias.gr>
 ;;; Copyright © 2022 John Kehayias <john.kehayias <at> protonmail.com>
+;;; Copyright © 2023 Simon South <simon <at> 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





Information forwarded to guix-patches <at> gnu.org:
bug#60695; Package guix-patches. (Fri, 27 Jan 2023 20:35:04 GMT) Full text and rfc822 format available.

Message #50 received at 60695 <at> debbugs.gnu.org (full text, mbox):

From: Simon South <simon <at> simonsouth.net>
To: 60695 <at> debbugs.gnu.org
Subject: [PATCH v2 4/9] gnu: nextpnr-ice40: Use HTTPS for source URL.
Date: Fri, 27 Jan 2023 15:34:29 -0500
* gnu/packages/fpga.scm (nextpnr-ice40)[source]: Use HTTPS for URL.
---
 gnu/packages/fpga.scm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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





Information forwarded to guix-patches <at> gnu.org:
bug#60695; Package guix-patches. (Fri, 27 Jan 2023 20:35:05 GMT) Full text and rfc822 format available.

Message #53 received at 60695 <at> debbugs.gnu.org (full text, mbox):

From: Simon South <simon <at> simonsouth.net>
To: 60695 <at> debbugs.gnu.org
Subject: [PATCH v2 6/9] gnu: nextpnr-ice40: Enable tests.
Date: Fri, 27 Jan 2023 15:34:31 -0500
* 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(-)

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





Information forwarded to guix-patches <at> gnu.org:
bug#60695; Package guix-patches. (Fri, 27 Jan 2023 20:35:05 GMT) Full text and rfc822 format available.

Message #56 received at 60695 <at> debbugs.gnu.org (full text, mbox):

From: Simon South <simon <at> simonsouth.net>
To: 60695 <at> debbugs.gnu.org
Subject: [PATCH v2 7/9] gnu: nextpnr-ice40: Fix generated version string.
Date: Fri, 27 Jan 2023 15:34:32 -0500
* gnu/packages/fpga.scm (nextpnr-ice40)[arguments]<#:configure-flags>: Add
"-DCURRENT_GIT_VERSION".
---
 gnu/packages/fpga.scm | 2 ++
 1 file changed, 2 insertions(+)

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





Information forwarded to guix-patches <at> gnu.org:
bug#60695; Package guix-patches. (Fri, 27 Jan 2023 20:35:06 GMT) Full text and rfc822 format available.

Message #59 received at 60695 <at> debbugs.gnu.org (full text, mbox):

From: Simon South <simon <at> simonsouth.net>
To: 60695 <at> debbugs.gnu.org
Subject: [PATCH v2 9/9] gnu: nextpnr-ice40: Update to 0.5.
Date: Fri, 27 Jan 2023 15:34:34 -0500
* 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(-)

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





Information forwarded to guix-patches <at> gnu.org:
bug#60695; Package guix-patches. (Fri, 27 Jan 2023 20:36:02 GMT) Full text and rfc822 format available.

Message #62 received at 60695 <at> debbugs.gnu.org (full text, mbox):

From: Simon South <simon <at> simonsouth.net>
To: 60695 <at> debbugs.gnu.org
Subject: [PATCH v2 8/9] gnu: nextpnr-ice40: Remove bundled software.
Date: Fri, 27 Jan 2023 15:34:33 -0500
* 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(-)

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 <at> interpretmath.pw>
 ;;; Copyright © 2022 Christian Gelinek <cgelinek <at> radlogic.com.au>
 ;;; Copyright © 2022 jgart <jgart <at> dismail.de>
+;;; Copyright © 2023 Simon South <simon <at> 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





This bug report was last modified 1 year and 82 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.