~ruther/guix-local

3d7081fd400731435762db5bd5a5ad7b9ca62c36 — Cayetano Santos 8 months ago e28ab6a
gnu: nextpnr: Update to 0.8-0.d796cc7.

* gnu/packages/fpga.scm (nextpnr): Update to 0.8-0.d796cc7.

Change-Id: I6d0082eb22e2a51e3db648dd6c3228b635fb8d7c
Signed-off-by: Maxim Cournoyer <maxim@guixotic.coop>
Modified-by: Maxim Cournoyer <maxim@guixotic.coop>
1 files changed, 106 insertions(+), 109 deletions(-)

M gnu/packages/fpga.scm
M gnu/packages/fpga.scm => gnu/packages/fpga.scm +106 -109
@@ 419,115 419,112 @@ files.")
                     license:bsd-2))))) ;for lz4-derived sources

(define-public nextpnr
  (package
    (name "nextpnr")
    (version "0.8")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
             (url "https://github.com/YosysHQ/nextpnr/")
             (commit (string-append "nextpnr-" version))
             ;; XXX: Fetch some bundled libraries such as QtPropertyBrowser,
             ;; json11 and python-console, which have custom modifications or
             ;; no longer have their original upstream.
             (recursive? #t)))
       (file-name (git-file-name name version))
       (modules '((guix build utils)
                  (ice-9 ftw)
                  (srfi srfi-26)))
       (snippet
        '(begin
           ;; XXX: 'delete-all-but' is copied from the turbovnc package.
           (define (delete-all-but directory . preserve)
             (define (directory? x)
               (and=> (stat x #f)
                      (compose (cut eq? 'directory <>) stat:type)))
             (with-directory-excursion directory
               (let* ((pred
                       (negate (cut member <> (append '("." "..") preserve))))
                      (items (scandir "." pred)))
                 (for-each (lambda (item)
                             (if (directory? item)
                                 (delete-file-recursively item)
                                 (delete-file item)))
                           items))))
           (delete-all-but "3rdparty"
                           ;; The following sources have all been patched, so
                           ;; cannot easily be unbundled.
                           "QtPropertyBrowser"
                           "json11"
                           "python-console"
                           "oourafft")))
       (patches (search-patches "nextpnr-gtest.patch"
                                "nextpnr-imgui.patch"))
       (sha256
        (base32 "0p53a2gl89hf3hfwdxs6pykxyrk82j4lqpwd1fqia2y0c9r2gjlm"))))
    (build-system qt-build-system)
    (arguments
     (list
      #:cmake cmake                     ;CMake 3.25 or higher is required.
      #:configure-flags
      ;; TODO: enable more architectures?
      #~(list "-DARCH=generic;ice40;ecp5;himbaechel"
              "-DBUILD_GUI=ON"
              "-DUSE_OPENMP=ON"
              "-DBUILD_TESTS=ON"
              "-DHIMBAECHEL_UARCH=ng-ultra"
              "-DHIMBAECHEL_NGULTRA_DEVICES=ng-ultra"
              "-DHIMBAECHEL_PRJBEYOND_DB=/tmp/prjbeyond-db"
              (string-append "-DCURRENT_GIT_VERSION=nextpnr-" #$version)
              (string-append "-DICESTORM_INSTALL_PREFIX="
                             #$(this-package-input "icestorm"))
              (string-append "-DTRELLIS_INSTALL_PREFIX="
                             #$(this-package-input "prjtrellis"))
              "-DUSE_IPO=OFF")
      #:phases
      #~(modify-phases %standard-phases
          ;; Required by himbaechel architecture, ng-ultra support.
          (add-after 'unpack 'get-prjbeyond-db
            (lambda _
              (copy-recursively
               #$(origin
                   (method git-fetch)
                   (uri (git-reference
                         (url "https://github.com/yosyshq-GmbH/prjbeyond-db/")
                         ;; We take latest commit, as indicated in nextpnr’s
                         ;; README.md file
                         (commit "06d3b424dd0e52d678087c891c022544238fb9e3")))
                   (sha256
                    (base32
                     "17dd3cgms2fy6xvz7magdmvv92km4cqh2kz9dyjrvz5y8caqav4y")))
               "/tmp/prjbeyond-db")))
          (add-after 'unpack 'unbundle-sanitizers-cmake
            (lambda _
              (substitute* "CMakeLists.txt"
                ;; Use the system sanitizers-cmake module.  This is made
                ;; necessary 'sanitizers-cmake' installing a FindPackage
                ;; module but no CMake config file.
                (("\\$\\{CMAKE_SOURCE_DIR}/3rdparty/sanitizers-cmake/cmake")
                 (string-append
                  #$(this-package-native-input "sanitizers-cmake")
                  "/share/sanitizers-cmake/cmake"))))))))
    (native-inputs
     (list googletest
           sanitizers-cmake))
    (inputs
     (list boost
           corrosion
           eigen
           icestorm
           prjtrellis
           pybind11
           python
           qtbase-5
           qtwayland-5
           qtimgui
           yosys))
    (synopsis "Place-and-Route tool for FPGAs")
    (description "Nextpnr is a portable FPGA place and route tool.")
    (home-page "https://github.com/YosysHQ/nextpnr/")
    (license license:isc)))
  ;; Necessary for compatibility with latest apycula.
  ;; TODO: Remove with release 0.9.
  (let ((commit "d796cc720b60ccc18580c686d93c8751fe461532")
        (revision "0"))
    (package
      (name "nextpnr")
      (version (git-version "0.8" revision commit))
      (source
       (origin
         (method git-fetch)
         (uri (git-reference
                (url "https://github.com/YosysHQ/nextpnr/")
                (commit commit)
                ;; XXX: Fetch some bundled libraries such as QtPropertyBrowser,
                ;; json11 and python-console, which have custom modifications or
                ;; no longer have their original upstream.
                (recursive? #t)))
         (file-name (git-file-name name version))
         (modules '((guix build utils)
                    (ice-9 ftw)
                    (srfi srfi-26)))
         (snippet
          '(begin
             ;; XXX: 'delete-all-but' is copied from the turbovnc package.
             (define (delete-all-but directory . preserve)
                (with-directory-excursion directory
                  (let* ((pred (negate (cut member <>
                                            (cons* "." ".." preserve))))
                         (items (scandir "." pred)))
                    (for-each (cut delete-file-recursively <>) items))))
             (delete-all-but "3rdparty"
                             ;; The following sources have all been patched, so
                             ;; cannot easily be unbundled.
                             "QtPropertyBrowser"
                             "json11"
                             "python-console"
                             "oourafft")))
         (patches (search-patches "nextpnr-gtest.patch"
                                  "nextpnr-imgui.patch"))
         (sha256
          (base32 "1arj25vad76wg6b5yaaky4cby5zp9v92pdd4y3l0kxi7wvxhmmya"))))
      (build-system qt-build-system)
      (arguments
       (list
        #:cmake cmake                     ;CMake 3.25 or higher is required.
        #:configure-flags
        ;; TODO: enable more architectures?
        #~(list "-DARCH=generic;ice40;ecp5;himbaechel"
                "-DBUILD_GUI=ON"
                "-DUSE_OPENMP=ON"
                "-DBUILD_TESTS=ON"
                "-DHIMBAECHEL_UARCH=ng-ultra"
                "-DHIMBAECHEL_NGULTRA_DEVICES=ng-ultra"
                "-DHIMBAECHEL_PRJBEYOND_DB=/tmp/prjbeyond-db"
                (string-append "-DCURRENT_GIT_VERSION=nextpnr-" #$version)
                (string-append "-DICESTORM_INSTALL_PREFIX="
                               #$(this-package-input "icestorm"))
                (string-append "-DTRELLIS_INSTALL_PREFIX="
                               #$(this-package-input "prjtrellis"))
                "-DUSE_IPO=OFF")
        #:phases
        #~(modify-phases %standard-phases
            ;; Required by himbaechel architecture, ng-ultra support.
            (add-after 'unpack 'get-prjbeyond-db
              (lambda _
                (copy-recursively
                 #$(origin
                     (method git-fetch)
                     (uri (git-reference
                            (url "https://github.com/yosyshq-GmbH/prjbeyond-db/")
                            ;; We take latest commit, as indicated in nextpnr’s
                            ;; README.md file
                            (commit "06d3b424dd0e52d678087c891c022544238fb9e3")))
                     (sha256
                      (base32
                       "17dd3cgms2fy6xvz7magdmvv92km4cqh2kz9dyjrvz5y8caqav4y")))
                 "/tmp/prjbeyond-db")))
            (add-after 'unpack 'unbundle-sanitizers-cmake
              (lambda _
                (substitute* "CMakeLists.txt"
                  ;; Use the system sanitizers-cmake module.  This is made
                  ;; necessary 'sanitizers-cmake' installing a FindPackage
                  ;; module but no CMake config file.
                  (("\\$\\{CMAKE_SOURCE_DIR}/3rdparty/sanitizers-cmake/cmake")
                   (string-append
                    #$(this-package-native-input "sanitizers-cmake")
                    "/share/sanitizers-cmake/cmake"))))))))
      (native-inputs
       (list googletest
             sanitizers-cmake))
      (inputs
       (list boost
             corrosion
             eigen
             icestorm
             prjtrellis
             pybind11
             python
             qtbase-5
             qtwayland-5
             qtimgui
             yosys))
      (synopsis "Place-and-Route tool for FPGAs")
      (description "Nextpnr is a portable FPGA place and route tool.")
      (home-page "https://github.com/YosysHQ/nextpnr/")
      (license license:isc))))

(define-public nextpnr-ice40
  (deprecated-package "nextpnr-ice40" nextpnr))