%define _name acsccid
%define dropdir %(pkg-config libpcsclite --variable usbdropdir 2>/dev/null)
%define libusb_ver 1.0.9
%define pcsc_lite_ver 1.8.3

Name:           pcsc-lite-acsccid
Version:        1.1.11
Release:        1%{?dist}
Summary:        ACS USB CCID smart card reader driver

License:        LGPLv2+
URL:            http://acsccid.sourceforge.net/
Source0:        http://downloads.sourceforge.net/%{_name}/%{_name}-%{version}.tar.bz2

BuildRequires:  make
BuildRequires:  perl-interpreter
BuildRequires:  perl-Getopt-Long
BuildRequires:  libusb1-devel >= %{libusb_ver}
BuildRequires:  pcsc-lite-devel >= %{pcsc_lite_ver}
BuildRequires:  flex
BuildRequires:  gcc
Requires(post): systemd
Requires(postun): systemd
Requires:       pcsc-lite >= %{pcsc_lite_ver}
Provides:       pcsc-ifd-handler


%description
ACS USB CCID (Chip/Smart Card Interface Devices) driver for use with the
PC/SC Lite daemon.


%prep
%setup -q -n %{_name}-%{version}
cp -a src/openct/LICENSE LICENSE.openct
cp -a src/towitoko/README README.towitoko


%build
%configure
%make_build


%install
%make_install


%post
/bin/systemctl try-restart pcscd.service >/dev/null 2>&1 || :


%postun
/bin/systemctl try-restart pcscd.service >/dev/null 2>&1 || :


%files
%doc AUTHORS ChangeLog README README.towitoko
%license COPYING LICENSE.openct
%{dropdir}/ifd-acsccid.bundle/


%changelog
* Wed Feb 14 2024 Terry Chan <terry.chan@acs.com.hk> - 1.1.11-1
- Updated to version 1.1.11.

* Thu Aug  3 2023 Godfrey Chung <godfrey.chung@acs.com.hk> - 1.1.10-1
- Updated to version 1.1.10.

* Thu Mar 23 2023 Godfrey Chung <godfrey.chung@acs.com.hk> - 1.1.9-1
- Updated to version 1.1.9.
- Added make to BuildRequires.
- Used make_build and make_install macros.
- Moved COPYING and LICENSE.openct to license.
- Removed NEWS from doc.

* Wed Jan  8 2020 Godfrey Chung <godfrey.chung@acs.com.hk> - 1.1.8-1
- Updated to version 1.1.8.

* Thu Jul 25 2019 Godfrey Chung <godfrey.chung@acs.com.hk> - 1.1.7-1
- Updated to version 1.1.7.
- Removed Group tag.

* Tue Oct 30 2018 Godfrey Chung <godfrey.chung@acs.com.hk> - 1.1.6-1
- Updated to version 1.1.6.
- Renamed perl to perl-interpreter in BuildRequires.
- Added gcc to BuildRequires.

* Wed Oct 25 2017 Godfrey Chung <godfrey.chung@acs.com.hk> - 1.1.5-1
- Updated to version 1.1.5.

* Fri Dec 16 2016 Godfrey Chung <godfrey.chung@acs.com.hk> - 1.1.4-1
- Updated to version 1.1.4.

* Thu Jun 23 2016 Godfrey Chung <godfrey.chung@acs.com.hk> - 1.1.3-1
- Updated to version 1.1.3.

* Fri Feb 19 2016 Godfrey Chung <godfrey.chung@acs.com.hk> - 1.1.2-1
- Updated to version 1.1.2.

* Fri Nov  6 2015 Godfrey Chung <godfrey.chung@acs.com.hk> - 1.1.1-1
- Updated to version 1.1.1.
- Updated libusb to 1.0.9.

* Mon Dec 15 2014 Godfrey Chung <godfrey.chung@acs.com.hk> - 1.1.0-1
- Updated to version 1.1.0.
- Updated libusb to 1.0.8.
- Updated pcsc-lite to 1.8.3.
- Removed old Fedora support.

* Fri Jul  4 2014 Godfrey Chung <godfrey.chung@acs.com.hk> - 1.0.8-1
- Updated to version 1.0.8.

* Tue Jun 17 2014 Godfrey Chung <godfrey.chung@acs.com.hk> - 1.0.7-1
- Updated to version 1.0.7.

* Thu Apr 24 2014 Godfrey Chung <godfrey.chung@acs.com.hk> - 1.0.6-1
- Updated to version 1.0.6.

* Wed Sep  4 2013 Godfrey Chung <godfrey.chung@acs.com.hk> - 1.0.5-1
- Updated to version 1.0.5.

* Tue Jun 26 2012 Godfrey Chung <godfrey.chung@acs.com.hk> - 1.0.4-1
- Updated to version 1.0.4.

* Fri Jan 13 2012 Godfrey Chung <godfrey.chung@acs.com.hk> - 1.0.3-1
- Updated to version 1.0.3.
- Removed pcsc-lite-1_7_3.patch.
- Included ChangeLog from upstream.

* Thu Jan 12 2012 Godfrey Chung <godfrey.chung@acs.com.hk> - 1.0.2-1
- Created package.
- Based on pcsc-lite-ccid.spec.