From f48e707939dd1ce37ed39cc0886f2aafe5f2fbbc Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sat, 15 Sep 2018 00:37:52 +0100 Subject: sys-boot/grub/grub.exlib : make multibuild (efi/pc) more nice and reliable --- packages/sys-boot/grub/grub.exlib | 146 ++++++++++++++++++++------------------ 1 file changed, 78 insertions(+), 68 deletions(-) diff --git a/packages/sys-boot/grub/grub.exlib b/packages/sys-boot/grub/grub.exlib index b9488bf..6d7edea 100644 --- a/packages/sys-boot/grub/grub.exlib +++ b/packages/sys-boot/grub/grub.exlib @@ -17,13 +17,13 @@ SUMMARY="GRUB (Grand Unified Boot) bootloader" LICENCES="GPL-3" MYOPTIONS=" - bios [[ description = [ Build for BIOS platform ] ]] device-mapper [[ description = [ Ability to detect and use device-mapper devices ] ]] - efi [[ description = [ Build for EFI platform ] ]] + efi [[ description = [ Build EFI platform support ] ]] grub-mount [[ description = [ FUSE driver for filesystems that GRUB understands ] ]] mkfont [[ description = [ Build grub-mkfont which can create GRUB font files ] ]] + pc [[ description = [ Build PC platform support ] ]] ( providers: eudev systemd ) [[ number-selected = exactly-one ]] - ( efi bios ) [[ number-selected = at-least-one ]] + ( efi pc ) [[ number-selected = at-least-one ]] " # TODO: needs qemu-system-i386 @@ -75,84 +75,94 @@ grub_src_prepare() { } -_cfg_n_build_grub_bios() { - filter-flags -mfloat-abi=hard - unset CFLAGS CPPFLAGS LDFLAGS +grub_src_multibuild_prepare() { + if option efi; then + cp -ax ${WORK} ${WORK}-efi + fi - myconf=( - "CPP=${CC} -E" - BUILD_CC=$(exhost --build)-cc - BUILD_CFLAGS="$(print-build-flags CFLAGS)" - BUILD_CPPFLAGS="$(print-build-flags CPPFLAGS)" - BUILD_LDFLAGS="$(print-build-flags LDFLAGS)" - --with-bootdir=/boot - --with-grubdir=grub - --with-platform=pc - --enable-cache-stats - --disable-libzfs - --disable-werror - # TODO: for now disable emulation utils - --disable-efiemu - --disable-grub-emu-sdl - --disable-grub-emu-pci - --disable-mm-debug - gt_cv_func_gnugettext{1,2}_libc=yes - ) - - econf "${myconf[@]}" \ - $(option_enable device-mapper) \ - $(option_enable grub-mount) \ - $(option_enable mkfont grub-mkfont) - - emake && emake DESTDIR="${IMAGE}" install - emake distclean + if option pc; then + cp -ax ${WORK} ${WORK}-pc + fi } -_cfg_n_build_grub_efi() { + +grub_src_configure() { filter-flags -mfloat-abi=hard unset CFLAGS CPPFLAGS LDFLAGS - myconf=( - "CPP=${CC} -E" - BUILD_CC=$(exhost --build)-cc - BUILD_CFLAGS="$(print-build-flags CFLAGS)" - BUILD_CPPFLAGS="$(print-build-flags CPPFLAGS)" - BUILD_LDFLAGS="$(print-build-flags LDFLAGS)" - --with-bootdir=/boot - --with-grubdir=grub - --with-platform=efi - --enable-cache-stats - --disable-libzfs - --disable-werror - # TODO: for now disable emulation utils - --disable-efiemu - --disable-grub-emu-sdl - --disable-grub-emu-pci - --disable-mm-debug - gt_cv_func_gnugettext{1,2}_libc=yes - ) - - econf "${myconf[@]}" \ - $(option_enable device-mapper) \ - $(option_enable grub-mount) \ - $(option_enable mkfont grub-mkfont) - - emake && emake DESTDIR="${IMAGE}" install - emake distclean -} + grub_src_multibuild_prepare -grub_src_configure() { - if option bios; then - _cfg_n_build_grub_bios + if option efi; then + pushd ${WORK}-efi + + myconf=( + "CPP=${CC} -E" + BUILD_CC=$(exhost --build)-cc + BUILD_CFLAGS="$(print-build-flags CFLAGS)" + BUILD_CPPFLAGS="$(print-build-flags CPPFLAGS)" + BUILD_LDFLAGS="$(print-build-flags LDFLAGS)" + --with-bootdir=/boot + --with-grubdir=grub + --with-platform=efi + --enable-cache-stats + --disable-libzfs + --disable-werror + # TODO: for now disable emulation utils + --disable-efiemu + --disable-grub-emu-sdl + --disable-grub-emu-pci + --disable-mm-debug + gt_cv_func_gnugettext{1,2}_libc=yes + ) + + econf "${myconf[@]}" \ + $(option_enable device-mapper) \ + $(option_enable grub-mount) \ + $(option_enable mkfont grub-mkfont) fi - if option efi; then - _cfg_n_build_grub_efi + if option pc; then + pushd ${WORK}-pc + + myconf=( + "CPP=${CC} -E" + BUILD_CC=$(exhost --build)-cc + BUILD_CFLAGS="$(print-build-flags CFLAGS)" + BUILD_CPPFLAGS="$(print-build-flags CPPFLAGS)" + BUILD_LDFLAGS="$(print-build-flags LDFLAGS)" + --with-bootdir=/boot + --with-grubdir=grub + --with-platform=pc + --enable-cache-stats + --disable-libzfs + --disable-werror + # TODO: for now disable emulation utils + --disable-efiemu + --disable-grub-emu-sdl + --disable-grub-emu-pci + --disable-mm-debug + gt_cv_func_gnugettext{1,2}_libc=yes + ) + + econf "${myconf[@]}" \ + $(option_enable device-mapper) \ + $(option_enable grub-mount) \ + $(option_enable mkfont grub-mkfont) fi } grub_src_compile() { - : + if option efi; then + pushd ${WORK}-efi + emake && emake DESTDIR="${IMAGE}" install + rm -rf ${WORK}-efi + fi + + if option pc; then + pushd ${WORK}-pc + emake && emake DESTDIR="${IMAGE}" install + rm -rf ${WORK}-pc + fi } grub_src_install() { -- cgit v1.2.3