# Template file for 'pcsc-tools'
pkgname=pcsc-tools
version=1.4.23
revision=2
maintainer="Juan RP <xtraeme@voidlinux.eu>"
homepage="http://ludovic.rousseau.free.fr/softwares/pcsc-tools/pcsc-tools-1.4.22.tar.gz"
license="GPL-2"
short_desc="Tools used to test a PC/SC driver, card or reader or send commands in a friendly environment"
hostmakedepends="pkg-config"
makedepends="pcsclite-devel"
depends="perl-Gtk2"
distfiles="http://ludovic.rousseau.free.fr/softwares/${pkgname}/${pkgname}-${version}.tar.gz"
checksum="69ca7bb6ee23ef99e2696451f2f56072dd74adcc43272d89fd757ac8f7de4fe2"

do_build() {
	make CC=$CC ${makejobs}
}
do_install() {
	# copy the program in /usr/bin
	mkdir -p ${DESTDIR}/usr/bin
	cp ${wrksrc}/ATR_analysis ${DESTDIR}/usr/bin
	cp ${wrksrc}/pcsc_scan ${DESTDIR}/usr/bin
	cp ${wrksrc}/scriptor ${DESTDIR}/usr/bin
	cp ${wrksrc}/gscriptor ${DESTDIR}/usr/bin

	# copy the manpages in /usr/share/man/	
	mkdir -p ${DESTDIR}/usr/share/man/man1
	cp ${wrksrc}/ATR_analysis.1p ${DESTDIR}/usr/share/man/man1
	cp ${wrksrc}/pcsc_scan.1 ${DESTDIR}/usr/share/man/man1
	cp ${wrksrc}/scriptor.1p ${DESTDIR}/usr/share/man/man1
	cp ${wrksrc}/gscriptor.1p ${DESTDIR}/usr/share/man/man1

	# copy the helper files in /usr/share/${pkgname}
	mkdir -p ${DESTDIR}/usr/share/${pkgname}
	cp ${wrksrc}/README ${DESTDIR}/usr/share/${pkgname}
	cp ${wrksrc}/test.script ${DESTDIR}/usr/share/${pkgname}

	# copy the smartcarlist to the default location hardcoded in pcsc_scan
	mkdir -p ${DESTDIR}/usr/share/pcsc
	cp ${wrksrc}/smartcard_list.txt ${DESTDIR}/usr/share/pcsc
}
