2 # - reap out which in probe scripts and drop R: which
3 # - subpackages? e.g. modules and utils
4 # - check where is that locale path: /boot/grub/locale and fix it or change it
6 # --enable-grub-emu-usb conflicts with --enable-grub-emu-pci, emu-pci seems experimental
7 # - to build and install the `grub-emu' debugging utility we need to re-run build with --target=emu
8 # - put grub-emu to subpackage if it is fixed
11 %bcond_with grubemu # grub-emu debugging utility
12 %bcond_without efiemu # efiemu runtimes
13 %bcond_without pc # PC BIOS platform support (x86 specific)
14 %bcond_without efi # EFI platform support
16 %ifnarch %{ix86} %{x8664} x32
19 %ifnarch %{ix86} %{x8664} x32 %{arm} aarch64 ia64
24 # non-x86_64 arch doesn't support this
28 # the 'most natural' platform should go last
29 # TODO? coreboot@{ix86,arm}, ieee1275@ix86, multiboot@ix86, qemu@ix86, qemu_mips@{mips,mipsel} xen@x86*, xen_pvh@ix86
30 %ifarch %{ix86} %{x8664} x32
31 %define platforms %{?with_efi:efi} %{?with_pc:pc}
34 %define platforms efi uboot
36 %ifarch aarch64 ia64 riscv32 riscv64
43 %define platforms arc loongson
45 %ifarch ppc ppc64 sparc64
46 %define platforms ieee1275
50 Summary: GRand Unified Bootloader
51 Summary(de.UTF-8): GRUB2 - ein Bootloader für x86 und ppc
52 Summary(hu.UTF-8): GRUB2 - rendszerbetöltő x86 és ppc gépekhez
53 Summary(pl.UTF-8): GRUB2 - bootloader dla x86 i ppc
54 Summary(pt_BR.UTF-8): Gerenciador de inicialização GRUB2
60 Source0: ftp://ftp.gnu.org/gnu/grub/grub-%{version}.tar.xz
61 # Source0-md5: cf0fd928b1e5479c8108ee52cb114363
63 Source2: update-grub.8
64 Source3: grub.sysconfig
65 Source4: grub-custom.cfg
66 Patch1: pld-sysconfdir.patch
67 Patch2: grub-garbage.patch
68 Patch3: grub-lvmdevice.patch
69 Patch4: pld-mkconfigdir.patch
70 Patch5: grub-mkconfig-diagnostics.patch
72 Patch7: %{name}-fonts_path.patch
73 Patch9: just-say-linux.patch
74 Patch10: ignore-kernel-symlinks.patch
75 Patch11: choose-preferred-initrd.patch
76 Patch12: %{name}-cfg.patch
77 Patch13: efi-net-fix.patch
79 URL: http://www.gnu.org/software/grub/
80 BuildRequires: autoconf >= 2.63
81 BuildRequires: automake >= 1:1.11.1-1
83 BuildRequires: device-mapper-devel
84 BuildRequires: flex >= 2.5.35
85 BuildRequires: fonts-TTF-DejaVu
86 BuildRequires: freetype-devel >= 2
88 BuildRequires: gcc >= 5:3.4
89 BuildRequires: gettext-tools >= 0.18.3
90 BuildRequires: glibc-localedb-all
91 BuildRequires: glibc-static
92 BuildRequires: help2man
93 BuildRequires: libfuse-devel
94 BuildRequires: libtool
95 BuildRequires: ncurses-devel
96 BuildRequires: pkgconfig
97 BuildRequires: python >= 2.6
98 BuildRequires: python-modules >= 2.6
99 BuildRequires: rpm >= 4.4.9-56
100 BuildRequires: rpm-build >= 4.6
101 BuildRequires: rpmbuild(macros) >= 1.213
102 BuildRequires: sed >= 4.0
103 BuildRequires: tar >= 1:1.22
104 BuildRequires: texinfo
106 BuildRequires: xz-devel
108 BuildRequires: /usr/lib/libc.so
109 %if "%{pld_release}" == "ac"
110 BuildRequires: libgcc32
112 BuildRequires: gcc-multilib-32
115 Requires: %{name}-platform = %{version}-%{release}
116 Requires: pld-release
118 %ifarch %{ix86} %{x8664}
119 Suggests: %{name}-platform-pc
121 Suggests: cdrkit-mkisofs
125 ExclusiveArch: %{ix86} %{x8664} x32 %{arm} aarch64 ia64 mips mipsel ppc ppc64 riscv32 riscv64 sparc64
126 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
128 %define _sbindir /sbin
129 %define _bindir %{_sbindir}
131 %define _datadir %{_libdir}
132 %define _libexecdir %{_libdir}/grub
133 %define _grubdir /boot/grub
134 %define _localedir /usr/share/locale
136 # part of grub code is not relocable (these are not Linux libs)
137 # stack protector also breaks non-Linux binaries
138 # any kind of forced optimizations makes grub2 unreliable (random
139 # reboots and hangs on boot menu screen)
140 %define filterout_c -fPIC -O.
141 %undefine _ssp_cflags
142 %undefine _fortify_cflags
145 GRUB is a GPLed bootloader intended to unify bootloading across x86
146 operating systems. In addition to loading the Linux and *BSD kernels,
147 it implements the Multiboot standard, which allows for flexible
148 loading of multiple boot images (needed for modular kernels such as
151 GRUB 2 is derived from PUPA which was a research project to
152 investigate the next generation of GRUB. GRUB 2 has been rewritten
153 from scratch to clean up everything for modularity and portability.
155 GRUB 2 targets at the following goals:
156 - Scripting support, such as conditionals, loops, variables and
158 - Graphical interface.
159 - Dynamic loading of modules in order to extend itself at the run time
160 rather than at the build time.
161 - Portability for various architectures.
162 - Internationalization. This includes support for non-ASCII character
163 code, message catalogs like gettext, fonts, graphics console, and so
165 - Real memory management, to make GNU GRUB more extensible.
166 - Modular, hierarchical, object-oriented framework for file systems,
167 files, devices, drives, terminals, commands, partition tables and OS
169 - Cross-platform installation which allows for installing GRUB from a
170 different architecture.
171 - Rescue mode saves unbootable cases. Stage 1.5 was eliminated.
172 - Fix design mistakes in GRUB Legacy, which could not be solved for
173 backward-compatibility, such as the way of numbering partitions.
175 %description -l de.UTF-8
176 GRUB (GRand Unified Boot-loader) ist ein Bootloader, der oft auf
177 Rechnern eingesetzt wird, auf denen das freie Betriebssystem Linux
178 läuft. GRUB löst den betagten LILO (Linux-Loader) ab.
180 GRUB wurde innerhalb des GNU Hurd-Projektes als Boot-Loader entwickelt
181 und wird unter der GPL vertrieben. Aufgrund seiner höheren
182 Flexibilität verdrängt GRUB in vielen Linux-Distributionen den
183 traditionellen Boot-Loader LILO.
185 %description -l hu.UTF-8
186 GRUB egy GPL liszenszű rendszerbetöltő. Linux és *BSD kernelek
187 betöltése mellett támogatja a Multiboot standard-ot, amely lehetővé
188 teszi boot képek betöltését (moduláris kerneleknek kell, mint pl. a
191 GRUB2 céljai a következők:
192 - szkriptelés támogatása, úgymint feltételek, ciklusok, változók,
195 - modulok dinamikus betöltése futási időben
196 - hordozhatóság több architektúrára
197 - többnyelvűség: nem-ASCII karakterek támogatása, üzenetkatalógusok,
198 mint gettext, betűtípusok, grafikus konzolon, és így tovább
199 - valós memória kezelés, amellyel még bővíthetőbbé tehetjük
200 - moduláris, hierarchikus, objektum-orientált keretrendszer
201 fájlrendszerekhez, fájlokhoz, eszközökhöz, meghajtókhoz,
202 terminálokhoz, parancsokhoz, partíciós táblákhoz és OS betöltőkhöz
204 %description -l es.UTF-8
205 Éste es GRUB - Grand Unified Boot Loader - un administrador de
206 inicialización capaz de entrar en la mayoría de los sistemas
207 operacionales libres - Linux, FreeBSD, NetBSD, GNU Mach, etc. como
208 también en la mayoría de los sistemas operacionales comerciales para
211 El administrador GRUB puede ser una buena alternativa a LILO, para
212 usuarios conmás experiencia y que deseen obtener más recursos de su
213 cargador de inicialización (boot loader).
215 %description -l pl.UTF-8
216 GRUB jest bootloaderem na licencji GNU GPL, mającym na celu unifikację
217 procesu bootowania na systemach x86. Potrafi nie tylko ładować jądra
218 Linuksa i *BSD: posiada również implementację standardu Multiboot,
219 który pozwala na elastyczne ładowanie wielu obrazów bootowalnych
220 (czego wymagają modułowe jądra, takie jak GNU Hurd).
222 %description -l pt_BR.UTF-8
223 Esse é o GRUB - Grand Unified Boot Loader - um gerenciador de boot
224 capaz de entrar na maioria dos sistemas operacionais livres - Linux,
225 FreeBSD, NetBSD, GNU Mach, etc. assim como na maioria dos sistemas
226 operacionais comerciais para PC.
228 O GRUB pode ser uma boa alternativa ao LILO, para usuários mais
229 avançados e que querem mais recursos de seu boot loader.
231 %package -n bash-completion-%{name}
232 Summary: bash-completion for GRUB
233 Summary(pl.UTF-8): Bashowe uzupełnianie nazw dla GRUB-a
234 Group: Applications/Shells
235 Requires: bash-completion
238 %description -n bash-completion-%{name}
239 This package provides bash-completion for GRUB.
241 %description -n bash-completion-%{name} -l pl.UTF-8
242 Pakiet ten dostarcza bashowe uzupełnianie nazw dla GRUB-a.
245 Summary: PC BIOS platform support for GRUB
246 Summary(pl.UTF-8): Obsługa platformy PC BIOS dla GRUB-a
248 Provides: %{name}-platform = %{version}-%{release}
250 %description platform-pc
251 PC BIOS platform support for GRUB.
253 %description platform-pc -l pl.UTF-8
254 Obsługa platformy PC BIOS dla GRUB-a.
256 %package platform-efi
257 Summary: (U)EFI platform support for GRUB
258 Summary(pl.UTF-8): Obsługa platformy (U)EFI dla GRUB-a
261 Provides: %{name}-platform = %{version}-%{release}
263 %description platform-efi
264 (U)EFI platform support for GRUB.
266 %description platform-efi -l pl.UTF-8
267 Obsługa platformy (U)EFI dla GRUB-a.
270 Summary: GRUB font files converter
271 Summary(pl.UTF-8): Konwerter plików fontów GRUB-a
275 Converts common font file formats into PF2.
277 %description mkfont -l pl.UTF-8
278 Program do konwersji popularnych formatów plików fontów do PF2.
280 %package theme-starfield
281 Summary: starfield theme for GRUB
282 Summary(pl.UTF-8): Motyw starfield dla GRUB-a
285 %description theme-starfield
286 starfield theme for GRUB.
288 %description theme-starfield -l pl.UTF-8
289 Motyw starfield dla GRUB-a.
292 %setup -q -n grub-%{version}
307 # we don't have C.utf-8 and need an UTF-8 locale for build
308 sed -i -e 's/LC_ALL=C.UTF-8/LC_ALL=en_US.utf-8/g' po/Makefile* po/Rules*
311 # if gold is used then grub doesn't even boot
312 # https://savannah.gnu.org/bugs/?34539
313 # http://sourceware.org/bugzilla/show_bug.cgi?id=14196
315 ln -f -s /usr/bin/ld.bfd our-ld/ld
316 export PATH=$(pwd)/our-ld:$PATH
318 ## not only the typicall autotools stuff
327 for platform in %{platforms} ; do
328 install -d build-${platform}
331 if [ "$platform" != "efi" ] ; then
332 platform_opts="--enable-efiemu%{!?with_efiemu:=no}"
337 ln -f -s ../configure .
338 # mawk stalls at ./genmoddep.awk, so force gawk
341 --with-platform=${platform} \
343 --enable-grub-themes \
345 --enable-grub-emu-usb \
346 --enable-grub-emu-sdl \
347 --enable-grub-emu-pci \
350 TARGET_LDFLAGS=-static
352 %{__make} -j1 -C po update-gmo
358 rm -rf $RPM_BUILD_ROOT
360 for platform in %{platforms} ; do
363 pkgdatadir=%{_libexecdir} \
364 pkglibdir=%{_libexecdir} \
365 DESTDIR=$RPM_BUILD_ROOT
370 %{__rm} -r $RPM_BUILD_ROOT%{_localedir}/de@hebrew
371 %{__rm} -r $RPM_BUILD_ROOT%{_localedir}/en@{arabic,cyrillic,greek,hebrew,piglatin}
375 # this must be after 'make install'
376 install -d $RPM_BUILD_ROOT%{_libexecdir}/locale
378 install -d $RPM_BUILD_ROOT%{_grubdir}
379 cp -p docs/grub.cfg $RPM_BUILD_ROOT%{_grubdir}
382 cp -p %{SOURCE4} $RPM_BUILD_ROOT%{_grubdir}/custom.cfg
383 %{__rm} $RPM_BUILD_ROOT/lib/grub.d/40_custom
385 install -p %{SOURCE1} $RPM_BUILD_ROOT%{_sbindir}/update-grub
386 cp -p %{SOURCE2} $RPM_BUILD_ROOT%{_mandir}/man8/update-grub.8
388 install -d $RPM_BUILD_ROOT/etc/sysconfig
389 cp -p %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/grub
391 # rm -f, because it sometimes exists, sometimes not, depending which texlive you have installed
392 rm -f $RPM_BUILD_ROOT%{_infodir}/dir
394 # platform specific, unnecessarily always installed
395 %ifnarch %{ix86} %{x8664} x32
396 %{__rm} $RPM_BUILD_ROOT{%{_sbindir}/grub-bios-setup,%{_mandir}/man8/grub-bios-setup.8}
399 %{__rm} $RPM_BUILD_ROOT{%{_sbindir}/grub-sparc64-setup,%{_mandir}/man8/grub-sparc64-setup.8}
402 # core.img - bootable image generated by grub-mkimage(1) via grub-install(1)
403 touch $RPM_BUILD_ROOT%{_grubdir}/core.img
404 touch $RPM_BUILD_ROOT%{_grubdir}/device.map
406 # needs to be exactly 1KiB
407 # but we're ghosting it. so whom are we kidding here? :P (maybe %config it in future?)
408 dd bs=1024 if=/dev/zero count=1 of=$RPM_BUILD_ROOT%{_grubdir}/grubenv
411 rm -rf $RPM_BUILD_ROOT
413 %post -p %{_sbindir}/postshell
414 -/usr/sbin/fix-info-dir -c %{_infodir}
416 %postun -p %{_sbindir}/postshell
417 -/usr/sbin/fix-info-dir -c %{_infodir}
419 %triggerpostun -- %{name} < 2.00-2
420 # Note this trigger on version upgrade needed only for upgrade from
421 # old grub2 packages which contained modules in /boot/grub
422 # or were built with optimizations enabled
423 # don't do anything on --downgrade
424 if [ $1 -le 1 ]; then
427 echo "Grub was upgraded, trying to setup it to boot sector"
428 /sbin/grub-install '(hd0)' || :
430 %triggerpostun -- %{name} < 1.99-7.3
431 # migrate /etc/grub.d/custom.cfg.rpmsave -> /boot/grub/custom.cfg
432 if [ -f %{_sysconfdir}/grub.d/custom.cfg.rpmsave ]; then
433 cp -f %{_grubdir}/custom.cfg{,.rpmnew}
434 mv -f %{_sysconfdir}/grub.d/custom.cfg.rpmsave %{_grubdir}/custom.cfg
438 %defattr(644,root,root,755)
439 %doc AUTHORS ChangeLog NEWS README THANKS TODO
440 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/grub
441 %attr(755,root,root) %{_sbindir}/grub-editenv
442 %attr(755,root,root) %{_sbindir}/grub-fstest
443 %attr(755,root,root) %{_sbindir}/grub-file
444 %attr(755,root,root) %{_sbindir}/grub-glue-efi
445 %attr(755,root,root) %{_sbindir}/grub-kbdcomp
446 %attr(755,root,root) %{_sbindir}/grub-install
447 %attr(755,root,root) %{_sbindir}/grub-macbless
448 %attr(755,root,root) %{_sbindir}/grub-menulst2cfg
449 %attr(755,root,root) %{_sbindir}/grub-mkconfig
450 %attr(755,root,root) %{_sbindir}/grub-mklayout
451 %attr(755,root,root) %{_sbindir}/grub-mknetdir
452 %attr(755,root,root) %{_sbindir}/grub-mkpasswd-pbkdf2
453 %attr(755,root,root) %{_sbindir}/grub-mkrelpath
454 %attr(755,root,root) %{_sbindir}/grub-mkrescue
455 %attr(755,root,root) %{_sbindir}/grub-mkstandalone
456 %attr(755,root,root) %{_sbindir}/grub-mount
457 %attr(755,root,root) %{_sbindir}/grub-ofpathname
458 %attr(755,root,root) %{_sbindir}/grub-reboot
459 %attr(755,root,root) %{_sbindir}/grub-render-label
460 %attr(755,root,root) %{_sbindir}/grub-script-check
461 %attr(755,root,root) %{_sbindir}/grub-set-default
462 %attr(755,root,root) %{_sbindir}/grub-syslinux2cfg
463 %attr(755,root,root) %{_sbindir}/update-grub
464 %ifarch %{ix86} %{x8664} x32
465 %attr(755,root,root) %{_sbindir}/grub-bios-setup
466 %{_mandir}/man8/grub-bios-setup.8*
468 %ifarch %{ix86} %{x8664} x32
469 %attr(755,root,root) %{_sbindir}/grub-mkimage
470 %{_mandir}/man1/grub-mkimage.1*
472 %attr(755,root,root) %{_sbindir}/grub-probe
473 %{_mandir}/man8/grub-probe.8*
476 %attr(755,root,root) %{_sbindir}/grub-sparc64-setup
477 %{_mandir}/man8/grub-sparc64-setup.8*
479 %{_mandir}/man1/grub-editenv.1*
480 %{_mandir}/man1/grub-file.1*
481 %{_mandir}/man1/grub-fstest.1*
482 %{_mandir}/man1/grub-glue-efi.1*
483 %{_mandir}/man1/grub-kbdcomp.1*
484 %{_mandir}/man1/grub-menulst2cfg.1*
485 %{_mandir}/man1/grub-mklayout.1*
486 %{_mandir}/man1/grub-mknetdir.1*
487 %{_mandir}/man1/grub-mkpasswd-pbkdf2.1*
488 %{_mandir}/man1/grub-mkrelpath.1*
489 %{_mandir}/man1/grub-mkrescue.1*
490 %{_mandir}/man1/grub-mkstandalone.1*
491 %{_mandir}/man1/grub-mount.1*
492 %{_mandir}/man1/grub-render-label.1*
493 %{_mandir}/man1/grub-script-check.1*
494 %{_mandir}/man1/grub-syslinux2cfg.1*
495 %{_mandir}/man8/grub-install.8*
496 %{_mandir}/man8/grub-macbless.8*
497 %{_mandir}/man8/grub-mkconfig.8*
498 %{_mandir}/man8/grub-ofpathname.8*
499 %{_mandir}/man8/grub-reboot.8*
500 %{_mandir}/man8/grub-set-default.8*
501 %{_mandir}/man8/update-grub.8*
503 %attr(755,root,root) %{_sbindir}/grub-emu
504 %{_mandir}/man8/grub-emu.8*
506 %{_libexecdir}/grub-mkconfig_lib
510 # XXX: check this locale dir location and if it is neccesaary to exist on /boot
512 %dir %{_libexecdir}/locale
513 %config(noreplace) %verify(not md5 mtime size) %{_grubdir}/grub.cfg
514 %config(noreplace) %verify(not md5 mtime size) %{_grubdir}/custom.cfg
516 # generated by grub at runtime
517 %ghost %{_grubdir}/device.map
518 %ghost %{_grubdir}/core.img
519 %ghost %{_grubdir}/grubenv
522 %doc /lib/grub.d/README
523 %attr(755,root,root) /lib/grub.d/00_header
524 %attr(755,root,root) /lib/grub.d/10_linux
525 %attr(755,root,root) /lib/grub.d/20_linux_xen
526 %attr(755,root,root) /lib/grub.d/30_os-prober
527 %attr(755,root,root) /lib/grub.d/41_custom
529 # these are now installed only on matching hosts
530 #%attr(755,root,root) /lib/grub.d/10_hurd
531 #%attr(755,root,root) /lib/grub.d/10_illumos
532 #%attr(755,root,root) /lib/grub.d/10_kfreebsd
533 #%attr(755,root,root) /lib/grub.d/10_netbsd
534 #%attr(755,root,root) /lib/grub.d/10_xnu
536 %ifarch %{ix86} %{x8664} x32
537 %attr(755,root,root) %{_sbindir}/grub-probe
538 %{_mandir}/man8/grub-probe.8*
541 %{_infodir}/grub*.info*
543 %dir %{_datadir}/grub/themes
545 %files -n bash-completion-%{name}
546 %defattr(644,root,root,755)
547 /etc/bash_completion.d/grub
551 %defattr(644,root,root,755)
552 %dir %{_libexecdir}/*-pc
553 %{_libexecdir}/*-pc/modinfo.sh
554 %{_libexecdir}/*-pc/*.exec
555 %{_libexecdir}/*-pc/*.image
556 %{_libexecdir}/*-pc/*.lst
557 %{_libexecdir}/*-pc/*.mod
558 %{_libexecdir}/*-pc/*.module
559 %{_libexecdir}/*-pc/lzma_decompress.img
560 %{_libexecdir}/*-pc/config.h
561 %{_libexecdir}/*-pc/gdb_grub
562 %{_libexecdir}/*-pc/gmodule.pl
564 %{_libexecdir}/*-pc/efiemu*.o
566 %{_libexecdir}/*-pc/kernel.img
567 %ifarch %{ix86} %{x8664} x32
568 %{_libexecdir}/*-pc/boot.img
569 %{_libexecdir}/*-pc/boot_hybrid.img
570 %{_libexecdir}/*-pc/cdboot.img
571 %{_libexecdir}/*-pc/diskboot.img
572 %{_libexecdir}/*-pc/lnxboot.img
573 %{_libexecdir}/*-pc/pxeboot.img
579 %defattr(644,root,root,755)
580 %attr(755,root,root) /lib/grub.d/30_uefi-firmware
581 %dir %{_libexecdir}/*-efi
582 %{_libexecdir}/*-efi/modinfo.sh
583 %{_libexecdir}/*-efi/*.exec
584 %{_libexecdir}/*-efi/*.lst
585 %{_libexecdir}/*-efi/*.mod
586 %{_libexecdir}/*-efi/*.module
587 %{_libexecdir}/*-efi/config.h
588 %{_libexecdir}/*-efi/gdb_grub
589 %{_libexecdir}/*-efi/gmodule.pl
590 %{_libexecdir}/*-efi/kernel.img
594 %defattr(644,root,root,755)
595 %attr(755,root,root) %{_sbindir}/grub-mkfont
596 %{_mandir}/man1/grub-mkfont.1*
598 %files theme-starfield
599 %defattr(644,root,root,755)
600 %{_datadir}/grub/themes/starfield