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
9 # - warning: Installed (but unpackaged) file(s) found:
10 # /sbin/grub-sparc64-setup
11 # /usr/share/man/man8/grub-sparc64-setup.8.gz
14 # /etc/bash_completion.d/grub
15 # /sbin/grub-sparc64-setup
17 # /boot/grub/gmodule.pl
18 # /sbin/grub-sparc64-setup
21 %bcond_with grubemu # build grub-emu debugging utility
22 %bcond_without efiemu # build efiemu runtimes
23 %bcond_without pc # do not build for PC BIOS platform
24 %bcond_without efi # do not build for EFI platform
26 %if "%{cc_version}" < "3.4"
27 # cc does not support:
28 # cc1: sorry, unimplemented: code model `large' not supported yet
33 # non-x86_64 arch doesn't support this
37 # the 'most natural' platform should go last
38 %define platforms %{?with_efi:efi} %{?with_pc:pc}
40 Summary: GRand Unified Bootloader
41 Summary(de.UTF-8): GRUB2 - ein Bootloader für x86 und ppc
42 Summary(hu.UTF-8): GRUB2 - rendszerbetöltő x86 és ppc gépekhez
43 Summary(pl.UTF-8): GRUB2 - bootloader dla x86 i ppc
44 Summary(pt_BR.UTF-8): Gerenciador de inicialização GRUB2
50 Source0: http://ftp.gnu.org/gnu/grub/grub-%{version}.tar.xz
51 # Source0-md5: a1043102fbc7bcedbf53e7ee3d17ab91
53 Source2: update-grub.8
54 Source3: grub.sysconfig
55 Source4: grub-custom.cfg
56 URL: http://www.gnu.org/software/grub/
57 Patch0: pld-initrd.patch
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_fix.patch
69 BuildRequires: autoconf >= 2.53
70 BuildRequires: automake >= 1:1.11.1-1
72 BuildRequires: device-mapper-devel
73 BuildRequires: fonts-TTF-DejaVu
74 BuildRequires: freetype-devel
76 BuildRequires: gettext-devel
77 BuildRequires: help2man
78 BuildRequires: libfuse-devel
79 BuildRequires: libtool
80 BuildRequires: texinfo
82 BuildRequires: /usr/lib/libc.so
83 %if "%{pld_release}" == "ac"
84 BuildRequires: libgcc32
86 BuildRequires: gcc-multilib
89 BuildRequires: glibc-static
90 BuildRequires: ncurses-devel
91 BuildRequires: rpm >= 4.4.9-56
92 BuildRequires: rpmbuild(macros) >= 1.213
93 BuildRequires: sed >= 4.0
95 Suggests: cdrkit-mkisofs
99 Requires: %{name}-platform = %{version}-%{release}
100 Suggests: %{name}-platform-pc
101 ExclusiveArch: %{ix86} %{x8664} ppc sparc64
102 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
104 %define _sbindir /sbin
105 %define _bindir %{_sbindir}
107 %define _datadir %{_libdir}
108 %define _libexecdir %{_libdir}/grub
109 %define _grubdir /boot/grub
110 %define _localedir /usr/share/locale
112 # part of grub code is not relocable (these are not Linux libs)
113 # stack protector also breaks non-Linux binaries
114 %define filterout_c -fPIC
115 %undefine _ssp_cflags
118 GRUB is a GPLed bootloader intended to unify bootloading across x86
119 operating systems. In addition to loading the Linux and *BSD kernels,
120 it implements the Multiboot standard, which allows for flexible
121 loading of multiple boot images (needed for modular kernels such as
124 GRUB 2 is derived from PUPA which was a research project to
125 investigate the next generation of GRUB. GRUB 2 has been rewritten
126 from scratch to clean up everything for modularity and portability.
128 GRUB 2 targets at the following goals:
129 - Scripting support, such as conditionals, loops, variables and
131 - Graphical interface.
132 - Dynamic loading of modules in order to extend itself at the run time
133 rather than at the build time.
134 - Portability for various architectures.
135 - Internationalization. This includes support for non-ASCII character
136 code, message catalogs like gettext, fonts, graphics console, and so
138 - Real memory management, to make GNU GRUB more extensible.
139 - Modular, hierarchical, object-oriented framework for file systems,
140 files, devices, drives, terminals, commands, partition tables and OS
142 - Cross-platform installation which allows for installing GRUB from a
143 different architecture.
144 - Rescue mode saves unbootable cases. Stage 1.5 was eliminated.
145 - Fix design mistakes in GRUB Legacy, which could not be solved for
146 backward-compatibility, such as the way of numbering partitions.
148 %description -l de.UTF-8
149 GRUB (GRand Unified Boot-loader) ist ein Bootloader, der oft auf
150 Rechnern eingesetzt wird, auf denen das freie Betriebssystem Linux
151 läuft. GRUB löst den betagten LILO (Linux-Loader) ab.
153 GRUB wurde innerhalb des GNU Hurd-Projektes als Boot-Loader entwickelt
154 und wird unter der GPL vertrieben. Aufgrund seiner höheren
155 Flexibilität verdrängt GRUB in vielen Linux-Distributionen den
156 traditionellen Boot-Loader LILO.
158 %description -l hu.UTF-8
159 GRUB egy GPL liszenszű rendszerbetöltő. Linux és *BSD kernelek
160 betöltése mellett támogatja a Multiboot standard-ot, amely lehetővé
161 teszi boot képek betöltését (moduláris kerneleknek kell, mint pl. a
164 GRUB2 céljai a következők:
165 - szkriptelés támogatása, úgymint feltételek, ciklusok, változók,
168 - modulok dinamikus betöltése futási időben
169 - hordozhatóság több architektúrára
170 - többnyelvűség: nem-ASCII karakterek támogatása, üzenetkatalógusok,
171 mint gettext, betűtípusok, grafikus konzolon, és így tovább
172 - valós memória kezelés, amellyel még bővíthetőbbé tehetjük
173 - moduláris, hierarchikus, objektum-orientált keretrendszer
174 fájlrendszerekhez, fájlokhoz, eszközökhöz, meghajtókhoz,
175 terminálokhoz, parancsokhoz, partíciós táblákhoz és OS betöltőkhöz
177 %description -l es.UTF-8
178 Éste es GRUB - Grand Unified Boot Loader - un administrador de
179 inicialización capaz de entrar en la mayoría de los sistemas
180 operacionales libres - Linux, FreeBSD, NetBSD, GNU Mach, etc. como
181 también en la mayoría de los sistemas operacionales comerciales para
184 El administrador GRUB puede ser una buena alternativa a LILO, para
185 usuarios conmás experiencia y que deseen obtener más recursos de su
186 cargador de inicialización (boot loader).
188 %description -l pl.UTF-8
189 GRUB jest bootloaderem na licencji GNU, mającym na celu unifikację
190 procesu bootowania na systemach x86. Potrafi nie tylko ładować jądra
191 Linuksa i *BSD: posiada również implementacje standardu Multiboot,
192 który pozwala na elastyczne ładowanie wielu obrazów bootowalnych
193 (czego wymagają modułowe jądra, takie jak GNU Hurd).
195 %description -l pt_BR.UTF-8
196 Esse é o GRUB - Grand Unified Boot Loader - um gerenciador de boot
197 capaz de entrar na maioria dos sistemas operacionais livres - Linux,
198 FreeBSD, NetBSD, GNU Mach, etc. assim como na maioria dos sistemas
199 operacionais comerciais para PC.
201 O GRUB pode ser uma boa alternativa ao LILO, para usuários mais
202 avançados e que querem mais recursos de seu boot loader.
204 %package -n bash-completion-%{name}
205 Summary: bash-completion for GRUB
206 Summary(pl.UTF-8): bashowe uzupełnianie nazw dla GRUB
207 Group: Applications/Shells
208 Requires: bash-completion
210 %description -n bash-completion-%{name}
211 This package provides bash-completion for GRUB.
213 %description -n bash-completion-%{name} -l pl.UTF-8
214 Pakiet ten dostarcza bashowe uzupełnianie nazw dla GRUB.
217 Summary: PC BIOS platform support for GRUB
219 Provides: %{name}-platform = %{version}-%{release}
221 %description platform-pc
222 PC BIOS platform support for GRUB.
224 %package platform-efi
225 Summary: (U)EFI platform support for GRUB
228 Provides: %{name}-platform = %{version}-%{release}
230 %description platform-efi
231 (U)EFI platform support for GRUB.
234 Summary: GRUB font files converter
238 Converts common font file formats into PF2.
240 %package theme-starfield
241 Summary: starfield theme for GRUB
244 %description theme-starfield
245 starfield theme for GRUB.
248 %setup -q -n grub-%{version}
262 %if "%{cc_version}" < "3.4"
263 grep -rl -- -Wno-missing-field-initializers . | xargs %{__sed} -i -e 's,-Wno-missing-field-initializers,,'
264 %{__sed} -i -e '/video_mod_CFLAGS/s/$/ -Wno-error/' conf/common.rmk
268 # if gold is used then grub doesn't even boot
270 ln -s /usr/bin/ld.bfd our-ld/ld
271 export PATH=$(pwd)/our-ld:$PATH
273 cp -f /usr/share/automake/config.sub .
277 echo timestamp > stamp-h.in
279 export CFLAGS="%{rpmcflags} -Os %{?debug:-g}"
281 for platform in %{platforms} ; do
282 install -d build-${platform}
285 if [ "$platform" != "efi" ] ; then
286 platform_opts="--%{!?with_efiemu:dis}%{?with_efiemu:en}able-efiemu"
292 # mawk stalls at ./genmoddep.awk, so force gawk
295 --with-platform=${platform} \
298 --enable-grub-emu-usb \
299 --enable-grub-emu-sdl \
300 --enable-grub-emu-pci \
303 TARGET_LDFLAGS=-static
310 rm -rf $RPM_BUILD_ROOT
312 for platform in %{platforms} ; do
315 pkgdatadir=%{_libexecdir} \
316 pkglibdir=%{_libexecdir} \
317 DESTDIR=$RPM_BUILD_ROOT
322 %{__rm} -r $RPM_BUILD_ROOT%{_localedir}/de@hebrew
323 %{__rm} -r $RPM_BUILD_ROOT%{_localedir}/en@{arabic,cyrillic,greek,hebrew,piglatin}
327 # this must be after 'make install'
328 install -d $RPM_BUILD_ROOT%{_libexecdir}/locale
330 install -d $RPM_BUILD_ROOT%{_grubdir}
331 cp -p docs/grub.cfg $RPM_BUILD_ROOT%{_grubdir}
334 cp -p %{SOURCE4} $RPM_BUILD_ROOT%{_grubdir}/custom.cfg
335 %{__rm} $RPM_BUILD_ROOT/lib/grub.d/40_custom
337 install -p %{SOURCE1} $RPM_BUILD_ROOT%{_sbindir}/update-grub
338 cp -p %{SOURCE2} $RPM_BUILD_ROOT%{_mandir}/man8/update-grub.8
340 install -d $RPM_BUILD_ROOT/etc/sysconfig
341 cp -p %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/grub
343 # rm -f, because it sometimes exists, sometimes not, depending which texlive you have installed
344 rm -f $RPM_BUILD_ROOT%{_infodir}/dir
346 # core.img - bootable image generated by grub-mkimage(1) via grub-install(1)
347 touch $RPM_BUILD_ROOT%{_grubdir}/core.img
348 touch $RPM_BUILD_ROOT%{_grubdir}/device.map
350 # needs to be exactly 1KiB
351 # but we're ghosting it. so whom are we kidding here? :P (maybe %config it in future?)
352 dd bs=1024 if=/dev/zero count=1 of=$RPM_BUILD_ROOT%{_grubdir}/grubenv
355 rm -rf $RPM_BUILD_ROOT
357 %post -p %{_sbindir}/postshell
358 -/usr/sbin/fix-info-dir -c %{_infodir}
360 %postun -p %{_sbindir}/postshell
361 -/usr/sbin/fix-info-dir -c %{_infodir}
363 %triggerpostun -- %{name} < 2.00-0.1
364 # Note this trigger on version upgrade
365 # needed only for upgrade from old grub2 packages
366 # which contained modules in /boot/grub
367 # don't do anything on --downgrade
368 if [ $1 -le 1 ]; then
371 echo "Grub was upgraded, trying to setup it to boot sector"
372 /sbin/grub-install '(hd0)' || :
374 %triggerpostun -- %{name} < 1.99-7.3
375 # migrate /etc/grub.d/custom.cfg.rpmsave -> /boot/grub/custom.cfg
376 if [ -f %{_sysconfdir}/grub.d/custom.cfg.rpmsave ]; then
377 cp -f %{_grubdir}/custom.cfg{,.rpmnew}
378 mv -f %{_sysconfdir}/grub.d/custom.cfg.rpmsave %{_grubdir}/custom.cfg
382 %defattr(644,root,root,755)
383 %doc AUTHORS ChangeLog NEWS README THANKS TODO
384 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/grub
385 %attr(755,root,root) %{_sbindir}/grub-bios-setup
386 %attr(755,root,root) %{_sbindir}/grub-editenv
387 %attr(755,root,root) %{_sbindir}/grub-fstest
388 %attr(755,root,root) %{_sbindir}/grub-kbdcomp
389 %attr(755,root,root) %{_sbindir}/grub-install
390 %attr(755,root,root) %{_sbindir}/grub-menulst2cfg
391 %attr(755,root,root) %{_sbindir}/grub-mkconfig
392 %attr(755,root,root) %{_sbindir}/grub-mklayout
393 %attr(755,root,root) %{_sbindir}/grub-mknetdir
394 %attr(755,root,root) %{_sbindir}/grub-mkpasswd-pbkdf2
395 %attr(755,root,root) %{_sbindir}/grub-mkrelpath
396 %attr(755,root,root) %{_sbindir}/grub-mkrescue
397 %attr(755,root,root) %{_sbindir}/grub-mkstandalone
398 %attr(755,root,root) %{_sbindir}/grub-mount
399 %attr(755,root,root) %{_sbindir}/grub-ofpathname
400 %attr(755,root,root) %{_sbindir}/grub-reboot
401 %attr(755,root,root) %{_sbindir}/grub-script-check
402 %attr(755,root,root) %{_sbindir}/grub-set-default
403 %attr(755,root,root) %{_sbindir}/update-grub
404 %ifarch %{ix86} %{x8664}
405 %attr(755,root,root) %{_sbindir}/grub-mkimage
406 %{_mandir}/man1/grub-mkimage.1*
408 %attr(755,root,root) %{_sbindir}/grub-probe
409 %{_mandir}/man8/grub-probe.8*
411 %{_mandir}/man1/grub-editenv.1*
412 %{_mandir}/man1/grub-fstest.1*
413 %{_mandir}/man1/grub-kbdcomp.1*
414 %{_mandir}/man1/grub-menulst2cfg.1*
415 %{_mandir}/man1/grub-mklayout.1*
416 %{_mandir}/man1/grub-mkpasswd-pbkdf2.1*
417 %{_mandir}/man1/grub-mkrelpath.1*
418 %{_mandir}/man1/grub-mkrescue.1*
419 %{_mandir}/man1/grub-mkstandalone.1*
420 %{_mandir}/man1/grub-mount.1*
421 %{_mandir}/man1/grub-script-check.1*
422 %{_mandir}/man8/grub-bios-setup.8*
423 %{_mandir}/man8/grub-install.8*
424 %{_mandir}/man8/grub-mkconfig.8*
425 %{_mandir}/man8/grub-mknetdir.8*
426 %{_mandir}/man8/grub-ofpathname.8*
427 %{_mandir}/man8/grub-reboot.8*
428 %{_mandir}/man8/grub-set-default.8*
429 %{_mandir}/man8/update-grub.8*
431 %attr(755,root,root) %{_sbindir}/grub-emu
432 %{_mandir}/man8/grub-emu.8*
434 %{_libexecdir}/grub-mkconfig_lib
438 # XXX: check this locale dir location and if it is neccesaary to exist on /boot
440 %dir %{_libexecdir}/locale
441 %config(noreplace) %verify(not md5 mtime size) %{_grubdir}/grub.cfg
442 %config(noreplace) %verify(not md5 mtime size) %{_grubdir}/custom.cfg
444 # generated by grub at runtime
445 %ghost %{_grubdir}/device.map
446 %ghost %{_grubdir}/core.img
447 %ghost %{_grubdir}/grubenv
450 %doc /lib/grub.d/README
451 %attr(755,root,root) /lib/grub.d/00_header
452 %attr(755,root,root) /lib/grub.d/10_linux
453 %attr(755,root,root) /lib/grub.d/20_linux_xen
454 %attr(755,root,root) /lib/grub.d/30_os-prober
455 %attr(755,root,root) /lib/grub.d/41_custom
457 %ifarch %{ix86} %{x8664}
458 %attr(755,root,root) %{_sbindir}/grub-probe
459 %{_mandir}/man8/grub-probe.8*
462 %{_infodir}/grub*.info*
464 %dir %{_datadir}/grub/themes
468 %defattr(644,root,root,755)
469 %dir %{_libexecdir}/*-pc
470 %{_libexecdir}/*-pc/modinfo.sh
471 %{_libexecdir}/*-pc/*.exec
472 %{_libexecdir}/*-pc/*.image
473 %{_libexecdir}/*-pc/*.lst
474 %{_libexecdir}/*-pc/*.mod
475 %{_libexecdir}/*-pc/*.module
476 %{_libexecdir}/*-pc/lzma_decompress.img
477 %{_libexecdir}/*-pc/config.h
478 %{_libexecdir}/*-pc/gdb_grub
479 %{_libexecdir}/*-pc/gmodule.pl
482 %{_libexecdir}/*-pc/efiemu*.o
485 %{_libexecdir}/*-pc/kernel.img
486 %ifarch %{ix86} %{x8664} sparc sparc64
487 %{_libexecdir}/*-pc/boot.img
488 %{_libexecdir}/*-pc/cdboot.img
489 %{_libexecdir}/*-pc/diskboot.img
490 %{_libexecdir}/*-pc/lnxboot.img
491 %{_libexecdir}/*-pc/pxeboot.img
497 %defattr(644,root,root,755)
498 %dir %{_libexecdir}/*-efi
499 %{_libexecdir}/*-efi/modinfo.sh
500 %{_libexecdir}/*-efi/*.exec
501 %{_libexecdir}/*-efi/*.lst
502 %{_libexecdir}/*-efi/*.mod
503 %{_libexecdir}/*-efi/*.module
504 %{_libexecdir}/*-efi/config.h
505 %{_libexecdir}/*-efi/gdb_grub
506 %{_libexecdir}/*-efi/gmodule.pl
507 %{_libexecdir}/*-efi/kernel.img
511 %defattr(644,root,root,755)
512 %{_mandir}/man1/grub-mkfont.1*
513 %attr(755,root,root) %{_sbindir}/grub-mkfont
515 %files theme-starfield
516 %defattr(644,root,root,755)
517 %{_datadir}/grub/themes/starfield
519 %files -n bash-completion-%{name}
520 %defattr(644,root,root,755)
521 /etc/bash_completion.d/grub