void-packages/srcpkgs/grub/template

100 lines
2.6 KiB
Plaintext

# Template file for 'grub'
pkgname=grub
version=2.00
revision=11
short_desc="GRand Unified Bootloader 2"
maintainer="Juan RP <xtraeme@gmail.com>"
license="GPL-3"
homepage="http://www.gnu.org/software/grub/"
distfiles="$GNU_SITE/grub/grub-$version.tar.xz"
checksum=784ec38e7edc32239ad75b8e66df04dc8bfb26d88681bc9f627133a6eb85c458
makedepends="flex libusb-compat-devel ncurses-devel freetype-devel
liblzma-devel device-mapper-devel font-unifont-bdf fuse-devel"
do_configure() {
unset CC AS LD RANLIB CPP
configure_args+=" --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_args} --with-platform=pc
if [ "$XBPS_TARGET_MACHINE" = "x86_64" ]; then
mkdir $wrksrc/efi_build
cd $wrksrc/efi_build
../configure ${configure_args} --with-platform=efi \
--target="x86_64" --disable-efiemu
fi
}
do_build() {
msg_normal "Building BIOS grub...\n"
cd $wrksrc/bios_build
make ${makejobs}
if [ "$XBPS_TARGET_MACHINE" = "x86_64" ]; then
msg_normal "Building EFI grub...\n"
cd $wrksrc/efi_build
make ${makejobs}
fi
}
do_install() {
if [ "$XBPS_TARGET_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
vinstall ${FILESDIR}/grub.default 644 etc/default grub
# Kernel hooks.
vinstall ${FILESDIR}/kernel.d/grub.post 750 \
etc/kernel.d/post-install 50-grub
vinstall ${FILESDIR}/kernel.d/grub.post 750 \
etc/kernel.d/post-remove 50-grub
# update-grub for noobs.
printf "#!/bin/sh\ngrub-mkconfig -o /boot/grub/grub.cfg\nexit \$?\n" >> \
${DESTDIR}/usr/sbin/update-grub
chmod 755 ${DESTDIR}/usr/sbin/update-grub
}
if [ "$XBPS_TARGET_MACHINE" = "x86_64" ]; then
grub-x86_64-efi_package() {
noarch=yes
depends="grub>=$version dosfstools efibootmgr"
short_desc+=" - x86_64 EFI support"
pkg_install() {
vmove usr/lib/grub/x86_64-efi
}
}
fi # !x86_64
grub_package() {
conf_files="/etc/default/grub /etc/grub.d/40_custom"
depends="os-prober"
pkg_install() {
vmove all
}
}