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