Merge branch 'master' into dbus-update
[jackhill/guix/guix.git] / gnu / packages / grub.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2014 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
4 ;;;
5 ;;; This file is part of GNU Guix.
6 ;;;
7 ;;; GNU Guix is free software; you can redistribute it and/or modify it
8 ;;; under the terms of the GNU General Public License as published by
9 ;;; the Free Software Foundation; either version 3 of the License, or (at
10 ;;; your option) any later version.
11 ;;;
12 ;;; GNU Guix is distributed in the hope that it will be useful, but
13 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;;; GNU General Public License for more details.
16 ;;;
17 ;;; You should have received a copy of the GNU General Public License
18 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
19
20 (define-module (gnu packages grub)
21 #:use-module (guix download)
22 #:use-module (guix packages)
23 #:use-module ((guix licenses) #:select (gpl3+))
24 #:use-module (guix build-system gnu)
25 #:use-module (gnu packages)
26 #:use-module (gnu packages flex)
27 #:use-module (gnu packages bison)
28 #:use-module (gnu packages gettext)
29 #:use-module (gnu packages fontutils)
30 #:use-module (gnu packages linux)
31 #:use-module (gnu packages qemu)
32 #:use-module (gnu packages man)
33 #:use-module (gnu packages texinfo)
34 #:use-module (gnu packages ncurses)
35 #:use-module (gnu packages cdrom)
36 #:use-module (srfi srfi-1))
37
38 (define qemu-for-tests
39 ;; Newer QEMU versions, such as 1.5.1, no longer support the 'shutdown'
40 ;; instruction. This leads to test hangs, as reported at
41 ;; <https://bugs.launchpad.net/bugs/947597> and fixed at
42 ;; <http://bzr.savannah.gnu.org/lh/grub/trunk/grub/revision/4828>.
43 ;; Work around it by using an older QEMU.
44 (package (inherit qemu-headless)
45 (version "1.3.1")
46 (source (origin
47 (method url-fetch)
48 (uri (string-append "http://wiki.qemu-project.org/download/qemu-"
49 version ".tar.bz2"))
50 (sha256
51 (base32
52 "1bqfrb5dlsxm8gxhkksz8qzi5fhj3xqhxyfwbqcphhcv1kpyfwip"))))
53
54 ;; With recent GLib versions, we get a test failure:
55 ;; ERROR:tests/rtc-test.c:176:check_time: assertion failed (ABS(t - s) <= wiggle): (382597824 <= 2)
56 ;; Simply disable the tests.
57 (arguments `(#:tests? #f
58 ,@(package-arguments qemu)))
59
60 ;; The manual fails to build with Texinfo 5.x.
61 (native-inputs (alist-delete "texinfo" (package-native-inputs qemu)))))
62
63 (define unifont
64 ;; GNU Unifont, <http://gnu.org/s/unifont>.
65 ;; GRUB needs it for its graphical terminal, gfxterm.
66 (origin
67 (method url-fetch)
68 (uri
69 "http://unifoundry.com/pub/unifont-7.0.06/font-builds/unifont-7.0.06.bdf.gz")
70 (sha256
71 (base32
72 "0p2vhnc18cnbmb39vq4m7hzv4mhnm2l0a2s7gx3ar277fwng3hys"))))
73
74 (define-public grub
75 (package
76 (name "grub")
77 (version "2.00")
78 (source (origin
79 (method url-fetch)
80 (uri (string-append "mirror://gnu/grub/grub-"
81 version ".tar.xz"))
82 (sha256
83 (base32
84 "0n64hpmsccvicagvr0c6v0kgp2yw0kgnd3jvsyd26cnwgs7c6kkq"))
85 (patches (list (search-patch "grub-gets-undeclared.patch")
86 (search-patch "grub-freetype.patch")))))
87 (build-system gnu-build-system)
88 (arguments
89 '(#:configure-flags '("--disable-werror")
90 #:phases (modify-phases %standard-phases
91 (add-after
92 'unpack 'patch-stuff
93 (lambda* (#:key inputs #:allow-other-keys)
94 (substitute* "grub-core/Makefile.in"
95 (("/bin/sh") (which "sh")))
96
97 ;; Make the font visible.
98 (copy-file (assoc-ref inputs "unifont") "unifont.bdf.gz")
99 (system* "gunzip" "unifont.bdf.gz")
100
101 ;; TODO: Re-enable this test when we have Parted.
102 (substitute* "tests/partmap_test.in"
103 (("set -e") "exit 77"))
104
105 #t)))))
106 (inputs
107 `(;; ("lvm2" ,lvm2)
108 ("gettext" ,gnu-gettext)
109 ("freetype" ,freetype)
110 ;; ("libusb" ,libusb)
111 ;; ("fuse" ,fuse)
112 ("ncurses" ,ncurses)))
113 (native-inputs
114 `(("unifont" ,unifont)
115 ("bison" ,bison)
116 ("flex" ,flex)
117 ("texinfo" ,texinfo)
118 ("help2man" ,help2man)
119
120 ;; Dependencies for the test suite. The "real" QEMU is needed here,
121 ;; because several targets are used.
122 ("qemu" ,qemu-for-tests)
123 ("xorriso" ,xorriso)))
124 (home-page "http://www.gnu.org/software/grub/")
125 (synopsis "GRand Unified Boot loader")
126 (description
127 "GRUB is a multiboot bootloader. It is used for initially loading the
128 kernel of an operating system and then transferring control to it. The kernel
129 then goes on to load the rest of the operating system. As a multiboot
130 bootloader, GRUB handles the presence of multiple operating systems installed
131 on the same computer; upon booting the computer, the user is presented with a
132 menu to select one of the installed operating systems.")
133 (license gpl3+)))