# SliTaz package receipt.

PACKAGE="hplip"
VERSION="3.12.2" 
CATEGORY="system-tools"
SHORT_DESC="Drivers for HP DeskJet, OfficeJet, Photosmart, Business Inkjet and some LaserJet"
MAINTAINER="jozee@slitaz.org"
DEPENDS="ghostscript python cups dbus-python libusb jpeg tiff sane-backends \
libgphoto2 libexif gcc-lib-base libtool libv4l"
BUILD_DEPENDS="ghostscript-dev dbus-python-dev sane-backends-dev sane-backends libexif-dev libgphoto2-dev libgphoto2 pkg-config libusb-dev jpeg-dev cups-dev dbus-dev tiff-dev python python-dev dbus-python"
TARBALL="$PACKAGE-$VERSION.tar.gz"
WEB_SITE="http://hplipopensource.com"
WGET_URL="http://downloads.sourceforge.net/sourceforge/hplip/$TARBALL"
TAGS="printer driver printing"
BUGS="Unable to delete hplip.desktop from $fs.  Using hack in post_install."

# Rules to configure and make the package. --prefix=/usr 
compile_rules()
{
	cd $src
	./configure  \
		--prefix=/usr \
		--sysconfdir=/etc \
		--disable-network-build \
		--disable-doc-build \
		--disable-gui-build \
		--disable-fax-build \
		--disable-qt3 \
                --enable-pp-build \
		$CONFIGURE_ARGS &&
	make &&
	make DESTDIR=$PWD/_pkg install
}

# Rules to gen a SliTaz package suitable for Tazpkg.
genpkg_rules()
{
	mkdir -p $fs/etc $fs/usr/lib $fs/usr/share
	
	cp -a $_pkg/etc   $fs
	cp -a $_pkg/usr/bin $fs/usr
	cp -a $_pkg/usr/lib/cups $fs/usr/lib
	cp -a $_pkg/usr/lib/python* $fs/usr/lib
	cp -a $_pkg/usr/lib/sane $fs/usr/lib
	cp -a $_pkg/usr/lib/*so* $fs/usr/lib
	cp -a $_pkg/usr/share/cups \
		   $_pkg/usr/share/hal \
		   $_pkg/usr/share/hplip \
		   $_pkg/usr/share/ppd \
		   $fs/usr/share

	# compress non-zipped ppd files
	find $fs/usr/share/ppd/HP -name "*.ppd" -exec gzip -n9 {} \;
 
	# remove autostart of hp-daemon
	rm -rf $fs/etc/sane.d
 
	# remove xdg
	rm -rf $fs/etc/xdg
}

post_install()
{
	# remove the desktop file                                   
	rm $fs/usr/share/applications/hplip.desktop
	                
	tazpkg reconfigure udev --root=$1
}