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} x32
19 %ifnarch %{ix86} %{x8664} x32 ia64
24 # non-x86_64 arch doesn't support this
28 # the 'most natural' platform should go last
29 %ifarch %{ix86} %{x8664} x32 ia64
30 %define platforms %{?with_efi:efi} %{?with_pc:pc}
32 %ifarch ppc ppc64 sparc64
33 %define platforms ieee1275
39 %define platforms loongson
43 Summary: GRand Unified Bootloader
44 Summary(de.UTF-8): GRUB2 - ein Bootloader für x86 und ppc
45 Summary(hu.UTF-8): GRUB2 - rendszerbetöltő x86 és ppc gépekhez
46 Summary(pl.UTF-8): GRUB2 - bootloader dla x86 i ppc
47 Summary(pt_BR.UTF-8): Gerenciador de inicialização GRUB2
51 Release: 0.%{beta}.%{rel}
54 # git://git.savannah.gnu.org/grub.git
55 # git checkout %{version}~%{beta} ; make dist
56 Source0: grub-%{version}~%{beta}.tar.gz
57 # Source0-md5: ca6c18f6c5f1ed05b7444017a40573d9
59 Source2: update-grub.8
60 Source3: grub.sysconfig
61 Source4: grub-custom.cfg
63 # TS=$(date +'%Y%m%d') ; tar cjvf grub-po-2.00.git$TS.tar.bz2 po/*.po po/LINGUAS
64 Source5: grub-po-%{version}.git20140104.tar.bz2
65 # Source5-md5: aeef3e636178093cf9d780d92da7afdb
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 Patch8: add-vlan-tag-support.patch
74 Patch9: just-say-linux.patch
75 Patch10: ignore-kernel-symlinks.patch
76 Patch11: choose-preferred-initrd.patch
77 Patch12: %{name}-cfg.patch
78 Patch13: efi-net-fix.patch
79 Patch14: grub2-xfs-Add-helper-for-inode-size.patch
80 Patch15: grub2-xfs-Convert-inode-numbers-to-cpu-endianity-immediate.patch
81 Patch16: grub2-xfs-Fix-termination-loop-for-directory-iteration.patch
82 Patch17: grub2-xfs-V5-filesystem-format-support.patch
83 URL: http://www.gnu.org/software/grub/
84 BuildRequires: autoconf >= 2.53
85 BuildRequires: automake >= 1:1.11.1-1
87 BuildRequires: device-mapper-devel
88 BuildRequires: flex >= 2.5.35
89 BuildRequires: fonts-TTF-DejaVu
90 BuildRequires: freetype-devel >= 2
92 BuildRequires: gcc >= 5:3.4
93 BuildRequires: gettext-tools
94 BuildRequires: glibc-localedb-all
95 BuildRequires: glibc-static
96 BuildRequires: help2man
97 BuildRequires: libfuse-devel
98 BuildRequires: libtool
99 BuildRequires: ncurses-devel
100 BuildRequires: python
101 BuildRequires: python-modules
102 BuildRequires: rpm >= 4.4.9-56
103 BuildRequires: rpmbuild(macros) >= 1.213
104 BuildRequires: sed >= 4.0
105 BuildRequires: tar >= 1:1.22
106 BuildRequires: texinfo
108 BuildRequires: xz-devel
110 BuildRequires: /usr/lib/libc.so
111 %if "%{pld_release}" == "ac"
112 BuildRequires: libgcc32
114 BuildRequires: gcc-multilib-32
117 Requires: %{name}-platform = %{version}-%{release}
118 Requires: pld-release
120 %ifarch %{ix86} %{x8664}
121 Suggests: %{name}-platform-pc
123 Suggests: cdrkit-mkisofs
127 ExclusiveArch: %{ix86} %{x8664} x32 ia64 mips mipsel ppc ppc64 sparc64
128 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
130 %define _sbindir /sbin
131 %define _bindir %{_sbindir}
133 %define _datadir %{_libdir}
134 %define _libexecdir %{_libdir}/grub
135 %define _grubdir /boot/grub
136 %define _localedir /usr/share/locale
138 # part of grub code is not relocable (these are not Linux libs)
139 # stack protector also breaks non-Linux binaries
140 # any kind of forced optimizations makes grub2 unreliable (random
141 # reboots and hangs on boot menu screen)
142 %define filterout_c -fPIC -O.
143 %undefine _ssp_cflags
144 %undefine _fortify_cflags
147 GRUB is a GPLed bootloader intended to unify bootloading across x86
148 operating systems. In addition to loading the Linux and *BSD kernels,
149 it implements the Multiboot standard, which allows for flexible
150 loading of multiple boot images (needed for modular kernels such as
153 GRUB 2 is derived from PUPA which was a research project to
154 investigate the next generation of GRUB. GRUB 2 has been rewritten
155 from scratch to clean up everything for modularity and portability.
157 GRUB 2 targets at the following goals:
158 - Scripting support, such as conditionals, loops, variables and
160 - Graphical interface.
161 - Dynamic loading of modules in order to extend itself at the run time
162 rather than at the build time.
163 - Portability for various architectures.
164 - Internationalization. This includes support for non-ASCII character
165 code, message catalogs like gettext, fonts, graphics console, and so
167 - Real memory management, to make GNU GRUB more extensible.
168 - Modular, hierarchical, object-oriented framework for file systems,
169 files, devices, drives, terminals, commands, partition tables and OS
171 - Cross-platform installation which allows for installing GRUB from a
172 different architecture.
173 - Rescue mode saves unbootable cases. Stage 1.5 was eliminated.
174 - Fix design mistakes in GRUB Legacy, which could not be solved for
175 backward-compatibility, such as the way of numbering partitions.
177 %description -l de.UTF-8
178 GRUB (GRand Unified Boot-loader) ist ein Bootloader, der oft auf
179 Rechnern eingesetzt wird, auf denen das freie Betriebssystem Linux
180 läuft. GRUB löst den betagten LILO (Linux-Loader) ab.
182 GRUB wurde innerhalb des GNU Hurd-Projektes als Boot-Loader entwickelt
183 und wird unter der GPL vertrieben. Aufgrund seiner höheren
184 Flexibilität verdrängt GRUB in vielen Linux-Distributionen den
185 traditionellen Boot-Loader LILO.
187 %description -l hu.UTF-8
188 GRUB egy GPL liszenszű rendszerbetöltő. Linux és *BSD kernelek
189 betöltése mellett támogatja a Multiboot standard-ot, amely lehetővé
190 teszi boot képek betöltését (moduláris kerneleknek kell, mint pl. a
193 GRUB2 céljai a következők:
194 - szkriptelés támogatása, úgymint feltételek, ciklusok, változók,
197 - modulok dinamikus betöltése futási időben
198 - hordozhatóság több architektúrára
199 - többnyelvűség: nem-ASCII karakterek támogatása, üzenetkatalógusok,
200 mint gettext, betűtípusok, grafikus konzolon, és így tovább
201 - valós memória kezelés, amellyel még bővíthetőbbé tehetjük
202 - moduláris, hierarchikus, objektum-orientált keretrendszer
203 fájlrendszerekhez, fájlokhoz, eszközökhöz, meghajtókhoz,
204 terminálokhoz, parancsokhoz, partíciós táblákhoz és OS betöltőkhöz
206 %description -l es.UTF-8
207 Éste es GRUB - Grand Unified Boot Loader - un administrador de
208 inicialización capaz de entrar en la mayoría de los sistemas
209 operacionales libres - Linux, FreeBSD, NetBSD, GNU Mach, etc. como
210 también en la mayoría de los sistemas operacionales comerciales para
213 El administrador GRUB puede ser una buena alternativa a LILO, para
214 usuarios conmás experiencia y que deseen obtener más recursos de su
215 cargador de inicialización (boot loader).
217 %description -l pl.UTF-8
218 GRUB jest bootloaderem na licencji GNU GPL, mającym na celu unifikację
219 procesu bootowania na systemach x86. Potrafi nie tylko ładować jądra
220 Linuksa i *BSD: posiada również implementację standardu Multiboot,
221 który pozwala na elastyczne ładowanie wielu obrazów bootowalnych
222 (czego wymagają modułowe jądra, takie jak GNU Hurd).
224 %description -l pt_BR.UTF-8
225 Esse é o GRUB - Grand Unified Boot Loader - um gerenciador de boot
226 capaz de entrar na maioria dos sistemas operacionais livres - Linux,
227 FreeBSD, NetBSD, GNU Mach, etc. assim como na maioria dos sistemas
228 operacionais comerciais para PC.
230 O GRUB pode ser uma boa alternativa ao LILO, para usuários mais
231 avançados e que querem mais recursos de seu boot loader.
233 %package -n bash-completion-%{name}
234 Summary: bash-completion for GRUB
235 Summary(pl.UTF-8): Bashowe uzupełnianie nazw dla GRUB-a
236 Group: Applications/Shells
237 Requires: bash-completion
238 %if "%{_rpmversion}" >= "5"
242 %description -n bash-completion-%{name}
243 This package provides bash-completion for GRUB.
245 %description -n bash-completion-%{name} -l pl.UTF-8
246 Pakiet ten dostarcza bashowe uzupełnianie nazw dla GRUB-a.
249 Summary: PC BIOS platform support for GRUB
250 Summary(pl.UTF-8): Obsługa platformy PC BIOS dla GRUB-a
252 Provides: %{name}-platform = %{version}-%{release}
254 %description platform-pc
255 PC BIOS platform support for GRUB.
257 %description platform-pc -l pl.UTF-8
258 Obsługa platformy PC BIOS dla GRUB-a.
260 %package platform-efi
261 Summary: (U)EFI platform support for GRUB
262 Summary(pl.UTF-8): Obsługa platformy (U)EFI dla GRUB-a
265 Provides: %{name}-platform = %{version}-%{release}
267 %description platform-efi
268 (U)EFI platform support for GRUB.
270 %description platform-efi -l pl.UTF-8
271 Obsługa platformy (U)EFI dla GRUB-a.
274 Summary: GRUB font files converter
275 Summary(pl.UTF-8): Konwerter plików fontów GRUB-a
279 Converts common font file formats into PF2.
281 %description mkfont -l pl.UTF-8
282 Program do konwersji popularnych formatów plików fontów do PF2.
284 %package theme-starfield
285 Summary: starfield theme for GRUB
286 Summary(pl.UTF-8): Motyw starfield dla GRUB-a
289 %description theme-starfield
290 starfield theme for GRUB.
292 %description theme-starfield -l pl.UTF-8
293 Motyw starfield dla GRUB-a.
296 %setup -q -n grub-%{version}~%{beta} -a5
315 # we don't have C.utf-8 and need an UTF-8 locale for build
316 sed -i -e 's/LC_ALL=C.UTF-8/LC_ALL=en_US.utf-8/g' po/Makefile* po/Rules*
319 # if gold is used then grub doesn't even boot
320 # https://savannah.gnu.org/bugs/?34539
321 # http://sourceware.org/bugzilla/show_bug.cgi?id=14196
323 ln -f -s /usr/bin/ld.bfd our-ld/ld
324 export PATH=$(pwd)/our-ld:$PATH
326 ## not only the typicall autotools stuff
335 for platform in %{platforms} ; do
336 install -d build-${platform}
339 if [ "$platform" != "efi" ] ; then
340 platform_opts="--enable-efiemu%{!?with_efiemu:=no}"
345 ln -f -s ../configure .
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
359 %{__make} -j1 -C po update-gmo
365 rm -rf $RPM_BUILD_ROOT
367 for platform in %{platforms} ; do
370 pkgdatadir=%{_libexecdir} \
371 pkglibdir=%{_libexecdir} \
372 DESTDIR=$RPM_BUILD_ROOT
377 %{__rm} -r $RPM_BUILD_ROOT%{_localedir}/de@hebrew
378 %{__rm} -r $RPM_BUILD_ROOT%{_localedir}/en@{arabic,cyrillic,greek,hebrew,piglatin}
382 # this must be after 'make install'
383 install -d $RPM_BUILD_ROOT%{_libexecdir}/locale
385 install -d $RPM_BUILD_ROOT%{_grubdir}
386 cp -p docs/grub.cfg $RPM_BUILD_ROOT%{_grubdir}
389 cp -p %{SOURCE4} $RPM_BUILD_ROOT%{_grubdir}/custom.cfg
390 %{__rm} $RPM_BUILD_ROOT/lib/grub.d/40_custom
392 install -p %{SOURCE1} $RPM_BUILD_ROOT%{_sbindir}/update-grub
393 cp -p %{SOURCE2} $RPM_BUILD_ROOT%{_mandir}/man8/update-grub.8
395 install -d $RPM_BUILD_ROOT/etc/sysconfig
396 cp -p %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/grub
398 # rm -f, because it sometimes exists, sometimes not, depending which texlive you have installed
399 rm -f $RPM_BUILD_ROOT%{_infodir}/dir
401 # platform specific, unnecessarily always installed
402 %ifnarch %{ix86} %{x8664} x32
403 %{__rm} $RPM_BUILD_ROOT{%{_sbindir}/grub-bios-setup,%{_mandir}/man8/grub-bios-setup.8}
406 %{__rm} $RPM_BUILD_ROOT{%{_sbindir}/grub-sparc64-setup,%{_mandir}/man8/grub-sparc64-setup.8}
409 # core.img - bootable image generated by grub-mkimage(1) via grub-install(1)
410 touch $RPM_BUILD_ROOT%{_grubdir}/core.img
411 touch $RPM_BUILD_ROOT%{_grubdir}/device.map
413 # needs to be exactly 1KiB
414 # but we're ghosting it. so whom are we kidding here? :P (maybe %config it in future?)
415 dd bs=1024 if=/dev/zero count=1 of=$RPM_BUILD_ROOT%{_grubdir}/grubenv
418 rm -rf $RPM_BUILD_ROOT
420 %post -p %{_sbindir}/postshell
421 -/usr/sbin/fix-info-dir -c %{_infodir}
423 %postun -p %{_sbindir}/postshell
424 -/usr/sbin/fix-info-dir -c %{_infodir}
426 %triggerpostun -- %{name} < 2.00-2
427 # Note this trigger on version upgrade needed only for upgrade from
428 # old grub2 packages which contained modules in /boot/grub
429 # or were built with optimizations enabled
430 # don't do anything on --downgrade
431 if [ $1 -le 1 ]; then
434 echo "Grub was upgraded, trying to setup it to boot sector"
435 /sbin/grub-install '(hd0)' || :
437 %triggerpostun -- %{name} < 1.99-7.3
438 # migrate /etc/grub.d/custom.cfg.rpmsave -> /boot/grub/custom.cfg
439 if [ -f %{_sysconfdir}/grub.d/custom.cfg.rpmsave ]; then
440 cp -f %{_grubdir}/custom.cfg{,.rpmnew}
441 mv -f %{_sysconfdir}/grub.d/custom.cfg.rpmsave %{_grubdir}/custom.cfg
445 %defattr(644,root,root,755)
446 %doc AUTHORS ChangeLog NEWS README THANKS TODO
447 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/grub
448 %attr(755,root,root) %{_sbindir}/grub-editenv
449 %attr(755,root,root) %{_sbindir}/grub-fstest
450 %attr(755,root,root) %{_sbindir}/grub-file
451 %attr(755,root,root) %{_sbindir}/grub-glue-efi
452 %attr(755,root,root) %{_sbindir}/grub-kbdcomp
453 %attr(755,root,root) %{_sbindir}/grub-install
454 %attr(755,root,root) %{_sbindir}/grub-macbless
455 %attr(755,root,root) %{_sbindir}/grub-menulst2cfg
456 %attr(755,root,root) %{_sbindir}/grub-mkconfig
457 %attr(755,root,root) %{_sbindir}/grub-mklayout
458 %attr(755,root,root) %{_sbindir}/grub-mknetdir
459 %attr(755,root,root) %{_sbindir}/grub-mkpasswd-pbkdf2
460 %attr(755,root,root) %{_sbindir}/grub-mkrelpath
461 %attr(755,root,root) %{_sbindir}/grub-mkrescue
462 %attr(755,root,root) %{_sbindir}/grub-mkstandalone
463 %attr(755,root,root) %{_sbindir}/grub-mount
464 %attr(755,root,root) %{_sbindir}/grub-ofpathname
465 %attr(755,root,root) %{_sbindir}/grub-reboot
466 %attr(755,root,root) %{_sbindir}/grub-render-label
467 %attr(755,root,root) %{_sbindir}/grub-script-check
468 %attr(755,root,root) %{_sbindir}/grub-set-default
469 %attr(755,root,root) %{_sbindir}/grub-syslinux2cfg
470 %attr(755,root,root) %{_sbindir}/update-grub
471 %ifarch %{ix86} %{x8664} x32
472 %attr(755,root,root) %{_sbindir}/grub-bios-setup
473 %{_mandir}/man8/grub-bios-setup.8*
475 %ifarch %{ix86} %{x8664} x32
476 %attr(755,root,root) %{_sbindir}/grub-mkimage
477 %{_mandir}/man1/grub-mkimage.1*
479 %attr(755,root,root) %{_sbindir}/grub-probe
480 %{_mandir}/man8/grub-probe.8*
483 %attr(755,root,root) %{_sbindir}/grub-sparc64-setup
484 %{_mandir}/man8/grub-sparc64-setup.8*
486 %{_mandir}/man1/grub-editenv.1*
487 %{_mandir}/man1/grub-file.1*
488 %{_mandir}/man1/grub-fstest.1*
489 %{_mandir}/man1/grub-glue-efi.1*
490 %{_mandir}/man1/grub-kbdcomp.1*
491 %{_mandir}/man1/grub-macbless.1*
492 %{_mandir}/man1/grub-menulst2cfg.1*
493 %{_mandir}/man1/grub-mklayout.1*
494 %{_mandir}/man1/grub-mknetdir.1*
495 %{_mandir}/man1/grub-mkpasswd-pbkdf2.1*
496 %{_mandir}/man1/grub-mkrelpath.1*
497 %{_mandir}/man1/grub-mkrescue.1*
498 %{_mandir}/man1/grub-mkstandalone.1*
499 %{_mandir}/man1/grub-mount.1*
500 %{_mandir}/man1/grub-render-label.1*
501 %{_mandir}/man1/grub-script-check.1*
502 %{_mandir}/man1/grub-syslinux2cfg.1*
503 %{_mandir}/man8/grub-install.8*
504 %{_mandir}/man8/grub-mkconfig.8*
505 %{_mandir}/man8/grub-ofpathname.8*
506 %{_mandir}/man8/grub-reboot.8*
507 %{_mandir}/man8/grub-set-default.8*
508 %{_mandir}/man8/update-grub.8*
510 %attr(755,root,root) %{_sbindir}/grub-emu
511 %{_mandir}/man8/grub-emu.8*
513 %{_libexecdir}/grub-mkconfig_lib
517 # XXX: check this locale dir location and if it is neccesaary to exist on /boot
519 %dir %{_libexecdir}/locale
520 %config(noreplace) %verify(not md5 mtime size) %{_grubdir}/grub.cfg
521 %config(noreplace) %verify(not md5 mtime size) %{_grubdir}/custom.cfg
523 # generated by grub at runtime
524 %ghost %{_grubdir}/device.map
525 %ghost %{_grubdir}/core.img
526 %ghost %{_grubdir}/grubenv
529 %doc /lib/grub.d/README
530 %attr(755,root,root) /lib/grub.d/00_header
531 %attr(755,root,root) /lib/grub.d/10_linux
532 %attr(755,root,root) /lib/grub.d/20_linux_xen
533 %attr(755,root,root) /lib/grub.d/30_os-prober
534 %attr(755,root,root) /lib/grub.d/41_custom
536 # these are now installed only on matching hosts
537 #%attr(755,root,root) /lib/grub.d/10_hurd
538 #%attr(755,root,root) /lib/grub.d/10_illumos
539 #%attr(755,root,root) /lib/grub.d/10_kfreebsd
540 #%attr(755,root,root) /lib/grub.d/10_netbsd
541 #%attr(755,root,root) /lib/grub.d/10_xnu
543 %ifarch %{ix86} %{x8664} x32
544 %attr(755,root,root) %{_sbindir}/grub-probe
545 %{_mandir}/man8/grub-probe.8*
548 %{_infodir}/grub*.info*
550 %dir %{_datadir}/grub/themes
554 %defattr(644,root,root,755)
555 %dir %{_libexecdir}/*-pc
556 %{_libexecdir}/*-pc/modinfo.sh
557 %{_libexecdir}/*-pc/*.exec
558 %{_libexecdir}/*-pc/*.image
559 %{_libexecdir}/*-pc/*.lst
560 %{_libexecdir}/*-pc/*.mod
561 %{_libexecdir}/*-pc/*.module
562 %{_libexecdir}/*-pc/lzma_decompress.img
563 %{_libexecdir}/*-pc/config.h
564 %{_libexecdir}/*-pc/gdb_grub
565 %{_libexecdir}/*-pc/gmodule.pl
567 %{_libexecdir}/*-pc/efiemu*.o
569 %{_libexecdir}/*-pc/kernel.img
570 %ifarch %{ix86} %{x8664} x32 sparc sparc64
571 %{_libexecdir}/*-pc/boot.img
572 %{_libexecdir}/*-pc/boot_hybrid.img
573 %{_libexecdir}/*-pc/cdboot.img
574 %{_libexecdir}/*-pc/diskboot.img
575 %{_libexecdir}/*-pc/lnxboot.img
576 %{_libexecdir}/*-pc/pxeboot.img
582 %defattr(644,root,root,755)
583 %dir %{_libexecdir}/*-efi
584 %{_libexecdir}/*-efi/modinfo.sh
585 %{_libexecdir}/*-efi/*.exec
586 %{_libexecdir}/*-efi/*.lst
587 %{_libexecdir}/*-efi/*.mod
588 %{_libexecdir}/*-efi/*.module
589 %{_libexecdir}/*-efi/config.h
590 %{_libexecdir}/*-efi/gdb_grub
591 %{_libexecdir}/*-efi/gmodule.pl
592 %{_libexecdir}/*-efi/kernel.img
596 %defattr(644,root,root,755)
597 %attr(755,root,root) %{_sbindir}/grub-mkfont
598 %{_mandir}/man1/grub-mkfont.1*
600 %files theme-starfield
601 %defattr(644,root,root,755)
602 %{_datadir}/grub/themes/starfield
604 %files -n bash-completion-%{name}
605 %defattr(644,root,root,755)
606 /etc/bash_completion.d/grub