1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
4 ;;; Copyright © 2015 Leo Famulari <leo@famulari.name>
5 ;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
7 ;;; This file is part of GNU Guix.
9 ;;; GNU Guix is free software; you can redistribute it and/or modify it
10 ;;; under the terms of the GNU General Public License as published by
11 ;;; the Free Software Foundation; either version 3 of the License, or (at
12 ;;; your option) any later version.
14 ;;; GNU Guix is distributed in the hope that it will be useful, but
15 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;;; GNU General Public License for more details.
19 ;;; You should have received a copy of the GNU General Public License
20 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
22 (define-module (gnu packages grub)
23 #:use-module (guix download)
24 #:use-module (guix packages)
25 #:use-module ((guix licenses) #:select (gpl3+))
26 #:use-module (guix build-system gnu)
27 #:use-module (gnu packages)
28 #:use-module (gnu packages flex)
29 #:use-module (gnu packages disk)
30 #:use-module (gnu packages bison)
31 #:use-module (gnu packages gettext)
32 #:use-module (gnu packages fontutils)
33 #:use-module (gnu packages linux)
34 #:use-module (gnu packages qemu)
35 #:use-module (gnu packages man)
36 #:use-module (gnu packages texinfo)
37 #:use-module (gnu packages ncurses)
38 #:use-module (gnu packages cdrom)
39 #:use-module (srfi srfi-1))
41 (define qemu-for-tests
42 ;; Newer QEMU versions, such as 1.5.1, no longer support the 'shutdown'
43 ;; instruction. This leads to test hangs, as reported at
44 ;; <https://bugs.launchpad.net/bugs/947597> and fixed at
45 ;; <http://bzr.savannah.gnu.org/lh/grub/trunk/grub/revision/4828>.
46 ;; Work around it by using an older QEMU.
47 (package (inherit qemu-minimal)
51 (uri (string-append "http://wiki.qemu-project.org/download/qemu-"
55 "1bqfrb5dlsxm8gxhkksz8qzi5fhj3xqhxyfwbqcphhcv1kpyfwip"))))
57 ;; With recent GLib versions, we get a test failure:
58 ;; ERROR:tests/rtc-test.c:176:check_time: assertion failed (ABS(t - s) <= wiggle): (382597824 <= 2)
59 ;; Simply disable the tests.
60 (arguments `(#:tests? #f
61 ,@(package-arguments qemu-minimal)))
63 ;; The manual fails to build with Texinfo 5.x.
64 (native-inputs (alist-delete "texinfo" (package-native-inputs qemu)))))
67 ;; GNU Unifont, <http://gnu.org/s/unifont>.
68 ;; GRUB needs it for its graphical terminal, gfxterm.
72 "http://unifoundry.com/pub/unifont-7.0.06/font-builds/unifont-7.0.06.bdf.gz")
75 "0p2vhnc18cnbmb39vq4m7hzv4mhnm2l0a2s7gx3ar277fwng3hys"))))
84 "ftp://alpha.gnu.org/gnu/grub/grub-"
87 (file-name (string-append name "-" version ".tar.xz"))
90 "18ddwnw0vxs7zigvah0g6a5z5vvlz0p8fjglxv1h59sjbrakvv1h"))))
91 (build-system gnu-build-system)
93 '(;; Two warnings: suggest braces, signed/unsigned comparison.
94 #:configure-flags '("--disable-werror")
95 #:phases (modify-phases %standard-phases
98 (lambda* (#:key inputs #:allow-other-keys)
99 (substitute* "grub-core/Makefile.in"
100 (("/bin/sh") (which "sh")))
102 ;; Make the font visible.
103 (copy-file (assoc-ref inputs "unifont") "unifont.bdf.gz")
104 (system* "gunzip" "unifont.bdf.gz")
106 ;; We hit an assertion failure in
107 ;; grub-core/tests/video_checksum.c, as reported at
108 ;; <https://lists.gnu.org/archive/html/grub-devel/2016-07/msg00026.html>.
109 ;; Disable this test for now.
110 (substitute* "tests/grub_func_test.in"
111 (("set -e") "exit 77\nset -e"))
115 ("gettext" ,gnu-gettext)
116 ("freetype" ,freetype)
117 ;; ("libusb" ,libusb)
119 ("ncurses" ,ncurses)))
121 `(("unifont" ,unifont)
125 ("help2man" ,help2man)
127 ;; Dependencies for the test suite. The "real" QEMU is needed here,
128 ;; because several targets are used.
130 ("qemu" ,qemu-for-tests)
131 ("xorriso" ,xorriso)))
132 (home-page "http://www.gnu.org/software/grub/")
133 (synopsis "GRand Unified Boot loader")
135 "GRUB is a multiboot bootloader. It is used for initially loading the
136 kernel of an operating system and then transferring control to it. The kernel
137 then goes on to load the rest of the operating system. As a multiboot
138 bootloader, GRUB handles the presence of multiple operating systems installed
139 on the same computer; upon booting the computer, the user is presented with a
140 menu to select one of the installed operating systems.")
142 (properties '((cpe-name . "grub2")))))