~ruther/guix-local

51735eac1cc21356dc1cb59356ebe96a460b5b59 — Mathieu Othacehe 2 years ago ccce23b
gnu: dtc: Update to 1.7.0.

Enable the python bindings and switch to the meson build system that handles
the python bindings better than the Makefile build system here.

* gnu/packages/patches/dtc-meson-cell-overflow.patch: New file
* gnu/local.mk (dist_patch_DATA): Add it.
* gnu/packages/bootloaders.scm (dtc): Update to 1.7.0.
[build-system]: Switch to the meson-build-system.
[arguments]: Remove #:make-flags. Add a new 'preparations phase. Do not edit
the Makefile in the 'patch-pkg-config phase. Remove the 'configure phase.

Change-Id: Ie61c920829ab3a8c32f4924c694dba6bda807711
Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
3 files changed, 71 insertions(+), 20 deletions(-)

M gnu/local.mk
M gnu/packages/bootloaders.scm
A gnu/packages/patches/dtc-meson-cell-overflow.patch
M gnu/local.mk => gnu/local.mk +1 -0
@@ 1092,6 1092,7 @@ dist_patch_DATA =						\
  %D%/packages/patches/doxygen-hurd.patch			\
  %D%/packages/patches/dstat-fix-crash-when-specifying-delay.patch	\
  %D%/packages/patches/dstat-skip-devices-without-io.patch	\
  %D%/packages/patches/dtc-meson-cell-overflow.patch		\
  %D%/packages/patches/dune-common-skip-failing-tests.patch	\
  %D%/packages/patches/dune-grid-add-missing-include-cassert.patch	\
  %D%/packages/patches/dune-istl-fix-solver-playground.patch	\

M gnu/packages/bootloaders.scm => gnu/packages/bootloaders.scm +38 -20
@@ 55,9 55,12 @@
  #:use-module (gnu packages man)
  #:use-module (gnu packages mtools)
  #:use-module (gnu packages ncurses)
  #:use-module (gnu packages ninja)
  #:use-module (gnu packages package-management)
  #:use-module (gnu packages perl)
  #:use-module (gnu packages pkg-config)
  #:use-module (gnu packages python)
  #:use-module (gnu packages python-build)
  #:use-module (gnu packages python-crypto)
  #:use-module (gnu packages texinfo)
  #:use-module (gnu packages tls)


@@ 71,6 74,7 @@
  #:use-module (gnu packages python-web)
  #:use-module (gnu packages python-xyz)
  #:use-module (guix build-system gnu)
  #:use-module (guix build-system meson)
  #:use-module (guix build-system pyproject)
  #:use-module (guix build-system trivial)
  #:use-module (guix download)


@@ 631,7 635,7 @@ The SUBDIR argument defaults to \"efi/Guix\", as it is also the case for
(define-public dtc
  (package
    (name "dtc")
    (version "1.6.1")
    (version "1.7.0")
    (source (origin
              (method url-fetch)
              (uri (string-append


@@ 639,42 643,56 @@ The SUBDIR argument defaults to \"efi/Guix\", as it is also the case for
                    "dtc-" version ".tar.gz"))
              (sha256
               (base32
                "0xm38h31jb29xfh2sfyk48d8wdfq4b8lmb412zx9vjr35izjb9iq"))))
    (build-system gnu-build-system)
                "0cij9399snpn672pdbda8qbxljdkfg068kvv3g5811rz6yslx124"))
              (patches
               (search-patches "dtc-meson-cell-overflow.patch"))))
    (build-system meson-build-system)
    (arguments
     (list
      #:modules `(,@%gnu-build-system-modules (srfi srfi-26))
      #:make-flags
      #~(list (string-append "CC=" #$(cc-for-target))
              ;; /bin/fdt{get,overlay,put} need help finding libfdt.so.1.
              (string-append "LDFLAGS=-Wl,-rpath=" #$output "/lib")
              (string-append "PREFIX=" #$output)
              (string-append "SETUP_PREFIX=" #$output)
              "INSTALL=install")
      #:modules '((guix build meson-build-system)
                  (guix build utils)
                  (srfi srfi-26))
      #:phases
      #~(modify-phases %standard-phases
          (add-after 'unpack 'patch-pkg-config
          (add-after 'unpack 'preparations
            (lambda _
              (substitute* '("Makefile"
                             "tests/run_tests.sh")
                (("pkg-config")
                 #$(pkg-config-for-target)))))
          (delete 'configure)           ;no configure script
          (add-before 'build 'install-doc
              ;; The version string is usually derived via setuptools-scm, but
              ;; without the git metadata available this fails.
              (setenv "SETUPTOOLS_SCM_PRETEND_VERSION" #$version)

              ;; Needed by setup.py.
              (setenv "DESTDIR" "/")

              ;; Native gcc needed by run_test.sh.
              (setenv "CC" "gcc")

              ;; /bin/fdt{get,overlay,put} need help finding libfdt.so.1.
              (setenv "LDFLAGS"
                      (string-append "-Wl,-rpath=" #$output "/lib"))))
          (add-after 'unpack 'install-doc
            (lambda _
              (with-directory-excursion "Documentation"
                (for-each (cut install-file <> (string-append
                                                #$output "/share/doc/dtc/"))
                          '("dts-format.txt"
                            "dt-object-internal.txt"
                            "manual.txt"))))))))
                            "manual.txt")))))
          (add-after 'unpack 'patch-pkg-config
            (lambda _
              (substitute* '("tests/run_tests.sh")
                (("pkg-config")
                 #$(pkg-config-for-target))))))))
    (native-inputs
     (append
      (list bison
            flex
            libyaml
            ninja
            pkg-config
            swig)
            python
            python-setuptools-scm
            swig
            which)
      (if (member (%current-system) (package-supported-systems valgrind))
          (list valgrind)
          '())))

A gnu/packages/patches/dtc-meson-cell-overflow.patch => gnu/packages/patches/dtc-meson-cell-overflow.patch +32 -0
@@ 0,0 1,32 @@
Taken from upstream:
https://git.kernel.org/pub/scm/utils/dtc/dtc.git/commit/?id=32174a66efa4ad19fc6a2a6422e4af2ae4f055cb

From 32174a66efa4ad19fc6a2a6422e4af2ae4f055cb Mon Sep 17 00:00:00 2001
From: David Gibson <david@gibson.dropbear.id.au>
Date: Tue, 28 Feb 2023 10:33:58 +1100
Subject: [PATCH] meson: Fix cell overflow tests when running from meson

Because meson always builds out-of-tree we need to reference things in the
original source tree via $SRCDIR from run_tests.sh.  We forgot a couple of
cases for the cell overflow tests.  Fix them.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
 tests/run_tests.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/run_tests.sh b/tests/run_tests.sh
index 91350ad3..f899d8cb 100755
--- a/tests/run_tests.sh
+++ b/tests/run_tests.sh
@@ -519,8 +519,8 @@ libfdt_tests () {
     check_tests "$SRCDIR/phandle-args-overflow.dts" clocks_property
 
     ## https://github.com/dgibson/dtc/issues/74
-    run_dtc_test -I dts -O dtb -o cell-overflow-results.test.dtb cell-overflow-results.dts
-    run_dtc_test -I dts -O dtb -o cell-overflow.test.dtb cell-overflow.dts
+    run_dtc_test -I dts -O dtb -o cell-overflow-results.test.dtb "$SRCDIR/cell-overflow-results.dts"
+    run_dtc_test -I dts -O dtb -o cell-overflow.test.dtb "$SRCDIR/cell-overflow.dts"
     run_test dtbs_equal_ordered cell-overflow.test.dtb cell-overflow-results.test.dtb
 
     # check full tests