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 # build grub-emu debugging utility
12 %bcond_without efiemu # build efiemu runtimes
13 %bcond_without pc # do not build for PC BIOS platform
14 %bcond_without efi # do not build for EFI platform
16 %ifnarch %{ix86} %{x8664}
19 %ifnarch %{ix86} %{x8664} ia64
24 # non-x86_64 arch doesn't support this
28 # the 'most natural' platform should go last
29 %ifarch %{ix86} %{x8664} ia64
30 %define platforms %{?with_efi:efi} %{?with_pc:pc}
32 %ifarch ppc ppc64 sparc64
33 %define platforms ieee1275
39 %define platforms loongson
42 Summary: GRand Unified Bootloader
43 Summary(de.UTF-8): GRUB2 - ein Bootloader für x86 und ppc
44 Summary(hu.UTF-8): GRUB2 - rendszerbetöltő x86 és ppc gépekhez
45 Summary(pl.UTF-8): GRUB2 - bootloader dla x86 i ppc
46 Summary(pt_BR.UTF-8): Gerenciador de inicialização GRUB2
52 Source0: http://ftp.gnu.org/gnu/grub/grub-%{version}.tar.xz
53 # Source0-md5: a1043102fbc7bcedbf53e7ee3d17ab91
55 Source2: update-grub.8
56 Source3: grub.sysconfig
57 Source4: grub-custom.cfg
58 Patch1: pld-sysconfdir.patch
59 Patch2: grub-garbage.patch
60 Patch3: grub-lvmdevice.patch
61 Patch4: pld-mkconfigdir.patch
62 Patch5: grub-mkconfig-diagnostics.patch
64 Patch7: %{name}-awk.patch
66 Patch9: %{name}-gets.patch
67 Patch10: %{name}-fonts_path.patch
68 Patch11: %{name}-tftp_fixes.patch
69 Patch12: add-vlan-tag-support.patch
70 Patch13: just-say-linux.patch
71 Patch14: add-GRUB-DISABLE-SUBMENU-option.patch
72 Patch15: add-X-option-to-printf-functions.patch
73 Patch16: dhcp-client-id-and-uuid-options-added.patch
74 Patch17: fix-http-crash.patch
75 Patch18: Issue-separate-DNS-queries-for-ipv4-and-ipv6.patch
76 Patch19: search-for-specific-config-file-for-netboot.patch
77 Patch20: ignore-kernel-symlinks.patch
78 Patch21: choose-preferred-initrd.patch
79 Patch22: %{name}-cfg.patch
80 Patch23: %{name}-freetype_include.patch
81 Patch24: %{name}-efinet_fix.patch
82 Patch25: %{name}-linuxefi.patch
83 Patch26: %{name}-generated_files.patch
84 URL: http://www.gnu.org/software/grub/
85 BuildRequires: autoconf >= 2.53
86 BuildRequires: autogen
87 BuildRequires: automake >= 1:1.11.1-1
89 BuildRequires: device-mapper-devel
90 BuildRequires: flex >= 2.5.35
91 BuildRequires: fonts-TTF-DejaVu
92 BuildRequires: freetype-devel >= 2
94 BuildRequires: gettext-devel
95 BuildRequires: glibc-static
96 BuildRequires: help2man
97 BuildRequires: libfuse-devel
98 BuildRequires: libtool
99 BuildRequires: ncurses-devel
100 BuildRequires: rpm >= 4.4.9-56
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
115 Requires: %{name}-platform = %{version}-%{release}
118 %ifarch %{ix86} %{x8664}
119 Suggests: %{name}-platform-pc
121 Suggests: cdrkit-mkisofs
125 ExclusiveArch: %{ix86} %{x8664} ia64 mips mipsel ppc ppc64 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
237 %description -n bash-completion-%{name}
238 This package provides bash-completion for GRUB.
240 %description -n bash-completion-%{name} -l pl.UTF-8
241 Pakiet ten dostarcza bashowe uzupełnianie nazw dla GRUB-a.
244 Summary: PC BIOS platform support for GRUB
245 Summary(pl.UTF-8): Obsługa platformy PC BIOS dla GRUB-a
247 Provides: %{name}-platform = %{version}-%{release}
249 %description platform-pc
250 PC BIOS platform support for GRUB.
252 %description platform-pc -l pl.UTF-8
253 Obsługa platformy PC BIOS dla GRUB-a.
255 %package platform-efi
256 Summary: (U)EFI platform support for GRUB
257 Summary(pl.UTF-8): Obsługa platformy (U)EFI dla GRUB-a
260 Provides: %{name}-platform = %{version}-%{release}
262 %description platform-efi
263 (U)EFI platform support for GRUB.
265 %description platform-efi -l pl.UTF-8
266 Obsługa platformy (U)EFI dla GRUB-a.
269 Summary: GRUB font files converter
270 Summary(pl.UTF-8): Konwerter plików fontów GRUB-a
274 Converts common font file formats into PF2.
276 %description mkfont -l pl.UTF-8
277 Program do konwersji popularnych formatów plików fontów do PF2.
279 %package theme-starfield
280 Summary: starfield theme for GRUB
281 Summary(pl.UTF-8): Motyw starfield dla GRUB-a
284 %description theme-starfield
285 starfield theme for GRUB.
287 %description theme-starfield -l pl.UTF-8
288 Motyw starfield dla GRUB-a.
291 %setup -q -n grub-%{version}
320 # if gold is used then grub doesn't even boot
321 # https://savannah.gnu.org/bugs/?34539
322 # http://sourceware.org/bugzilla/show_bug.cgi?id=14196
324 ln -s /usr/bin/ld.bfd our-ld/ld
325 export PATH=$(pwd)/our-ld:$PATH
327 cp -f /usr/share/automake/config.sub .
331 echo timestamp > stamp-h.in
335 for platform in %{platforms} ; do
336 install -d build-${platform}
339 if [ "$platform" != "efi" ] ; then
340 platform_opts="--enable-efiemu%{!?with_efiemu:=no}"
346 # mawk stalls at ./genmoddep.awk, so force gawk
349 --with-platform=${platform} \
352 --enable-grub-emu-usb \
353 --enable-grub-emu-sdl \
354 --enable-grub-emu-pci \
357 TARGET_LDFLAGS=-static
364 rm -rf $RPM_BUILD_ROOT
366 for platform in %{platforms} ; do
369 pkgdatadir=%{_libexecdir} \
370 pkglibdir=%{_libexecdir} \
371 DESTDIR=$RPM_BUILD_ROOT
376 %{__rm} -r $RPM_BUILD_ROOT%{_localedir}/de@hebrew
377 %{__rm} -r $RPM_BUILD_ROOT%{_localedir}/en@{arabic,cyrillic,greek,hebrew,piglatin}
381 # this must be after 'make install'
382 install -d $RPM_BUILD_ROOT%{_libexecdir}/locale
384 install -d $RPM_BUILD_ROOT%{_grubdir}
385 cp -p docs/grub.cfg $RPM_BUILD_ROOT%{_grubdir}
388 cp -p %{SOURCE4} $RPM_BUILD_ROOT%{_grubdir}/custom.cfg
389 %{__rm} $RPM_BUILD_ROOT/lib/grub.d/40_custom
391 install -p %{SOURCE1} $RPM_BUILD_ROOT%{_sbindir}/update-grub
392 cp -p %{SOURCE2} $RPM_BUILD_ROOT%{_mandir}/man8/update-grub.8
394 install -d $RPM_BUILD_ROOT/etc/sysconfig
395 cp -p %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/grub
397 # rm -f, because it sometimes exists, sometimes not, depending which texlive you have installed
398 rm -f $RPM_BUILD_ROOT%{_infodir}/dir
400 # platform specific, unnecessarily always installed
401 %ifnarch %{ix86} %{x8664}
402 %{__rm} $RPM_BUILD_ROOT{%{_sbindir}/grub-bios-setup,%{_mandir}/man8/grub-bios-setup.8}
405 %{__rm} $RPM_BUILD_ROOT{%{_sbindir}/grub-sparc64-setup,%{_mandir}/man8/grub-sparc64-setup.8}
408 # core.img - bootable image generated by grub-mkimage(1) via grub-install(1)
409 touch $RPM_BUILD_ROOT%{_grubdir}/core.img
410 touch $RPM_BUILD_ROOT%{_grubdir}/device.map
412 # needs to be exactly 1KiB
413 # but we're ghosting it. so whom are we kidding here? :P (maybe %config it in future?)
414 dd bs=1024 if=/dev/zero count=1 of=$RPM_BUILD_ROOT%{_grubdir}/grubenv
417 rm -rf $RPM_BUILD_ROOT
419 %post -p %{_sbindir}/postshell
420 -/usr/sbin/fix-info-dir -c %{_infodir}
422 %postun -p %{_sbindir}/postshell
423 -/usr/sbin/fix-info-dir -c %{_infodir}
425 %triggerpostun -- %{name} < 2.00-2
426 # Note this trigger on version upgrade needed only for upgrade from
427 # old grub2 packages which contained modules in /boot/grub
428 # or were built with optimizations enabled
429 # don't do anything on --downgrade
430 if [ $1 -le 1 ]; then
433 echo "Grub was upgraded, trying to setup it to boot sector"
434 /sbin/grub-install '(hd0)' || :
436 %triggerpostun -- %{name} < 1.99-7.3
437 # migrate /etc/grub.d/custom.cfg.rpmsave -> /boot/grub/custom.cfg
438 if [ -f %{_sysconfdir}/grub.d/custom.cfg.rpmsave ]; then
439 cp -f %{_grubdir}/custom.cfg{,.rpmnew}
440 mv -f %{_sysconfdir}/grub.d/custom.cfg.rpmsave %{_grubdir}/custom.cfg
444 %defattr(644,root,root,755)
445 %doc AUTHORS ChangeLog NEWS README THANKS TODO
446 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/grub
447 %attr(755,root,root) %{_sbindir}/grub-editenv
448 %attr(755,root,root) %{_sbindir}/grub-fstest
449 %attr(755,root,root) %{_sbindir}/grub-kbdcomp
450 %attr(755,root,root) %{_sbindir}/grub-install
451 %attr(755,root,root) %{_sbindir}/grub-menulst2cfg
452 %attr(755,root,root) %{_sbindir}/grub-mkconfig
453 %attr(755,root,root) %{_sbindir}/grub-mklayout
454 %attr(755,root,root) %{_sbindir}/grub-mknetdir
455 %attr(755,root,root) %{_sbindir}/grub-mkpasswd-pbkdf2
456 %attr(755,root,root) %{_sbindir}/grub-mkrelpath
457 %attr(755,root,root) %{_sbindir}/grub-mkrescue
458 %attr(755,root,root) %{_sbindir}/grub-mkstandalone
459 %attr(755,root,root) %{_sbindir}/grub-mount
460 %attr(755,root,root) %{_sbindir}/grub-ofpathname
461 %attr(755,root,root) %{_sbindir}/grub-reboot
462 %attr(755,root,root) %{_sbindir}/grub-script-check
463 %attr(755,root,root) %{_sbindir}/grub-set-default
464 %attr(755,root,root) %{_sbindir}/update-grub
465 %ifarch %{ix86} %{x8664}
466 %attr(755,root,root) %{_sbindir}/grub-bios-setup
467 %{_mandir}/man8/grub-bios-setup.8*
469 %ifarch %{ix86} %{x8664}
470 %attr(755,root,root) %{_sbindir}/grub-mkimage
471 %{_mandir}/man1/grub-mkimage.1*
473 %attr(755,root,root) %{_sbindir}/grub-probe
474 %{_mandir}/man8/grub-probe.8*
477 %attr(755,root,root) %{_sbindir}/grub-sparc64-setup
478 %{_mandir}/man8/grub-sparc64-setup.8*
480 %{_mandir}/man1/grub-editenv.1*
481 %{_mandir}/man1/grub-fstest.1*
482 %{_mandir}/man1/grub-kbdcomp.1*
483 %{_mandir}/man1/grub-menulst2cfg.1*
484 %{_mandir}/man1/grub-mklayout.1*
485 %{_mandir}/man1/grub-mkpasswd-pbkdf2.1*
486 %{_mandir}/man1/grub-mkrelpath.1*
487 %{_mandir}/man1/grub-mkrescue.1*
488 %{_mandir}/man1/grub-mkstandalone.1*
489 %{_mandir}/man1/grub-mount.1*
490 %{_mandir}/man1/grub-script-check.1*
491 %{_mandir}/man8/grub-install.8*
492 %{_mandir}/man8/grub-mkconfig.8*
493 %{_mandir}/man8/grub-mknetdir.8*
494 %{_mandir}/man8/grub-ofpathname.8*
495 %{_mandir}/man8/grub-reboot.8*
496 %{_mandir}/man8/grub-set-default.8*
497 %{_mandir}/man8/update-grub.8*
499 %attr(755,root,root) %{_sbindir}/grub-emu
500 %{_mandir}/man8/grub-emu.8*
502 %{_libexecdir}/grub-mkconfig_lib
506 # XXX: check this locale dir location and if it is neccesaary to exist on /boot
508 %dir %{_libexecdir}/locale
509 %config(noreplace) %verify(not md5 mtime size) %{_grubdir}/grub.cfg
510 %config(noreplace) %verify(not md5 mtime size) %{_grubdir}/custom.cfg
512 # generated by grub at runtime
513 %ghost %{_grubdir}/device.map
514 %ghost %{_grubdir}/core.img
515 %ghost %{_grubdir}/grubenv
518 %doc /lib/grub.d/README
519 %attr(755,root,root) /lib/grub.d/00_header
520 %attr(755,root,root) /lib/grub.d/10_linux
521 %attr(755,root,root) /lib/grub.d/20_linux_xen
522 %attr(755,root,root) /lib/grub.d/30_os-prober
523 %attr(755,root,root) /lib/grub.d/41_custom
525 %ifarch %{ix86} %{x8664}
526 %attr(755,root,root) %{_sbindir}/grub-probe
527 %{_mandir}/man8/grub-probe.8*
530 %{_infodir}/grub*.info*
532 %dir %{_datadir}/grub/themes
536 %defattr(644,root,root,755)
537 %dir %{_libexecdir}/*-pc
538 %{_libexecdir}/*-pc/modinfo.sh
539 %{_libexecdir}/*-pc/*.exec
540 %{_libexecdir}/*-pc/*.image
541 %{_libexecdir}/*-pc/*.lst
542 %{_libexecdir}/*-pc/*.mod
543 %{_libexecdir}/*-pc/*.module
544 %{_libexecdir}/*-pc/lzma_decompress.img
545 %{_libexecdir}/*-pc/config.h
546 %{_libexecdir}/*-pc/gdb_grub
547 %{_libexecdir}/*-pc/gmodule.pl
549 %{_libexecdir}/*-pc/efiemu*.o
551 %{_libexecdir}/*-pc/kernel.img
552 %ifarch %{ix86} %{x8664} sparc sparc64
553 %{_libexecdir}/*-pc/boot.img
554 %{_libexecdir}/*-pc/cdboot.img
555 %{_libexecdir}/*-pc/diskboot.img
556 %{_libexecdir}/*-pc/lnxboot.img
557 %{_libexecdir}/*-pc/pxeboot.img
563 %defattr(644,root,root,755)
564 %dir %{_libexecdir}/*-efi
565 %{_libexecdir}/*-efi/modinfo.sh
566 %{_libexecdir}/*-efi/*.exec
567 %{_libexecdir}/*-efi/*.lst
568 %{_libexecdir}/*-efi/*.mod
569 %{_libexecdir}/*-efi/*.module
570 %{_libexecdir}/*-efi/config.h
571 %{_libexecdir}/*-efi/gdb_grub
572 %{_libexecdir}/*-efi/gmodule.pl
573 %{_libexecdir}/*-efi/kernel.img
577 %defattr(644,root,root,755)
578 %attr(755,root,root) %{_sbindir}/grub-mkfont
579 %{_mandir}/man1/grub-mkfont.1*
581 %files theme-starfield
582 %defattr(644,root,root,755)
583 %{_datadir}/grub/themes/starfield
585 %files -n bash-completion-%{name}
586 %defattr(644,root,root,755)
587 /etc/bash_completion.d/grub