Advertisement
barjac

grub2.spec

Oct 23rd, 2010
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.39 KB | None | 0 0
  1. %define Werror_cflags %nil
  2.  
  3. # Modules always contain just 32-bit code
  4. %define _libdir %{_exec_prefix}/lib
  5.  
  6. # 64bit intel machines use 32bit boot loader
  7. # (We cannot just redefine _target_cpu, as we'd get i386.rpm packages then)
  8. %ifarch x86_64
  9. %define _target_platform i386-%{_vendor}-%{_target_os}%{?_gnu}
  10. %endif
  11. #sparc is always compile 64 bit
  12. %ifarch %{sparc}
  13. %define _target_platform sparc64-%{_vendor}-%{_target_os}%{?_gnu}
  14. %endif
  15.  
  16. Name: grub2
  17. Version: 1.98
  18. Release: %mkrel 1
  19. Summary: Bootloader with support for Linux, Multiboot and more
  20.  
  21. Group: System/Kernel and hardware
  22. License: GPLv3+
  23. URL: http://www.gnu.org/software/grub/
  24. Source0: http://alpha.gnu.org/pub/gnu/grub/grub-%{version}.tar.gz
  25. Source1: 90_persistent
  26. Source2: grub.default
  27. Source3: README.Mandriva
  28. Patch0: grub-1.95-grubdir.patch
  29.  
  30. BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
  31.  
  32. BuildRequires: flex bison ruby binutils glibc-static-devel
  33. BuildRequires: ncurses-devel liblzo-devel
  34. BuildRequires: freetype2-devel libusb-devel
  35. BuildRequires: help2man texinfo
  36.  
  37. # grubby
  38. Requires(pre): mkinitrd
  39. Requires(post): mkinitrd
  40.  
  41. # TODO: ppc and sparc
  42. ExclusiveArch: %{ix86} x86_64
  43.  
  44. %description
  45. This is the second version of the GRUB (Grand Unified Bootloader),
  46. a highly configurable and customizable bootloader with modular
  47. architecture. It support rich scale of kernel formats, file systems,
  48. computer architectures and hardware devices.
  49.  
  50. PLEASE NOTE: This is a development snapshot, and as such will not
  51. replace grub if you install it, but will be merely added as another
  52. kernel to your existing GRUB menu. Do not replace GRUB (grub package)
  53. with it unless you know what are you doing. Refer to README.Mandriva
  54. file that is part of this package's documentation for more information.
  55.  
  56.  
  57. %prep
  58. %setup -q -n grub-%{version}
  59.  
  60. %patch0 -p1 -b .grubdir
  61.  
  62. # README.Mandriva
  63. cp %{SOURCE3} .
  64.  
  65.  
  66. %build
  67. # -static is needed so that autoconf script is able to link
  68. # test that looks for _start symbol on 64 bit platforms
  69. %configure TARGET_LDFLAGS=-static \
  70. %ifarch %{sparc}
  71. --with-platform=ieee1275 \
  72. %else
  73. --with-platform=pc \
  74. %endif
  75. --enable-grub-emu-usb \
  76. --program-transform-name=s,grub,%{name},
  77. # TODO: Other platforms. Use alternatives system?
  78. # --with-platform=ieee1275 \
  79. # --with-platform=efi \
  80. # --with-platform=i386-pc \
  81.  
  82.  
  83. #make %{?_smp_mflags}
  84. #gcc -Inormal -I./normal -I. -Iinclude -I./include -Wall -W -DGRUB_LIBDIR=\"/usr/lib/`echo grub/i386-pc | sed 's&^&&;s,grub,grub2,'`\" -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -DGRUB_UTIL=1 -MD -c -o grub_emu-normal_lexer.o normal/lexer.c
  85. #In file included from normal/lexer.c:23:
  86. #include/grub/script.h:26:29: error: grub_script.tab.h: No such file or directory
  87. %make
  88.  
  89.  
  90. %install
  91. set -e
  92. rm -fr $RPM_BUILD_ROOT
  93. %makeinstall_std
  94.  
  95. # (bor) grub.info is harcoded in sources
  96. mv %{buildroot}%{_infodir}/grub.info %{buildroot}%{_infodir}/grub2.info
  97.  
  98. # Script that makes part of grub.cfg persist across updates
  99. install -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/grub.d/
  100.  
  101. # Ghost config file
  102. install -d $RPM_BUILD_ROOT/boot/%{name}
  103. touch $RPM_BUILD_ROOT/boot/%{name}/grub.cfg
  104. ln -s ../boot/%{name}/grub.cfg $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.cfg
  105.  
  106. # Install ELF files modules and images were created from into
  107. # the shadow root, where debuginfo generator will grab them from
  108. find $RPM_BUILD_ROOT -name '*.mod' -o -name '*.img' |
  109. while read MODULE
  110. do
  111. BASE=$(echo $MODULE |sed -r "s,.*/([^/]*)\.(mod|img),\1,")
  112. # Symbols from .img files are in .exec files, while .mod
  113. # modules store symbols in .elf. This is just because we
  114. # have both boot.img and boot.mod ...
  115. EXT=$(echo $MODULE |grep -q '.mod' && echo '.elf' || echo '.exec')
  116. TGT=$(echo $MODULE |sed "s,$RPM_BUILD_ROOT,.debugroot,")
  117. # install -m 755 -D $BASE$EXT $TGT
  118. done
  119.  
  120. # Defaults
  121. install -m 644 -D %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/default/grub
  122.  
  123. %find_lang grub
  124.  
  125. %clean
  126. rm -rf $RPM_BUILD_ROOT
  127.  
  128. %post
  129. exec >/dev/null 2>&1
  130. # Create device.map or reuse one from GRUB Legacy
  131. cp -u /boot/grub/device.map /boot/%{name}/device.map 2>/dev/null ||
  132. %{name}-mkdevicemap
  133. # Determine the partition with /boot
  134. BOOT_PARTITION=$(df -h /boot |(read; awk '{print $1; exit}'))
  135. # Generate core.img, but don't let it be installed in boot sector
  136. %{name}-install --grub-setup=/bin/true $BOOT_PARTITION
  137.  
  138.  
  139. %preun
  140. exec >/dev/null
  141. /sbin/grubby --remove-kernel=/boot/%{name}/core.img
  142. # XXX Ugly
  143. rm -f /boot/%{name}/*.mod
  144. rm -f /boot/%{name}/*.img
  145. rm -f /boot/%{name}/*.lst
  146. rm -f /boot/%{name}/device.map
  147.  
  148.  
  149. %triggerin -- kernel, kernel-PAE
  150. exec >/dev/null 2>&1
  151. # Generate grub.cfg
  152. grub2-mkconfig -o /boot/%{name}/grub.cfg
  153.  
  154. %triggerun -- kernel, kernel-PAE
  155. exec >/dev/null 2>&1
  156. # Generate grub.cfg
  157. grub2-mkconfig -o /boot/%{name}/grub.cfg
  158.  
  159.  
  160. %files -f grub.lang
  161. %defattr(-,root,root,-)
  162. %{_libdir}/%{name}
  163. %dir %{_prefix}/lib/grub
  164. %{_prefix}/lib/grub/grub-mkconfig_lib
  165. %{_prefix}/lib/grub/update-grub_lib
  166. %{_sbindir}/%{name}-mkdevicemap
  167. %{_sbindir}/%{name}-install
  168. #%{_sbindir}/%{name}-emu # FIXME?
  169. %{_sbindir}/%{name}-probe
  170. %{_sbindir}/%{name}-setup
  171. #%{_sbindir}/update-%{name}
  172. %{_sbindir}/%{name}-mkconfig
  173. %{_sbindir}/%{name}-reboot
  174. %{_sbindir}/%{name}-set-default
  175. %{_bindir}/%{name}-mkimage
  176. %{_bindir}/%{name}-mkelfimage
  177. %ifnarch %{sparc}
  178. %{_bindir}/%{name}-mkrescue
  179. %else
  180. %{_sbindir}/%{name}-ofpathname
  181. %endif
  182. %{_bindir}/%{name}-editenv
  183. %{_bindir}/%{name}-fstest
  184. %{_bindir}/%{name}-mkfont
  185. %{_bindir}/%{name}-bin2h
  186. %{_bindir}/%{name}-mkisofs
  187. %{_bindir}/%{name}-mkpasswd-pbkdf2
  188. %{_bindir}/%{name}-mkrelpath
  189. %{_bindir}/%{name}-script-check
  190. %dir %{_sysconfdir}/grub.d
  191. %config %{_sysconfdir}/grub.d/??_*
  192. %{_sysconfdir}/grub.d/README
  193. %{_sysconfdir}/%{name}.cfg
  194. %{_sysconfdir}/default/grub
  195. %dir /boot/%{name}
  196. # Actually, this is replaced by update-grub from scriptlets,
  197. # but it takes care of modified persistent part
  198. %config(noreplace) /boot/%{name}/grub.cfg
  199. %doc COPYING INSTALL NEWS README THANKS TODO ChangeLog README.Mandriva
  200. # %exclude %{_mandir}
  201. %{_infodir}/%{name}.info*
  202. %{_mandir}/man1/%{name}-*.1*
  203. %{_mandir}/man8/%{name}-*.8*
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement