gnu: packages: Use 'search-patches' everywhere.
[jackhill/guix/guix.git] / gnu / packages / grub.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
4 ;;; Copyright © 2015 Leo Famulari <leo@famulari.name>
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)
29 #:use-module (gnu packages gettext)
30 #:use-module (gnu packages fontutils)
31 #:use-module (gnu packages linux)
32 #:use-module (gnu packages qemu)
33 #:use-module (gnu packages man)
34 #:use-module (gnu packages texinfo)
35 #:use-module (gnu packages ncurses)
36 #:use-module (gnu packages cdrom)
37 #:use-module (srfi srfi-1))
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.
45 (package (inherit qemu-minimal)
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
59 ,@(package-arguments qemu-minimal)))
60
61 ;; The manual fails to build with Texinfo 5.x.
62 (native-inputs (alist-delete "texinfo" (package-native-inputs qemu)))))
63
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
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
85 "0n64hpmsccvicagvr0c6v0kgp2yw0kgnd3jvsyd26cnwgs7c6kkq"))
86 (patches (search-patches "grub-gets-undeclared.patch"
87 "grub-freetype.patch"
88 "grub-CVE-2015-8370.patch"))))
89 (build-system gnu-build-system)
90 (arguments
91 '(#:configure-flags '("--disable-werror")
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")))
98
99 ;; Make the font visible.
100 (copy-file (assoc-ref inputs "unifont") "unifont.bdf.gz")
101 (system* "gunzip" "unifont.bdf.gz")
102
103 ;; TODO: Re-enable this test when we have Parted.
104 (substitute* "tests/partmap_test.in"
105 (("set -e") "exit 77"))
106
107 #t)))))
108 (inputs
109 `(;; ("lvm2" ,lvm2)
110 ("gettext" ,gnu-gettext)
111 ("freetype" ,freetype)
112 ;; ("libusb" ,libusb)
113 ;; ("fuse" ,fuse)
114 ("ncurses" ,ncurses)))
115 (native-inputs
116 `(("unifont" ,unifont)
117 ("bison" ,bison)
118 ("flex" ,flex)
119 ("texinfo" ,texinfo)
120 ("help2man" ,help2man)
121
122 ;; Dependencies for the test suite. The "real" QEMU is needed here,
123 ;; because several targets are used.
124 ("qemu" ,qemu-for-tests)
125 ("xorriso" ,xorriso)))
126 (home-page "http://www.gnu.org/software/grub/")
127 (synopsis "GRand Unified Boot loader")
128 (description
129 "GRUB is a multiboot bootloader. It is used for initially loading the
130 kernel of an operating system and then transferring control to it. The kernel
131 then goes on to load the rest of the operating system. As a multiboot
132 bootloader, GRUB handles the presence of multiple operating systems installed
133 on the same computer; upon booting the computer, the user is presented with a
134 menu to select one of the installed operating systems.")
135 (license gpl3+)))