# Created by: arved
# $FreeBSD: head/devel/libccid/Makefile 452765 2017-10-24 11:25:01Z mmokhi $

PORTNAME=	ccid
PORTVERSION=	1.4.28
CATEGORIES=	devel
MASTER_SITES=	https://alioth.debian.org/frs/download.php/latestfile/112/

MAINTAINER=	mmokhi@FreeBSD.org
COMMENT=	Generic USB CCID (Chip/Smart Card Interface Devices) driver

LICENSE=	LGPL21
LICENSE_FILE=	${WRKSRC}/COPYING

LIB_DEPENDS=	libpcsclite.so:devel/pcsc-lite

USES=		perl5 pkgconfig tar:bzip2
GNU_CONFIGURE=	yes
USE_PERL5=	build
CONFIGURE_ARGS=	--enable-usbdropdir=${PREFIX}/lib/pcsc/drivers \
		--enable-ccidtwindir=${PREFIX}/lib/pcsc/drivers/serial

PLIST_SUB=	VER=${PORTVERSION}
INSTALL_TARGET=	install-strip

post-patch:
	@${REINPLACE_CMD} -e "s,ndef __APPLE__, !(__APPLE__ || __FreeBSD__)," ${WRKSRC}/contrib/Kobil_mIDentity_switch/Kobil_mIDentity_switch.c
	@${REINPLACE_CMD} -e "s,libusb-1.0/libusb.h,libusb.h," \
		${WRKSRC}/configure ${WRKSRC}/src/ccid_usb.c \
		${WRKSRC}/src/ccid_usb.h \
		${WRKSRC}/contrib/Kobil_mIDentity_switch/Kobil_mIDentity_switch.c

post-install:
	${INSTALL_PROGRAM} ${WRKSRC}/contrib/RSA_SecurID/RSA_SecurID_getpasswd \
		${STAGEDIR}${PREFIX}/bin
	${INSTALL_MAN} ${WRKSRC}/contrib/RSA_SecurID/RSA_SecurID_getpasswd.1 \
		${STAGEDIR}${MANPREFIX}/man/man1

.include <bsd.port.mk>
