summary refs log tree commit diff
path: root/gnu/packages/bootloaders.scm
diff options
context:
space:
mode:
authorMathieu Othacehe <othacehe@gnu.org>2023-12-24 16:59:57 +0100
committerMathieu Othacehe <othacehe@gnu.org>2024-01-07 20:52:04 +0100
commit51735eac1cc21356dc1cb59356ebe96a460b5b59 (patch)
treef3fee59de9f87d2b8482d277a8c83aa9523772b3 /gnu/packages/bootloaders.scm
parentccce23bd81b3386bdccddb8c65bd1718da13497f (diff)
downloadguix-51735eac1cc21356dc1cb59356ebe96a460b5b59.tar.gz
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>
Diffstat (limited to 'gnu/packages/bootloaders.scm')
-rw-r--r--gnu/packages/bootloaders.scm58
1 files changed, 38 insertions, 20 deletions
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index bd8b621e35..c73a0e665d 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -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)
           '())))