#Packager: Shador <futur~DOT~andy~AT~googlemail.com>

pkgname=grub2
pkgver=1.99
pkgrel=4ab
source=("http://ftp.gnu.org/gnu/grub/grub-${pkgver}.tar.xz"
		"http://unifoundry.com/unifont-5.1.20080820.bdf.gz"
		"salix.jpg" "grub-default" "update-grub" "ntldr-img-r19.tar.xz"
		"grub-completion-hyphen.patch")
sourcetemplate="http://gaia.homelinux.org/salix/slkbuilds/$pkgname/"
docs=("readme" "install" "copying" "changelog" "authors" "news" "thanks"
	  "about-nls" "bugs" "todo")
url='http://www.gnu.org/software/grub/grub-2.en.html'
options=('noautodotnew' 'nosrcpack')
dotnew=('etc/default/grub' 'etc/grub.d/40_custom' 'etc/grub.d/41_custom'
		'etc/grub.d/30_os-prober' 'etc/grub.d/10_linux'
		'etc/grub.d/20_linux_xen' 'etc/grub.d/00_header')
CFLAGS=" "
CXXFLAGS=" "

slackdesc=\
(
#|-----handy-ruler------------------------------------------------------|
"$pkgname (the second GNU GRand Unified Bootloader)"
"GRUB 2 has been rewritten from scratch to clean up everything for"
"modularity and portability."
"Features are: Scripting support, Graphical interface, Rescue mode,"
"cross-platform and many more"
"Briefly, boot loader is the first software program that runs when a"
"computer starts. It is responsible for loading and transferring"
"control to the operating system kernel software (such as the Hurd or"
"the Linux). The kernel, in turn, initializes the rest of the operating"
"system (e.g. GNU)."
)


build() {
	set -e

	cd $startdir/src/grub-$pkgver
	mv $startdir/src/unifont-5.1.20080820.bdf unifont.bdf
	mkdir grub-extras
	mv $startdir/src/ntldr-img/ grub-extras/
	
	patch -p0 -i $startdir/src/grub-completion-hyphen.patch

	export GRUB_CONTRIB=$startdir/src/grub-$pkgver/grub-extras/
	
	./autogen.sh
	./configure \
		--prefix=/usr \
		--libdir=/usr/lib${LIBDIRSUFFIX} \
		--localstatedir=/var \
		--sysconfdir=/etc \
		--mandir=/usr/man \
		--docdir=/usr/doc/$pkgname-$pkgver/ \
		--enable-nls \
		--enable-grub-mkfont \
		--disable-grub-emu-usb \
		--disable-grub-emu-sdl \
		--disable-grub-emu-pci \
		--disable-mm-debug \
		--enable-device-mapper \
		--build=$arch-slackware-linux || return 1
	make -j $numjobs || return 1
	make install DESTDIR=$startdir/pkg || return 1

	cd $startdir/src
	install -m644 -vD grub-default $startdir/pkg/etc/default/grub
	install -m644 -vD salix.jpg $startdir/pkg/boot/grub/salix.jpg
	install -m755 -vD update-grub $startdir/pkg/usr/sbin/update-grub

	set +e
}