-
-Summary:
-Summary(pl):
+#
+# Conditional build:
+%bcond_with openct # use OpenCT instead of PC/SC for reader access
+#
+Summary: OpenSC library - for accessing SmartCard devices using PC/SC Lite
+Summary(pl.UTF-8): Biblioteka OpenSC - do korzystania z kart procesorowych przy użyciu PC/SC Lite
Name: opensc
-Version: 0.7.0
+Version: 0.12.1
Release: 1
-#License:
-#Group: Daemons
-Source0: http://www.opensc.org/files/%{name}-%{version}.tar.gz
-PreReq: rc-scripts
-Requires: pcsc-lite
+Epoch: 0
+License: LGPL v2.1+
+Group: Applications
+Source0: http://www.opensc-project.org/files/opensc/%{name}-%{version}.tar.gz
+# Source0-md5: 62fe8d3ed1864556c1970d7c23d8d58e
+Source1: %{name}-initramfs-hook
+Source2: %{name}-initramfs-local-bottom
+Source3: %{name}-initramfs-local-top
+Source4: %{name}-initramfs-README
+URL: http://www.opensc-project.org/
+BuildRequires: autoconf >= 2.60
+BuildRequires: automake >= 1:1.10
+BuildRequires: docbook-style-xsl
+BuildRequires: libltdl-devel
+BuildRequires: libtool >= 1:1.4.2-9
+BuildRequires: libxslt-progs
+%{?with_openct:BuildRequires: openct-devel}
+BuildRequires: openldap-devel >= 2.4.6
+BuildRequires: openssl-devel >= 0.9.7d
+%{!?with_openct:BuildRequires: pcsc-lite-devel >= 1.6.0}
+BuildRequires: pkgconfig >= 1:0.9.0
+BuildRequires: readline-devel
+BuildRequires: rpmbuild(macros) >= 1.364
+BuildRequires: zlib-devel
+%{!?with_openct:Requires: pcsc-lite-libs >= 1.6.0}
+Obsoletes: browser-plugin-opensc
+Obsoletes: mozilla-plugin-opensc
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+# datadir is used for config files and (editable) profiles
+%define _datadir /etc
+%define _sysconfdir /etc/opensc
+
%description
-pcscd is the daemon program for PC/SC Lite. It is a resource manager
-that coorinates communications with Smart Card readers and Smart Cards
-that are connected to the system. The purpose of PCSC Lite is to
-provide a Windows(R) SCard interface in a very small form factor for
-communicating to smartcards and readers. PCSC Lite uses the same
-winscard api as used under Windows(R)
-
-%description -l pl
-pcscd jest demonem dla PC/SC Lite. Jest to zarz±dca zasobów,
-koordynuj±cy komunikacjê z czytnikami Smart Card pod³±czonymi do
-systemu. Celem PCSC Lite jest udostêpnienie interfejsu zgodnego z
-Windows(R) SCard s³u¿±cego do komunikacji z czytnikami kart chipowych.
-U¿ywa tego samego API winscard, które jest u¿ywane pod Microsoft[TM]
-Windows(R).
-
-%package libs
-Summary: Libraries
-Summary(pl): Bibloteki
-Group: Libraries
-
-%description libs
-What is a package w/o his libs?
-
-%description libs -l pl
-Bo czym¿e jest pakiet bez swoich bibliotek?
+libopensc is a library for accessing SmartCard devices using PC/SC
+Lite middleware package. It is also the core library of the OpenSC
+project. Basic functionality (e.g. SELECT FILE, READ BINARY) should
+work on any ISO 7816-4 compatible SmartCard. Encryption and decryption
+using private keys on the SmartCard is at the moment possible only
+with PKCS#15 compatible cards, such as the FINEID (Finnish Electronic
+IDentity) card manufactured by Setec.
+
+%description -l pl.UTF-8
+libopensc to biblioteka do korzystania z kart procesorowych przy
+użyciu pakietu warstwy pośredniej PC/SC Lite. Jest to także podstawowa
+biblioteka projektu OpenSC. Podstawowa funkcjonalność (np. SELECT
+FILE, READ BINARY) powinna działać także z dowolną kartą procesorową
+zgodną z ISO-7816-4. Szyfrowanie i odszyfrowywanie przy użyciu
+prywatnych kluczy na karcie na razie jest możliwe tylko przy użyciu
+kart kompatybilnych z PKCS#16, takich jak FINEID (Finnish Electronic
+IDentity) produkowanych przez Setec.
%package devel
-Summary: Development files
-Summary(pl): Pliki dla programistów
+Summary: OpenSC development files
+Summary(pl.UTF-8): Pliki dla programistów używających OpenSC
Group: Development/Tools
-Requires: %{name}-libs = %{version}
+Requires: %{name} = %{epoch}:%{version}-%{release}
+Requires: libltdl-devel
+%{?with_openct:Requires: openct-devel}
+Requires: openssl-devel
+%{!?with_openct:Requires: pcsc-lite-devel >= 1.6.0}
%description devel
-Development files.
+OpenSC development files.
-%description devel -l pl
-Pliki dla programistów.
+%description devel -l pl.UTF-8
+Pliki dla programistów używających OpenSC.
%package static
-Summary: Static libraries
-Summary(pl): Bibloteki statyczne
+Summary: Static OpenSC library
+Summary(pl.UTF-8): Bibloteka statyczna OpenSC
Group: Development/Tools
-Requires: %{name}-devel = %{version}
+Requires: %{name}-devel = %{epoch}:%{version}-%{release}
%description static
-Static PSCS libraries.
+Static OpenSC library.
+
+%description static -l pl.UTF-8
+Biblioteka statyczna OpenSC.
+
+%package initramfs
+Summary: OpenSC support scripts for initramfs-tools
+Summary(pl.UTF-8): Skrypty dla initramfs-tools ze wsparciem dla OpenSC
+Group: Base
+Requires: %{name} = %{version}-%{release}
+Requires: initramfs-tools
-%description static -l pl
-Statyczne biblioteki PCSC.
+%description initramfs
+OpenSC support scripts for initramfs-tools.
+
+%description initramfs -l pl.UTF-8
+Skrypty dla initramfs-tools ze wsparciem dla OpenSC.
%prep
-%setup -q -a1 -a2
+%setup -q
+cp -p %{SOURCE4} README.initramfs
%build
-%configure2_13
-%{__make}
+%{__libtoolize}
+%{__aclocal} -I m4
+%{__autoconf}
+%{__autoheader}
+%{__automake}
+%configure \
+ %{?with_openct:--enable-openct --disable-pcsc} \
+ %{!?with_openct:--enable-pcsc --disable-openct} \
+ --enable-doc \
+ --with-pcsc-provider=%{_libdir}/libpcsclite.so.1
+%{__make}
%install
rm -rf $RPM_BUILD_ROOT
-%{__make} install DESTDIR=$RPM_BUILD_ROOT
+install -d $RPM_BUILD_ROOT%{_datadir}/initramfs-tools/{hooks,scripts/local-{bottom,top}}
+%{__make} install \
+ DESTDIR=$RPM_BUILD_ROOT
+
+install -p %{SOURCE1} $RPM_BUILD_ROOT%{_datadir}/initramfs-tools/hooks/opensc
+install -p %{SOURCE2} $RPM_BUILD_ROOT%{_datadir}/initramfs-tools/scripts/local-bottom/opensc
+install -p %{SOURCE3} $RPM_BUILD_ROOT%{_datadir}/initramfs-tools/scripts/local-top/opensc
+
+# not needed (dlopened by soname)
+%{__rm} $RPM_BUILD_ROOT%{_libdir}/{onepin-opensc-pkcs11,opensc-pkcs11,pkcs11-spy}.la
+
+%{__rm} -r $RPM_BUILD_ROOT%{_docdir}/%{name}
%clean
rm -rf $RPM_BUILD_ROOT
-%post libs -p /sbin/ldconfig
-%postun libs -p /sbin/ldconfig
+%post -p /sbin/ldconfig
+%postun -p /sbin/ldconfig
%files
%defattr(644,root,root,755)
-%doc doc/*
-%doc AUTHORS DRIVERS NEWS HELP README SECURITY
-%config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/reader.conf
-%attr(755,root,root) %{_sbindir}/pcscd
-%attr(755,root,root) %{_bindir}/bundleTool
-%attr(755,root,root) %{_bindir}/formaticc
-%attr(755,root,root) %{_bindir}/installifd
-#%attr(754,root,root) /etc/rc.d/init.d/pcscd
-%{_mandir}/man1/bundleTool.1*
-%{_mandir}/man8/pcscd.8*
-
-%files libs
-%defattr(644,root,root,755)
-%{_libdir}/lib*.so.*
+%doc ChangeLog NEWS README doc/html.out/tools.html
+%attr(755,root,root) %{_bindir}/cardos-tool
+%attr(755,root,root) %{_bindir}/cryptoflex-tool
+%attr(755,root,root) %{_bindir}/eidenv
+%attr(755,root,root) %{_bindir}/netkey-tool
+%attr(755,root,root) %{_bindir}/opensc-explorer
+%attr(755,root,root) %{_bindir}/opensc-tool
+%attr(755,root,root) %{_bindir}/piv-tool
+%attr(755,root,root) %{_bindir}/pkcs11-tool
+%attr(755,root,root) %{_bindir}/pkcs15-crypt
+%attr(755,root,root) %{_bindir}/pkcs15-init
+%attr(755,root,root) %{_bindir}/pkcs15-tool
+%attr(755,root,root) %{_bindir}/westcos-tool
+%attr(755,root,root) %{_libdir}/libopensc.so.*.*.*
+%attr(755,root,root) %ghost %{_libdir}/libopensc.so.3
+# PKCS11 modules
+%attr(755,root,root) %{_libdir}/onepin-opensc-pkcs11.so
+%attr(755,root,root) %{_libdir}/opensc-pkcs11.so
+%attr(755,root,root) %{_libdir}/pkcs11-spy.so
+%dir %{_libdir}/pkcs11
+%attr(755,root,root) %{_libdir}/pkcs11/onepin-opensc-pkcs11.so
+%attr(755,root,root) %{_libdir}/pkcs11/opensc-pkcs11.so
+%attr(755,root,root) %{_libdir}/pkcs11/pkcs11-spy.so
+%dir %{_datadir}/opensc
+%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/opensc.conf
+%config(noreplace) %verify(not md5 mtime size) %{_datadir}/opensc/*.profile
+%{_mandir}/man1/cardos-tool.1*
+%{_mandir}/man1/cryptoflex-tool.1*
+%{_mandir}/man1/eidenv.1*
+%{_mandir}/man1/netkey-tool.1*
+%{_mandir}/man1/opensc-explorer.1*
+%{_mandir}/man1/opensc-tool.1*
+%{_mandir}/man1/piv-tool.1*
+%{_mandir}/man1/pkcs11-tool.1*
+%{_mandir}/man1/pkcs15-crypt.1*
+%{_mandir}/man1/pkcs15-init.1*
+%{_mandir}/man1/pkcs15-tool.1*
+%{_mandir}/man1/westcos-tool.1*
+%{_mandir}/man5/pkcs15-profile.5*
%files devel
%defattr(644,root,root,755)
-%{_libdir}/lib*.so
-%{_libdir}/libpcsc*.la
-%{_includedir}/*
+%attr(755,root,root) %{_libdir}/libopensc.so
+%{_libdir}/libopensc.la
%files static
%defattr(644,root,root,755)
-%{_libdir}/lib*.a
+%{_libdir}/libopensc.a
+
+%files initramfs
+%defattr(644,root,root,755)
+%doc README.initramfs
+%attr(755,root,root) %{_datadir}/initramfs-tools/hooks/opensc
+%attr(755,root,root) %{_datadir}/initramfs-tools/scripts/local-top/opensc
+%attr(755,root,root) %{_datadir}/initramfs-tools/scripts/local-bottom/opensc