# SliTaz package receipt.

PACKAGE="grub2"
SOURCE="grub"
VERSION="1.98"
CATEGORY="base-system"
SHORT_DESC="GRUB2 boot loader."
MAINTAINER="pascal.bellard@slitaz.org"
TARBALL="$SOURCE-$VERSION.tar.gz"
DEPENDS="zlib freetype ncurses libusb-compat grep libusb"
BUILD_DEPENDS="bison zlib-dev freetype-dev ncurses-dev libusb-compat-dev libusb-dev"
WEB_SITE="http://www.gnu.org/software/grub/"
WGET_URL="ftp://alpha.gnu.org/gnu/grub/$TARBALL"

# Rules to configure and make the package.
compile_rules()
{
	cd $src
	# CVE-2015-8370
	sed -i "s/'.b'/& \\&\\& cur_len/" lib/crypto.c normal/auth.c
	
	chmod +x install-sh
	./configure --prefix=/usr --sysconfdir=/etc \
	--mandir=/usr/share/man $CONFIGURE_ARGS &&
	make &&
	make DESTDIR=$PWD/_pkg install
}

# Rules to gen a SliTaz package suitable for Tazpkg.
genpkg_rules()
{
	mkdir -p $fs/boot/grub $fs/usr
	cp -a $_pkg/usr/bin $fs/usr
	cp -a $_pkg/usr/sbin $fs/usr
	cp -a $_pkg/usr/lib $fs/usr
	cp -a $_pkg/etc $fs
	
	# Example config file (grub.cfg).
	cp stuff/example-grub.cfg $fs/boot/grub
}