GNU bug report logs - #76208
[PATCH 0/3] gnu: grub: build from git source.

Previous Next

Package: guix-patches;

Reported by: Denis 'GNUtoo' Carikli <GNUtoo <at> cyberdimension.org>

Date: Tue, 11 Feb 2025 17:06:01 UTC

Severity: normal

Tags: patch

Full log


View this message in rfc822 format

From: Denis 'GNUtoo' Carikli <GNUtoo <at> cyberdimension.org>
To: 76208 <at> debbugs.gnu.org
Cc: Denis 'GNUtoo' Carikli <GNUtoo <at> cyberdimension.org>, Efraim Flashner <efraim <at> flashner.co.il>, Vagrant Cascadian <vagrant <at> debian.org>
Subject: [bug#76208] [PATCH 3/3] gnu: grub: build from git source.
Date: Tue, 11 Feb 2025 18:14:55 +0100
* gnu/packages/bootloaders.scm (grub)
  [source]: Switch to git-fetch, don't overwrite grub-core/extra_deps.lst.
  [native-inputs]: Add autoconf, automake, gnulib-2022-02-12, python.
  [arguments]<phases>: Add 'bootstrap phase.

Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo <at> cyberdimension.org>
Change-Id: I894e7dcac719a4d20dc82685af7a31110a023b50
---
 gnu/packages/bootloaders.scm | 59 ++++++++++++++++++++++++++++--------
 1 file changed, 46 insertions(+), 13 deletions(-)

diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index b5cfacca4bc..86fff61ad7d 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -15,7 +15,7 @@
 ;;; Copyright © 2020, 2021 Pierre Langlois <pierre.langlois <at> gmx.com>
 ;;; Copyright © 2021 Vincent Legoll <vincent.legoll <at> gmail.com>
 ;;; Copyright © 2021 Brice Waegeneire <brice <at> waegenei.re>
-;;; Copyright © 2022, 2023 Denis 'GNUtoo' Carikli <GNUtoo <at> cyberdimension.org>
+;;; Copyright © 2022-2023, 2025 Denis 'GNUtoo' Carikli <GNUtoo <at> cyberdimension.org>
 ;;; Copyright © 2021 Stefan <stefan-guix <at> vodafonemail.de>
 ;;; Copyright © 2022, 2023, 2024 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
 ;;; Copyright © 2023 Herman Rimm <herman <at> rimm.ee>
@@ -40,7 +40,9 @@
 (define-module (gnu packages bootloaders)
   #:use-module (gnu packages)
   #:use-module (gnu packages assembly)
+  #:use-module (gnu packages autotools)
   #:use-module (gnu packages base)
+  #:use-module (gnu packages build-tools)
   #:use-module (gnu packages disk)
   #:use-module (gnu packages bison)
   #:use-module (gnu packages cdrom)
@@ -112,22 +114,20 @@ (define-public grub
     (name "grub")
     (version "2.12")
     (source (origin
-              (method url-fetch)
-              (uri (string-append "mirror://gnu/grub/grub-" version ".tar.xz"))
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://git.savannah.gnu.org/git/grub.git")
+                    (commit (string-append "grub-" version))))
               (sha256
                (base32
-                "1ahgzvvvwdxx7rl08pv5dyqlgp76jxz0q2cflxvsdsn4yy8p7jgk"))
+                "05x4sli80ybpi38pj0313pg2ip2dd4lflz64hymvnzzn2sq63awm"))
+              (file-name (git-file-name name version))
               (patches (search-patches
                         "grub-efi-fat-serial-number.patch"
                         "grub-setup-root.patch"))
               (modules '((guix build utils)))
               (snippet
                #~(begin
-                   ;; Add file missing from the release tarball.
-                   (call-with-output-file "grub-core/extra_deps.lst"
-                     (lambda (port)
-                       (display "depends bli part_gpt\n" port)))
-
                    ;; Use exit code 77, not 99, to tell Automake that a test
                    ;; is skipped.
                    (substitute* (find-files "tests" "\\.in$")
@@ -156,7 +156,36 @@ (define-public grub
 
            #:phases
            #~(modify-phases %standard-phases
-               (add-after 'unpack 'patch-stuff
+            ;; We need to run before the patch-stuff phase, otherwise we
+            ;; have this error:
+            ;;    starting phase `patch-stuff'
+            ;;    error: in phase 'patch-stuff': uncaught exception:
+            ;;    system-error "stat" "~A: ~S"
+            ;;    ("No such file or directory" "grub-core/Makefile.in") (2)
+            (add-after 'unpack 'bootstrap
+              (lambda _
+                ;; The bootstrap script calls gnulib-tool{,.py} from the path
+                ;; passed to --gnulib-srcdir, so we need to put Guix version
+                ;; of these scripts there.
+                (copy-recursively
+                 (string-append #$gnulib-2022-02-12 "/src/gnulib") "gnulib")
+                (delete-file "gnulib/gnulib-tool")
+                (delete-file "gnulib/gnulib-tool.py")
+                (copy-file
+                 (string-append #$gnulib-2022-02-12 "/bin/gnulib-tool")
+                 "gnulib/gnulib-tool")
+                (copy-file
+                 (string-append #$gnulib-2022-02-12 "/bin/gnulib-tool.py")
+                 "gnulib/gnulib-tool.py")
+                ;; We run very early so we need to patch the sheebang now as
+                ;; bootstrap will run autogen.sh.
+                (patch-shebang "autogen.sh")
+                (invoke
+                 "bash"
+                 "./bootstrap"
+                 "--no-git"
+                 "--gnulib-srcdir=gnulib")))
+               (add-after 'bootstrap 'patch-stuff
                  (lambda* (#:key native-inputs inputs #:allow-other-keys)
                    (substitute* "grub-core/Makefile.in"
                      (("/bin/sh") (which "sh")))
@@ -270,12 +299,16 @@ (define-public grub
                  (list fuse-2)
                  '())))
     (native-inputs
-     (append (list pkg-config
+     (append (list autoconf
+                   automake
                    bison
                    flex
-                   texinfo
-                   help2man
                    freetype       ;native version needed for build-grub-mkfont
+                   gnulib-2022-02-12
+                   help2man
+                   pkg-config
+                   python         ;to run gentpl.py during autoconf.sh
+                   texinfo
 
                    ;; Dependencies of the test suite.
                    parted
-- 
2.46.0





This bug report was last modified 119 days ago.

Previous Next


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