From f29d569cd33a73da5ad675f43a34ad53c5cc9bc6 Mon Sep 17 00:00:00 2001
From: davidovski <david@davidovski.xyz>
Date: Thu, 2 Feb 2023 14:10:02 +0000
Subject: Work

---
 repo/grub/grub.xibuild | 36 +++++++++++++++++++++++++++++-------
 1 file changed, 29 insertions(+), 7 deletions(-)

(limited to 'repo/grub/grub.xibuild')

diff --git a/repo/grub/grub.xibuild b/repo/grub/grub.xibuild
index ac331b3..696055a 100644
--- a/repo/grub/grub.xibuild
+++ b/repo/grub/grub.xibuild
@@ -1,7 +1,7 @@
 #!/bin/sh
 
-MAKEDEPS="make "
-DEPS="sh xz gettext efibootmgr freetype2"
+MAKEDEPS="make sh xz gettext efibootmgr freetype2"
+DEPS="efibootmgr"
 
 PKG_VER=2.06
 SOURCE=https://ftp.gnu.org/gnu/grub/grub-$PKG_VER.tar.xz
@@ -12,20 +12,39 @@ ADDITIONAL="
 
 DESC="GNU GRand Unified Bootloader v2"
 
+flavours="bios efi"
+
 prepare () {
-    gunzip -c unifont-13.0.06.pcf.gz > $PKG_DEST/usr/share/fonts/unifont/unifont.pcf
 
     unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS
+    for f in $flavours; do
+        mkdir $BUILD_ROOT/build-$f
+        tar -C build-$f -xvf grub-$PKG_VER.tar.xz
+    done
 }
 
 build () {
-    ./configure --prefix=/usr --sysconfdir=/etc --disable-werror \
-        --disable-efiemu --enable-grub-mkfont --with-platform=efi --with-platform=pc
-    make 
+    for f in $flavours; do
+        cd $BUILD_ROOT/build-$f/grub-$PKG_VER
+        case "$f" in
+            bios) opts="--with-platform=pc";;
+            efi) opts="--with-platform=efi --disable-efiemu";;
+        esac
+
+        ./configure --prefix=/usr --sysconfdir=/etc --disable-werror \
+            --enable-grub-mkfont $opts
+        make 
+    done
+
 }
 
 package () {
-    make DESTDIR=$PKG_DEST install 
+    for f in $flavours; do
+        cd $BUILD_ROOT/build-$f/grub-$PKG_VER
+        make DESTDIR=$PKG_DEST install-strip
+    done
+    cd $BUILD_ROOT
+
     mkdir -p $PKG_DEST/usr/share/bash-completion/completions
     mv $PKG_DEST/etc/bash_completion.d/grub $PKG_DEST/usr/share/bash-completion/completions
     mkdir -p $PKG_DEST/etc/default
@@ -40,4 +59,7 @@ GRUB_CMDLINE_LINUX_DEFAULT=""
 GRUB_CMDLINE_LINUX=""
 
 EOF
+
+    mkdir -p $PKG_DEST/usr/share/fonts/unifont
+    gunzip -c unifont-13.0.06.pcf.gz > $PKG_DEST/usr/share/fonts/unifont/unifont.pcf
 }
-- 
cgit v1.2.1