summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2018-09-09 23:52:35 +0100
committerV3n3RiX <venerix@redcorelinux.org>2018-09-09 23:52:35 +0100
commit7f98539e12072767a61ea9bf5951b66405635689 (patch)
tree4e7d4c9cad02229f85080d889ef87a627b721b39
parent09e2ea646ce2301309527826f89b45246f672a8c (diff)
sys-boot/grub : hacky way to allow grub-bios/grub-efi multibuild
-rw-r--r--packages/sys-boot/grub/grub.exlib63
1 files changed, 56 insertions, 7 deletions
diff --git a/packages/sys-boot/grub/grub.exlib b/packages/sys-boot/grub/grub.exlib
index c0f63c1..b9488bf 100644
--- a/packages/sys-boot/grub/grub.exlib
+++ b/packages/sys-boot/grub/grub.exlib
@@ -3,7 +3,6 @@
require gnu [ suffix=tar.xz ] \
flag-o-matic \
- bash-completion \
autotools [ supported_autoconf=[ 2.5 ] supported_automake=[ 1.16 1.15 ] ]
if ever is_scm ; then
@@ -12,17 +11,19 @@ if ever is_scm ; then
require scm-git
fi
-export_exlib_phases pkg_setup src_configure src_prepare src_install
+export_exlib_phases pkg_setup src_prepare src_configure src_compile src_install
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 ] ]]
grub-mount [[ description = [ FUSE driver for filesystems that GRUB understands ] ]]
mkfont [[ description = [ Build grub-mkfont which can create GRUB font files ] ]]
( providers: eudev systemd ) [[ number-selected = exactly-one ]]
+ ( efi bios ) [[ number-selected = at-least-one ]]
"
# TODO: needs qemu-system-i386
@@ -73,8 +74,10 @@ grub_src_prepare() {
autotools_src_prepare
}
-grub_src_configure() {
+
+_cfg_n_build_grub_bios() {
filter-flags -mfloat-abi=hard
+ unset CFLAGS CPPFLAGS LDFLAGS
myconf=(
"CPP=${CC} -E"
@@ -84,6 +87,7 @@ grub_src_configure() {
BUILD_LDFLAGS="$(print-build-flags LDFLAGS)"
--with-bootdir=/boot
--with-grubdir=grub
+ --with-platform=pc
--enable-cache-stats
--disable-libzfs
--disable-werror
@@ -95,23 +99,68 @@ grub_src_configure() {
gt_cv_func_gnugettext{1,2}_libc=yes
)
- option efi && myconf+=( '--with-platform=efi' )
+ econf "${myconf[@]}" \
+ $(option_enable device-mapper) \
+ $(option_enable grub-mount) \
+ $(option_enable mkfont grub-mkfont)
+
+ emake && emake DESTDIR="${IMAGE}" install
+ emake distclean
+}
+
+_cfg_n_build_grub_efi() {
+ 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_install() {
- default
+grub_src_configure() {
+ if option bios; then
+ _cfg_n_build_grub_bios
+ fi
+ if option efi; then
+ _cfg_n_build_grub_efi
+ fi
+}
+
+grub_src_compile() {
+ :
+}
+
+grub_src_install() {
dodoc "${WORK}"/docs/grub.cfg
edo rm -f "${IMAGE}"/usr/$(exhost --target)/lib/charset.alias
edo rm "${IMAGE%/}"/etc/bash_completion.d/${PN}
edo rmdir "${IMAGE%/}"/etc/bash_completion.d/
- dobashcompletion "${WORK%/}"/util/bash-completion.d/${PN}
}