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
84 URL: http://www.gnu.org/software/grub/
85 BuildRequires: autoconf >= 2.53
86 BuildRequires: automake >= 1:1.11.1-1
88 BuildRequires: device-mapper-devel
89 BuildRequires: flex >= 2.5.35
90 BuildRequires: fonts-TTF-DejaVu
91 BuildRequires: freetype-devel >= 2
93 BuildRequires: gcc >= 5:3.4
94 BuildRequires: gettext-tools
95 BuildRequires: glibc-localedb-all
96 BuildRequires: glibc-static
97 BuildRequires: help2man
98 BuildRequires: libfuse-devel
99 BuildRequires: libtool
100 BuildRequires: ncurses-devel
101 BuildRequires: python
102 BuildRequires: python-modules
103 BuildRequires: rpm >= 4.4.9-56
104 BuildRequires: rpmbuild(macros) >= 1.213
105 BuildRequires: sed >= 4.0
106 BuildRequires: tar >= 1:1.22
107 BuildRequires: texinfo
109 BuildRequires: xz-devel
111 BuildRequires: /usr/lib/libc.so
112 %if "%{pld_release}" == "ac"
113 BuildRequires: libgcc32
115 BuildRequires: gcc-multilib-32
118 Requires: %{name}-platform = %{version}-%{release}
119 Requires: pld-release
121 %ifarch %{ix86} %{x8664}
122 Suggests: %{name}-platform-pc
124 Suggests: cdrkit-mkisofs
128 ExclusiveArch: %{ix86} %{x8664} x32 ia64 mips mipsel ppc ppc64 sparc64
129 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
131 %define _sbindir /sbin
132 %define _bindir %{_sbindir}
134 %define _datadir %{_libdir}
135 %define _libexecdir %{_libdir}/grub
136 %define _grubdir /boot/grub
137 %define _localedir /usr/share/locale
139 # part of grub code is not relocable (these are not Linux libs)
140 # stack protector also breaks non-Linux binaries
141 # any kind of forced optimizations makes grub2 unreliable (random
142 # reboots and hangs on boot menu screen)
143 %define filterout_c -fPIC -O.
144 %undefine _ssp_cflags
145 %undefine _fortify_cflags
148 GRUB is a GPLed bootloader intended to unify bootloading across x86
149 operating systems. In addition to loading the Linux and *BSD kernels,
150 it implements the Multiboot standard, which allows for flexible
151 loading of multiple boot images (needed for modular kernels such as
154 GRUB 2 is derived from PUPA which was a research project to
155 investigate the next generation of GRUB. GRUB 2 has been rewritten
156 from scratch to clean up everything for modularity and portability.
158 GRUB 2 targets at the following goals:
159 - Scripting support, such as conditionals, loops, variables and
161 - Graphical interface.
162 - Dynamic loading of modules in order to extend itself at the run time
163 rather than at the build time.
164 - Portability for various architectures.
165 - Internationalization. This includes support for non-ASCII character
166 code, message catalogs like gettext, fonts, graphics console, and so
168 - Real memory management, to make GNU GRUB more extensible.
169 - Modular, hierarchical, object-oriented framework for file systems,
170 files, devices, drives, terminals, commands, partition tables and OS
172 - Cross-platform installation which allows for installing GRUB from a
173 different architecture.
174 - Rescue mode saves unbootable cases. Stage 1.5 was eliminated.
175 - Fix design mistakes in GRUB Legacy, which could not be solved for
176 backward-compatibility, such as the way of numbering partitions.
178 %description -l de.UTF-8
179 GRUB (GRand Unified Boot-loader) ist ein Bootloader, der oft auf
180 Rechnern eingesetzt wird, auf denen das freie Betriebssystem Linux
181 läuft. GRUB löst den betagten LILO (Linux-Loader) ab.
183 GRUB wurde innerhalb des GNU Hurd-Projektes als Boot-Loader entwickelt
184 und wird unter der GPL vertrieben. Aufgrund seiner höheren
185 Flexibilität verdrängt GRUB in vielen Linux-Distributionen den
186 traditionellen Boot-Loader LILO.
188 %description -l hu.UTF-8
189 GRUB egy GPL liszenszű rendszerbetöltő. Linux és *BSD kernelek
190 betöltése mellett támogatja a Multiboot standard-ot, amely lehetővé
191 teszi boot képek betöltését (moduláris kerneleknek kell, mint pl. a
194 GRUB2 céljai a következők:
195 - szkriptelés támogatása, úgymint feltételek, ciklusok, változók,
198 - modulok dinamikus betöltése futási időben
199 - hordozhatóság több architektúrára
200 - többnyelvűség: nem-ASCII karakterek támogatása, üzenetkatalógusok,
201 mint gettext, betűtípusok, grafikus konzolon, és így tovább
202 - valós memória kezelés, amellyel még bővíthetőbbé tehetjük
203 - moduláris, hierarchikus, objektum-orientált keretrendszer
204 fájlrendszerekhez, fájlokhoz, eszközökhöz, meghajtókhoz,
205 terminálokhoz, parancsokhoz, partíciós táblákhoz és OS betöltőkhöz
207 %description -l es.UTF-8
208 Éste es GRUB - Grand Unified Boot Loader - un administrador de
209 inicialización capaz de entrar en la mayoría de los sistemas
210 operacionales libres - Linux, FreeBSD, NetBSD, GNU Mach, etc. como
211 también en la mayoría de los sistemas operacionales comerciales para
214 El administrador GRUB puede ser una buena alternativa a LILO, para
215 usuarios conmás experiencia y que deseen obtener más recursos de su
216 cargador de inicialización (boot loader).
218 %description -l pl.UTF-8
219 GRUB jest bootloaderem na licencji GNU GPL, mającym na celu unifikację
220 procesu bootowania na systemach x86. Potrafi nie tylko ładować jądra
221 Linuksa i *BSD: posiada również implementację standardu Multiboot,
222 który pozwala na elastyczne ładowanie wielu obrazów bootowalnych
223 (czego wymagają modułowe jądra, takie jak GNU Hurd).
225 %description -l pt_BR.UTF-8
226 Esse é o GRUB - Grand Unified Boot Loader - um gerenciador de boot
227 capaz de entrar na maioria dos sistemas operacionais livres - Linux,
228 FreeBSD, NetBSD, GNU Mach, etc. assim como na maioria dos sistemas
229 operacionais comerciais para PC.
231 O GRUB pode ser uma boa alternativa ao LILO, para usuários mais
232 avançados e que querem mais recursos de seu boot loader.
234 %package -n bash-completion-%{name}
235 Summary: bash-completion for GRUB
236 Summary(pl.UTF-8): Bashowe uzupełnianie nazw dla GRUB-a
237 Group: Applications/Shells
238 Requires: bash-completion
239 %if "%{_rpmversion}" >= "5"
243 %description -n bash-completion-%{name}
244 This package provides bash-completion for GRUB.
246 %description -n bash-completion-%{name} -l pl.UTF-8
247 Pakiet ten dostarcza bashowe uzupełnianie nazw dla GRUB-a.
250 Summary: PC BIOS platform support for GRUB
251 Summary(pl.UTF-8): Obsługa platformy PC BIOS dla GRUB-a
253 Provides: %{name}-platform = %{version}-%{release}
255 %description platform-pc
256 PC BIOS platform support for GRUB.
258 %description platform-pc -l pl.UTF-8
259 Obsługa platformy PC BIOS dla GRUB-a.
261 %package platform-efi
262 Summary: (U)EFI platform support for GRUB
263 Summary(pl.UTF-8): Obsługa platformy (U)EFI dla GRUB-a
266 Provides: %{name}-platform = %{version}-%{release}
268 %description platform-efi
269 (U)EFI platform support for GRUB.
271 %description platform-efi -l pl.UTF-8
272 Obsługa platformy (U)EFI dla GRUB-a.
275 Summary: GRUB font files converter
276 Summary(pl.UTF-8): Konwerter plików fontów GRUB-a
280 Converts common font file formats into PF2.
282 %description mkfont -l pl.UTF-8
283 Program do konwersji popularnych formatów plików fontów do PF2.
285 %package theme-starfield
286 Summary: starfield theme for GRUB
287 Summary(pl.UTF-8): Motyw starfield dla GRUB-a
290 %description theme-starfield
291 starfield theme for GRUB.
293 %description theme-starfield -l pl.UTF-8
294 Motyw starfield dla GRUB-a.
297 %setup -q -n grub-%{version}~%{beta} -a5
317 # we don't have C.utf-8 and need an UTF-8 locale for build
318 sed -i -e 's/LC_ALL=C.UTF-8/LC_ALL=en_US.utf-8/g' po/Makefile* po/Rules*
321 # if gold is used then grub doesn't even boot
322 # https://savannah.gnu.org/bugs/?34539
323 # http://sourceware.org/bugzilla/show_bug.cgi?id=14196
325 ln -f -s /usr/bin/ld.bfd our-ld/ld
326 export PATH=$(pwd)/our-ld:$PATH
328 ## not only the typicall autotools stuff
337 for platform in %{platforms} ; do
338 install -d build-${platform}
341 if [ "$platform" != "efi" ] ; then
342 platform_opts="--enable-efiemu%{!?with_efiemu:=no}"
347 ln -f -s ../configure .
348 # mawk stalls at ./genmoddep.awk, so force gawk
351 --with-platform=${platform} \
354 --enable-grub-emu-usb \
355 --enable-grub-emu-sdl \
356 --enable-grub-emu-pci \
359 TARGET_LDFLAGS=-static
361 %{__make} -j1 -C po update-gmo
367 rm -rf $RPM_BUILD_ROOT
369 for platform in %{platforms} ; do
372 pkgdatadir=%{_libexecdir} \
373 pkglibdir=%{_libexecdir} \
374 DESTDIR=$RPM_BUILD_ROOT
379 %{__rm} -r $RPM_BUILD_ROOT%{_localedir}/de@hebrew
380 %{__rm} -r $RPM_BUILD_ROOT%{_localedir}/en@{arabic,cyrillic,greek,hebrew,piglatin}
384 # this must be after 'make install'
385 install -d $RPM_BUILD_ROOT%{_libexecdir}/locale
387 install -d $RPM_BUILD_ROOT%{_grubdir}
388 cp -p docs/grub.cfg $RPM_BUILD_ROOT%{_grubdir}
391 cp -p %{SOURCE4} $RPM_BUILD_ROOT%{_grubdir}/custom.cfg
392 %{__rm} $RPM_BUILD_ROOT/lib/grub.d/40_custom
394 install -p %{SOURCE1} $RPM_BUILD_ROOT%{_sbindir}/update-grub
395 cp -p %{SOURCE2} $RPM_BUILD_ROOT%{_mandir}/man8/update-grub.8
397 install -d $RPM_BUILD_ROOT/etc/sysconfig
398 cp -p %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/grub
400 # rm -f, because it sometimes exists, sometimes not, depending which texlive you have installed
401 rm -f $RPM_BUILD_ROOT%{_infodir}/dir
403 # platform specific, unnecessarily always installed
404 %ifnarch %{ix86} %{x8664} x32
405 %{__rm} $RPM_BUILD_ROOT{%{_sbindir}/grub-bios-setup,%{_mandir}/man8/grub-bios-setup.8}
408 %{__rm} $RPM_BUILD_ROOT{%{_sbindir}/grub-sparc64-setup,%{_mandir}/man8/grub-sparc64-setup.8}
411 # core.img - bootable image generated by grub-mkimage(1) via grub-install(1)
412 touch $RPM_BUILD_ROOT%{_grubdir}/core.img
413 touch $RPM_BUILD_ROOT%{_grubdir}/device.map
415 # needs to be exactly 1KiB
416 # but we're ghosting it. so whom are we kidding here? :P (maybe %config it in future?)
417 dd bs=1024 if=/dev/zero count=1 of=$RPM_BUILD_ROOT%{_grubdir}/grubenv
420 rm -rf $RPM_BUILD_ROOT
422 %post -p %{_sbindir}/postshell
423 -/usr/sbin/fix-info-dir -c %{_infodir}
425 %postun -p %{_sbindir}/postshell
426 -/usr/sbin/fix-info-dir -c %{_infodir}
428 %triggerpostun -- %{name} < 2.00-2
429 # Note this trigger on version upgrade needed only for upgrade from
430 # old grub2 packages which contained modules in /boot/grub
431 # or were built with optimizations enabled
432 # don't do anything on --downgrade
433 if [ $1 -le 1 ]; then
436 echo "Grub was upgraded, trying to setup it to boot sector"
437 /sbin/grub-install '(hd0)' || :
439 %triggerpostun -- %{name} < 1.99-7.3
440 # migrate /etc/grub.d/custom.cfg.rpmsave -> /boot/grub/custom.cfg
441 if [ -f %{_sysconfdir}/grub.d/custom.cfg.rpmsave ]; then
442 cp -f %{_grubdir}/custom.cfg{,.rpmnew}
443 mv -f %{_sysconfdir}/grub.d/custom.cfg.rpmsave %{_grubdir}/custom.cfg
447 %defattr(644,root,root,755)
448 %doc AUTHORS ChangeLog NEWS README THANKS TODO
449 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/grub
450 %attr(755,root,root) %{_sbindir}/grub-editenv
451 %attr(755,root,root) %{_sbindir}/grub-fstest
452 %attr(755,root,root) %{_sbindir}/grub-file
453 %attr(755,root,root) %{_sbindir}/grub-glue-efi
454 %attr(755,root,root) %{_sbindir}/grub-kbdcomp
455 %attr(755,root,root) %{_sbindir}/grub-install
456 %attr(755,root,root) %{_sbindir}/grub-macbless
457 %attr(755,root,root) %{_sbindir}/grub-menulst2cfg
458 %attr(755,root,root) %{_sbindir}/grub-mkconfig
459 %attr(755,root,root) %{_sbindir}/grub-mklayout
460 %attr(755,root,root) %{_sbindir}/grub-mknetdir
461 %attr(755,root,root) %{_sbindir}/grub-mkpasswd-pbkdf2
462 %attr(755,root,root) %{_sbindir}/grub-mkrelpath
463 %attr(755,root,root) %{_sbindir}/grub-mkrescue
464 %attr(755,root,root) %{_sbindir}/grub-mkstandalone
465 %attr(755,root,root) %{_sbindir}/grub-mount
466 %attr(755,root,root) %{_sbindir}/grub-ofpathname
467 %attr(755,root,root) %{_sbindir}/grub-reboot
468 %attr(755,root,root) %{_sbindir}/grub-render-label
469 %attr(755,root,root) %{_sbindir}/grub-script-check
470 %attr(755,root,root) %{_sbindir}/grub-set-default
471 %attr(755,root,root) %{_sbindir}/grub-syslinux2cfg
472 %attr(755,root,root) %{_sbindir}/update-grub
473 %ifarch %{ix86} %{x8664} x32
474 %attr(755,root,root) %{_sbindir}/grub-bios-setup
475 %{_mandir}/man8/grub-bios-setup.8*
477 %ifarch %{ix86} %{x8664} x32
478 %attr(755,root,root) %{_sbindir}/grub-mkimage
479 %{_mandir}/man1/grub-mkimage.1*
481 %attr(755,root,root) %{_sbindir}/grub-probe
482 %{_mandir}/man8/grub-probe.8*
485 %attr(755,root,root) %{_sbindir}/grub-sparc64-setup
486 %{_mandir}/man8/grub-sparc64-setup.8*
488 %{_mandir}/man1/grub-editenv.1*
489 %{_mandir}/man1/grub-file.1*
490 %{_mandir}/man1/grub-fstest.1*
491 %{_mandir}/man1/grub-glue-efi.1*
492 %{_mandir}/man1/grub-kbdcomp.1*
493 %{_mandir}/man1/grub-macbless.1*
494 %{_mandir}/man1/grub-menulst2cfg.1*
495 %{_mandir}/man1/grub-mklayout.1*
496 %{_mandir}/man1/grub-mknetdir.1*
497 %{_mandir}/man1/grub-mkpasswd-pbkdf2.1*
498 %{_mandir}/man1/grub-mkrelpath.1*
499 %{_mandir}/man1/grub-mkrescue.1*
500 %{_mandir}/man1/grub-mkstandalone.1*
501 %{_mandir}/man1/grub-mount.1*
502 %{_mandir}/man1/grub-render-label.1*
503 %{_mandir}/man1/grub-script-check.1*
504 %{_mandir}/man1/grub-syslinux2cfg.1*
505 %{_mandir}/man8/grub-install.8*
506 %{_mandir}/man8/grub-mkconfig.8*
507 %{_mandir}/man8/grub-ofpathname.8*
508 %{_mandir}/man8/grub-reboot.8*
509 %{_mandir}/man8/grub-set-default.8*
510 %{_mandir}/man8/update-grub.8*
512 %attr(755,root,root) %{_sbindir}/grub-emu
513 %{_mandir}/man8/grub-emu.8*
515 %{_libexecdir}/grub-mkconfig_lib
519 # XXX: check this locale dir location and if it is neccesaary to exist on /boot
521 %dir %{_libexecdir}/locale
522 %config(noreplace) %verify(not md5 mtime size) %{_grubdir}/grub.cfg
523 %config(noreplace) %verify(not md5 mtime size) %{_grubdir}/custom.cfg
525 # generated by grub at runtime
526 %ghost %{_grubdir}/device.map
527 %ghost %{_grubdir}/core.img
528 %ghost %{_grubdir}/grubenv
531 %doc /lib/grub.d/README
532 %attr(755,root,root) /lib/grub.d/00_header
533 %attr(755,root,root) /lib/grub.d/10_linux
534 %attr(755,root,root) /lib/grub.d/20_linux_xen
535 %attr(755,root,root) /lib/grub.d/30_os-prober
536 %attr(755,root,root) /lib/grub.d/41_custom
538 # these are now installed only on matching hosts
539 #%attr(755,root,root) /lib/grub.d/10_hurd
540 #%attr(755,root,root) /lib/grub.d/10_illumos
541 #%attr(755,root,root) /lib/grub.d/10_kfreebsd
542 #%attr(755,root,root) /lib/grub.d/10_netbsd
543 #%attr(755,root,root) /lib/grub.d/10_xnu
545 %ifarch %{ix86} %{x8664} x32
546 %attr(755,root,root) %{_sbindir}/grub-probe
547 %{_mandir}/man8/grub-probe.8*
550 %{_infodir}/grub*.info*
552 %dir %{_datadir}/grub/themes
556 %defattr(644,root,root,755)
557 %dir %{_libexecdir}/*-pc
558 %{_libexecdir}/*-pc/modinfo.sh
559 %{_libexecdir}/*-pc/*.exec
560 %{_libexecdir}/*-pc/*.image
561 %{_libexecdir}/*-pc/*.lst
562 %{_libexecdir}/*-pc/*.mod
563 %{_libexecdir}/*-pc/*.module
564 %{_libexecdir}/*-pc/lzma_decompress.img
565 %{_libexecdir}/*-pc/config.h
566 %{_libexecdir}/*-pc/gdb_grub
567 %{_libexecdir}/*-pc/gmodule.pl
569 %{_libexecdir}/*-pc/efiemu*.o
571 %{_libexecdir}/*-pc/kernel.img
572 %ifarch %{ix86} %{x8664} x32 sparc sparc64
573 %{_libexecdir}/*-pc/boot.img
574 %{_libexecdir}/*-pc/boot_hybrid.img
575 %{_libexecdir}/*-pc/cdboot.img
576 %{_libexecdir}/*-pc/diskboot.img
577 %{_libexecdir}/*-pc/lnxboot.img
578 %{_libexecdir}/*-pc/pxeboot.img
584 %defattr(644,root,root,755)
585 %dir %{_libexecdir}/*-efi
586 %{_libexecdir}/*-efi/modinfo.sh
587 %{_libexecdir}/*-efi/*.exec
588 %{_libexecdir}/*-efi/*.lst
589 %{_libexecdir}/*-efi/*.mod
590 %{_libexecdir}/*-efi/*.module
591 %{_libexecdir}/*-efi/config.h
592 %{_libexecdir}/*-efi/gdb_grub
593 %{_libexecdir}/*-efi/gmodule.pl
594 %{_libexecdir}/*-efi/kernel.img
598 %defattr(644,root,root,755)
599 %attr(755,root,root) %{_sbindir}/grub-mkfont
600 %{_mandir}/man1/grub-mkfont.1*
602 %files theme-starfield
603 %defattr(644,root,root,755)
604 %{_datadir}/grub/themes/starfield
606 %files -n bash-completion-%{name}
607 %defattr(644,root,root,755)
608 /etc/bash_completion.d/grub