# SliTaz package receipt.

PACKED_SIZE="68.0K"
UNPACKED_SIZE="236.0K"
PACKAGE="pcsc-lite"
VERSION="1.8.6"
CATEGORY="base-system"
SHORT_DESC="SCard interface for communicating to smart cards and readers."
MAINTAINER="pascal.bellard@slitaz.org"
LICENSE="BSD"
WEB_SITE="http://pcsclite.alioth.debian.org/"
TARBALL="$PACKAGE-$VERSION.tar.bz2"
WGET_URL="https://alioth.debian.org/frs/download.php/3741/$TARBALL"

SUGGESTED="ccid"
DEPENDS="udev"
BUILD_DEPENDS="wget udev-dev perl libtool"

# Rules to configure and make the package.
compile_rules()
{
	cd $src
	./configure \
		--prefix=/usr \
		--enable-libudev \
		--enable-ipcdir=/run/pcscd \
		--enable-usbdropdir=/usr/lib/pcsc/drivers \
		$CONFIGURE_ARGS &&
	make && make DESTDIR=$DESTDIR install
}

# Rules to gen a SliTaz package suitable for Tazpkg.
genpkg_rules()
{
	mkdir -p $fs/usr/lib/pcsc/drivers $fs/etc
	cp -a $install/usr/lib/*.so* $fs/usr/lib
	cp -a $install/usr/sbin $fs/usr
	cp -a $install/usr/bin $fs/usr
	cp -a $stuff/init.d $fs/etc
}

# Daemon options in: daemons.conf
post_install()
{
	if ! grep -q 'PCSCD_OPTIONS' "$1/etc/daemons.conf"; then
		echo '# PC/SC smart card daemon options.' >> "$1/etc/daemons.conf"
		echo 'PCSCD_OPTIONS=""' >> "$1/etc/daemons.conf"
		echo '' >> "$1/etc/daemons.conf"
	fi
}
