description="The GRUB package contains the GRand Unified Bootloader, EFI version"
url="http://www.gnu.org/software/grub/"

packager="tnut <tnut@nutyx.org>"

makedepends=(efibootmgr efivar freetype)
run=(efivar)

name=grub-efi
version=2.04
release=2

pyversion=3.8.1

source=(https://www.python.org/ftp/python/$pyversion/Python-$pyversion.tar.xz
        https://ftp.gnu.org/gnu/grub/grub-$version.tar.xz
        http://downloads.tuxfamily.org/nutyx/files/unicode.pf2)

PKGMK_GROUPS=(man locale)
prepare() {

   cd Python-$pyversion
   rm -r Doc
   ./configure --prefix=$SRC/tools --with-ensurepip=no
   make
   make libinstall bininstall
}
build() {
 export PATH=$SRC/tools/bin:$PATH
 cd grub-$version

 ./configure --prefix=/usr --sysconfdir=/etc \
 --sbindir=/sbin \
 --disable-efiemu --enable-grub-mkfont \
 --with-platform=efi --target=$PKGMK_ARCH \
 --program-prefix="" --program-suffix="-efi" \
 --with-bootdir="/boot" \
 --with-grubdir="grub-efi"  --disable-werror

 make -s

 make DESTDIR=$PKG install

 mv $PKG/etc/bash_completion.d/grub{,-efi}
 mv $PKG/etc/grub.d/README{,-efi}
 mv $PKG/usr/share/grub/grub{,-efi}-mkconfig_lib
 cp ../unicode.pf2 $PKG/usr/share/grub/

 # Duplicate with grub package
 rm -r $PKG/usr/share/{info,locale}
}
