# SliTaz package receipt.

PACKAGE="ndiswrapper-driver"
VERSION="1.56"
CATEGORY="system-tools"
SHORT_DESC="Add Windows network drivers support to Linux kernel."
MAINTAINER="erjo@slitaz.org"
DEPENDS="linux lzma"
BUILD_DEPENDS="linux-module-headers"
SOURCE="ndiswrapper"
TARBALL="$SOURCE-$VERSION.tar.gz"
WEB_SITE="http://ndiswrapper.sourceforge.net/joomla/"
WGET_URL="$SF_MIRROR/$SOURCE/stable/$VERSION/$TARBALL"
TAGS="windows wireless network"

# Rules to configure and make the package.
compile_rules()
{
	
	KERNEL_VERSION=`grep  ^VERSION= $WOK/linux/receipt | cut -d "=" -f2 | sed -e 's/"//g'`
	cd $src
	patch -Np1 -i $stuff/kernel-2.6.35.patch
	patch -Np1 -i $stuff/kernel-2.6.36.patch
	make KBUILD=/usr/src/linux KVER=linux-$KERNEL_VERSION-slitaz
}

# Rules to gen a SliTaz package suitable for Tazpkg.
genpkg_rules()
{
	KERNEL_VERSION=`grep  ^VERSION= $WOK/linux/receipt | cut -d "=" -f2 | sed -e 's/"//g'`
	EXTRAVERSION=_$KERNEL_VERSION
	
	mkdir -p $fs/usr/sbin $fs/sbin $fs/lib/modules/$KERNEL_VERSION-slitaz/kernel/misc
	
	# Install utilities	
	install -o root -m 755 $src/utils/loadndisdriver $fs/sbin/

	# Compress and install module
	# $stuff/gztazmod.sh $fs/lib/modules/$VERSION-slitaz
	lzma e $src/driver/ndiswrapper.ko \
		$fs/lib/modules/$KERNEL_VERSION-slitaz/kernel/misc/ndiswrapper.ko.gz
	chown root $fs/lib/modules/$KERNEL_VERSION-slitaz/kernel/misc/ndiswrapper.ko.gz
	chmod 644 $fs/lib/modules/$KERNEL_VERSION-slitaz/kernel/misc/ndiswrapper.ko.gz
}

post_install()
{
	echo "Processing post-install commands..."
	chroot "$1/" depmod -a ${EXTRAVERSION#_}-slitaz
}

post_remove()
{
	echo "Processing post-remove commands..."
	chroot "$1/" depmod -a ${EXTRAVERSION#_}-slitaz
}