### this file is sourced not run
PKGVER=2.02.2018.08.plain
PKGBUILD=1
PKGARCH=x86_64

# source: james
TARBALL=grub-20180725.tar.bz2
MD5SUM=470bfda948985dba4543e6d55d4b32f0
SRC_URL=http://distro.ibiblio.org/fatdog/source/800/$TARBALL
BUNDLE=

PKG_NOSTRIP=yes # don't strip to preserve Secure Boot signatures

SLACKREQ='' # 
SLACKDESC="grub2-bios: grub2-bios $PKGVER (Bootloader)  
grub2-bios:  
grub2-bios: The GRUB package contains the GRand Unified Bootloader
grub2-bios: This contains the BIOS bootloader package.  
grub2-bios: 
grub2-bios: 
grub2-bios: 
grub2-bios: 
grub2-bios: 
grub2-bios: 
grub2-bios: 
"

### default pkg_download
### prepare
pkg_prepare() {
	pkg_prepare_default &&
	cd tmp/grub* &&
	patch -Np1 -i ../pkg/remove-address-limit.patch &&
	patch -Np1 -i ../pkg/mkconfig-boot-directory.patch &&
	patch -Np1 -i ../pkg/grub-2.06-upstream_fixes-1.patch &&
	true
}

### default pkg_package
### build
pkg_build() {
	cd /tmp/grub* 

	./autogen.sh &&
	autoreconf -fi &&

	# build - use -O1, something in -O2 and -Os kills the EFI version, so be safe in here too
	CFLAGS="-O1" \
	./configure --prefix=/usr      \
            --sbindir=/sbin        \
            --sysconfdir=/etc      \
            --libdir=/usr/$LIBDIR  \
            --disable-werror       \
            --with-utils=host
	make $MAKEFLAGS && make install &&

	# remove debug info
	strip -g /usr/$LIBDIR/grub/i386-pc/*module &&

	pkg_build_slackdesc
}
