pcsc-lite/pcsc-lite.spec

291 lines
8.4 KiB
RPMSpec

#
# spec file for package pcsc-lite
#
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
Name: pcsc-lite
# FIXME: Maybe we should use /usr/lib/pcsc/drivers as others do:
%define ifddir %{_libdir}/readers
BuildRequires: gcc
BuildRequires: libtool
BuildRequires: pkg-config
BuildRequires: readline-devel
%if %suse_version > 1310
BuildRequires: polkit-devel
%endif
%if %suse_version >= 1120
BuildRequires: libudev-devel
%endif
%if %suse_version <= 1110
# libusb is an inferior method of USB enumeration, as it introduces polling
BuildRequires: libusb-1_0-devel
%endif
%if %suse_version > 1140
BuildRequires: systemd
%{?systemd_requires}
%endif
%if %suse_version > 1220
BuildRequires: gpg-offline
%endif
Version: 1.8.12
Release: 0
Requires(pre): pwdutils
Url: http://pcsclite.alioth.debian.org/
Summary: PCSC Smart Cards Library
License: BSD-3-Clause
Group: Productivity/Security
Source: %{name}-%{version}.tar.bz2
Source1: %{name}.sysconfig
Source2: README.SUSE
Source3: pre_checkin.sh
Source4: baselibs.conf
Source5: pcsc-lite-init
Source6: pcsc-lite-reader-conf
Source7: %{name}-%{version}.tar.bz2.asc
Source8: %{name}.keyring
Patch0: systemd-service.patch
Requires(post): %fillup_prereq
%if %suse_version < 1310
PreReq: sysvinit(syslog)
Requires(post): %insserv_prereq
%endif
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%define USER scard
%define GROUP scard
%description
The purpose of PCSC Lite is to provide a Windows(R) SCard interface in
a very small form factor for communication with smart cards and
readers. PCSC Lite can be compiled directly for a desired reader driver
or can be used to dynamically allocate/deallocate reader drivers at
runtime (the default behavior).
PCSC Lite uses the same winscard API as used in Windows(R).
Security aware people should read the SECURITY file for possible
vulnerabilities of pcsclite and how to fix them. For information on how
to install drivers please read the DRIVERS file.
Memory cards will be supported through the MCT specification, which is
an APDU like manner sent normally through the SCardTransmit() function.
This functionality is exercised in the driver.
%package -n libpcsclite1
Summary: PCSC Smart Card Library
License: BSD-3-Clause
Group: System/Libraries
Recommends: pcsc-lite >= %{version}
%description -n libpcsclite1
The purpose of PCSC Lite is to provide a Windows(R) SCard interface in
a very small form factor for communication with smart cards and
readers. PCSC Lite can be compiled directly for a desired reader driver
or can be used to dynamically allocate/deallocate reader drivers at
runtime (the default behavior).
PCSC Lite uses the same winscard API as used in Windows(R).
Security aware people should read the SECURITY file for possible
vulnerabilities of pcsclite and how to fix them. For information on how
to install drivers please read the DRIVERS file.
Memory cards will be supported through the MCT specification, which is
an APDU like manner sent normally through the SCardTransmit() function.
This functionality is exercised in the driver.
%package -n libpcscspy0
Summary: PCSC Smart Card Library
License: GPL-3.0+
Group: System/Libraries
%description -n libpcscspy0
Supporting library for the PC/SC spy tool.
%package devel
Summary: Development package for the MUSCLE project SmartCards library
License: BSD-3-Clause and GPL-3.0+
Group: Development/Libraries/C and C++
Requires: %{name} = %{version}-%{release}
Requires: glibc-devel
Requires: libpcsclite1 = %{version}-%{release}
Requires: libpcscspy0 = %{version}-%{release}
%description devel
This package contains the development files for pcsc-lite. It allows to
compile plugins for the pcsc-lite package.
%prep
%if 0%{?gpg_verify:1}
%gpg_verify %{S:7}
%endif
%setup -q
%patch0 -p1
cp -a %{S:1} %{S:2} %{S:5} %{S:6} .
%build
%configure\
--docdir=%{_docdir}/%{name} \
--enable-usbdropdir=%{ifddir} \
--disable-libhal \
%if %suse_version <= 1110
--disable-libudev \
%endif
%if %suse_version > 1140
--with-systemdsystemunitdir=%_unitdir \
%endif
%if %suse_version > 1310
--enable-polkit \
%endif
--disable-static
make %{?jobs:-j%jobs}
%install
%makeinstall
mkdir -p $RPM_BUILD_ROOT%{ifddir}
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/reader.conf.d/
sed s:@ifddir@:%{ifddir}: <pcsc-lite-reader-conf >$RPM_BUILD_ROOT%{_sysconfdir}/reader.conf.d/reader.conf
# this program is noinst in the package
#install src/.libs/testpcsc $RPM_BUILD_ROOT%{_sbindir}/
%if %suse_version < 1310
install -D -m 755 pcsc-lite-init $RPM_BUILD_ROOT%{_initrddir}/pcscd
ln -sf %{_initrddir}/pcscd $RPM_BUILD_ROOT%{_sbindir}/rcpcscd
%else
ln -s /usr/sbin/service %{buildroot}%{_sbindir}/rcpcscd
%endif
mkdir -p $RPM_BUILD_ROOT/var/adm/fillup-templates
cp %{name}.sysconfig $RPM_BUILD_ROOT/var/adm/fillup-templates/sysconfig.pcscd
mkdir -p $RPM_BUILD_ROOT%{_docdir}/%{name}
cp -a AUTHORS ChangeLog ChangeLog.svn COPYING DRIVERS HELP NEWS README README.SUSE SECURITY TODO $RPM_BUILD_ROOT%{_docdir}/%{name}
%clean
rm -rf $RPM_BUILD_ROOT
%pre
getent group %{GROUP} >/dev/null || groupadd -r %{GROUP}
if getent passwd %{USER} >/dev/null ; then
# There was a bad login shell up to openSUSE 12.2 (bnc#796242), never in SLE. Fix it.
usermod -s /usr/sbin/nologin %{USER}
else
useradd -r -g %{GROUP} -s /usr/sbin/nologin -c "Smart Card Reader" -d /var/run/pcscd %{USER}
fi
%if %suse_version > 1140
%service_add_pre pcscd.service pcscd.socket
%endif
exit 0
%post
%if %suse_version > 1140
%service_add_post pcscd.service pcscd.socket
/bin/systemctl disable pcscd.service || :
/bin/systemctl enable pcscd.socket || :
/bin/systemctl try-restart pcscd.service || :
/bin/systemctl restart pcscd.socket || :
%endif
%if %suse_version < 1310
%fillup_and_insserv -y -n pcscd pcscd
%else
%fillup_only -n pcscd pcscd
%endif
%preun
%if %suse_version > 1140
%service_del_preun pcscd.service pcscd.socket
%endif
%if %suse_version < 1310
%stop_on_removal pcscd
%endif
%postun
%if %suse_version > 1140
%service_del_postun pcscd.service pcscd.socket
# make sure to reload systemd for possible downgrades
if [ "$1" = "1" ]; then
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
fi
%endif
%if %suse_version < 1310
%restart_on_update pcscd
%insserv_cleanup
%endif
%post -n libpcsclite1 -p /sbin/ldconfig
%postun -n libpcsclite1 -p /sbin/ldconfig
%post -n libpcscspy0 -p /sbin/ldconfig
%postun -n libpcscspy0 -p /sbin/ldconfig
%files
%defattr(-,root,root)
%docdir %{_docdir}/%{name}
%dir %{_docdir}/%{name}
%{_docdir}/%{name}/AUTHORS
%{_docdir}/%{name}/COPYING
%{_docdir}/%{name}/DRIVERS
%{_docdir}/%{name}/HELP
%{_docdir}/%{name}/NEWS
%{_docdir}/%{name}/README
%{_docdir}/%{name}/README.DAEMON
%{_docdir}/%{name}/README.SUSE
%{_docdir}/%{name}/README.polkit
%{_docdir}/%{name}/SECURITY
%{_docdir}/%{name}/TODO
%doc %{_mandir}/man?/*.*
%{_sbindir}/*
%dir %{_sysconfdir}/reader.conf.d
%config(noreplace) %{_sysconfdir}/reader.conf.d/reader.conf
%{ifddir}
%if %suse_version > 1140
%_unitdir/*
%endif
%if %suse_version < 1310
%{_initrddir}/pcscd
%endif
/var/adm/fillup-templates/sysconfig.pcscd
# libpcsclite.so should stay in the main package (#732911). Third party packages may need it for dlopen().
%{_libdir}/libpcsclite.so
%if %suse_version > 1310
%{_datadir}/polkit-1/actions/org.debian.pcsc-lite.policy
%endif
%files -n libpcsclite1
%defattr(-,root,root)
%{_libdir}/libpcsclite.so.*
%files -n libpcscspy0
%defattr(-,root,root)
%{_libdir}/libpcscspy.so.*
%files devel
%defattr(-,root,root)
%docdir %{_docdir}/%{name}
%dir %{_docdir}/%{name}
%{_docdir}/%{name}/Change*
%{_includedir}/*
%{_libdir}/*.*a
%{_libdir}/pkgconfig/*.pc
%{_libdir}/*.so
%{_bindir}/*
# libpcsclite.so should stay in the main package (#732911). Third party packages may need it for dlopen().
%exclude %{_libdir}/libpcsclite.so
%changelog