From 778b74137675aea9f67c1285905ef287409207db Mon Sep 17 00:00:00 2001 From: Juan RP Date: Thu, 5 Jul 2012 13:40:27 +0200 Subject: [PATCH] grub: add efi support for x86_64, add patch for glibc-2.16. --- srcpkgs/grub/patches/glibc-2.16.patch | 10 ++++++ srcpkgs/grub/template | 45 ++++++++++++++++++++++++--- 2 files changed, 50 insertions(+), 5 deletions(-) create mode 100644 srcpkgs/grub/patches/glibc-2.16.patch diff --git a/srcpkgs/grub/patches/glibc-2.16.patch b/srcpkgs/grub/patches/glibc-2.16.patch new file mode 100644 index 0000000000..ff213d5974 --- /dev/null +++ b/srcpkgs/grub/patches/glibc-2.16.patch @@ -0,0 +1,10 @@ +--- grub-core/gnulib/stdio.in.h.orig 2012-07-05 11:43:24.596994420 +0200 ++++ grub-core/gnulib/stdio.in.h 2012-07-05 11:43:28.683970680 +0200 +@@ -141,7 +141,6 @@ _GL_WARN_ON_USE (fflush, "fflush is not + so any use of gets warrants an unconditional warning. Assume it is + always declared, since it is required by C89. */ + #undef gets +-_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead"); + + #if @GNULIB_FOPEN@ + # if @REPLACE_FOPEN@ diff --git a/srcpkgs/grub/template b/srcpkgs/grub/template index 3e437bae85..a34aa473e8 100644 --- a/srcpkgs/grub/template +++ b/srcpkgs/grub/template @@ -1,9 +1,7 @@ # Template file for 'grub' pkgname=grub version="2.00" -revision=3 -build_style=gnu-configure -configure_args="--disable-werror" +revision=4 makedepends="flex libusb-compat-devel ncurses-devel freetype-devel liblzma-devel device-mapper-devel font-unifont-bdf fuse-devel" fulldepends="os-prober" @@ -19,12 +17,49 @@ long_desc=" GRUB 2 is rewritten from scratch to make GNU GRUB cleaner, safer, more robust, more powerful, and more portable." -pre_configure() { +if [ "$XBPS_MACHINE" = "x86_64" ]; then + makedepends="$makedepends dosfstools efibootmgr" +fi + +do_configure() { + local sharedargs="--enable-device-mapper --enable-cache-stats --enable-nls \ + --enable-grub-mkfont --enable-grub-mount --disable-werror" + # fix unifont.bdf location so grub-mkfont can create *.pf2 files sed -i 's|/usr/share/fonts/unifont|/usr/share/fonts/misc|' configure + + # build BIOS version + mkdir $wrksrc/bios_build && cd $wrksrc/bios_build + ../configure ${CONFIGURE_SHARED_ARGS} --with-platform=pc $sharedargs + + if [ "$XBPS_MACHINE" = "x86_64" ]; then + mkdir $wrksrc/efi_build && cd $wrksrc/efi_build + ../configure ${CONFIGURE_SHARED_ARGS} --with-platform=efi \ + --target="x86_64" --disable-efiemu $sharedargs + fi } -post_install() { +do_build() { + msg_normal "Building BIOS grub...\n" + cd $wrksrc/bios_build && make ${makejobs} + if [ "$XBPS_MACHINE" = "x86_64" ]; then + msg_normal "Building EFI grub...\n" + cd $wrksrc/efi_build && make ${makejobs} + fi +} + +do_install() { + if [ "$XBPS_MACHINE" = "x86_64" ]; then + cd $wrksrc/efi_build && make DESTDIR=$DESTDIR/efi install + # Remove non-platform specific files + rm -rf ${DESTDIR}/efi/{boot,etc,usr/{share,bin,sbin}} + rm -f ${DESTDIR}/efi/usr/lib/grub/x86_64-efi/x86_64-* + rm -f ${DESTDIR}/efi/usr/lib/grub/x86_64-efi/*.{module,image} + mv ${DESTDIR}/efi/* ${DESTDIR} + rmdir ${DESTDIR}/efi + fi + cd $wrksrc/bios_build && make DESTDIR=$DESTDIR install + # Required to compress info files. vmkdir usr/share/info touch -f ${DESTDIR}/usr/share/info/dir