File p11-kit.spec of Package p11-kit

#
# spec file for package p11-kit
#
# 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/
#


%define pkidir_cfg     %{_sysconfdir}/pki
%define pkidir_static  %{_datadir}/pki
%define trustdir_cfg     %{pkidir_cfg}/trust
%define trustdir_static  %{pkidir_static}/trust

Name:           p11-kit
Version:        0.20.3
Release:        0
Summary:        Library to work with PKCS#11 modules
License:        BSD-3-Clause
Group:          Development/Libraries/C and C++
Url:            http://p11-glue.freedesktop.org/p11-kit.html
Source0:        http://p11-glue.freedesktop.org/releases/%{name}-%{version}.tar.gz
Source1:        http://p11-glue.freedesktop.org/releases/%{name}-%{version}.tar.gz.sig
Source98:       p11-kit.keyring
Source99:       baselibs.conf
# patch proposed upstream. If it gets rejected, need to implement
# this in ca-certificates.
Patch0:         0001-trust-allow-to-also-add-openssl-style-hashes-to-pem-d.diff
# PATCH-FIX-OPENSUSE
# trust-Print-label-of-certificate-when-complaining-.patch bnc#890908 lnussel@suse.de
Patch1:         trust-Print-label-of-certificate-when-complaining-.patch
# PATCH-FIX-OPENSUSE
# trust-Dont-use-invalid-public-keys-for-looking-up-.patch bnc#890908 lnussel@suse.de
Patch2:         trust-Dont-use-invalid-public-keys-for-looking-up-.patch
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  libtool
BuildRequires:  pkg-config
BuildRequires:  pkgconfig(libffi) >= 3.0.0
BuildRequires:  pkgconfig(libtasn1) >= 2.3
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
p11-kit provides a way to load and enumerate PKCS#11 modules, as well
as a standard configuration setup for installing PKCS#11 modules in
such a way that they're discoverable.

%package -n libp11-kit0
Summary:        Library to work with PKCS#11 modules
Group:          System/Libraries

%description -n libp11-kit0
p11-kit provides a way to load and enumerate PKCS#11 modules, as well
as a standard configuration setup for installing PKCS#11 modules in
such a way that they're discoverable.

%package tools
Summary:        Library to work with PKCS#11 modules -- Tools
Group:          Development/Libraries/C and C++

%description tools
p11-kit provides a way to load and enumerate PKCS#11 modules, as well
as a standard configuration setup for installing PKCS#11 modules in
such a way that they're discoverable.

%package devel
Summary:        Library to work with PKCS#11 modules -- Development Files
Group:          Development/Libraries/C and C++
Requires:       libp11-kit0 = %{version}

%description devel
p11-kit provides a way to load and enumerate PKCS#11 modules, as well
as a standard configuration setup for installing PKCS#11 modules in
such a way that they're discoverable.

%package nss-trust
Summary:        Adaptor to make NSS read the p11-kit trust store
Group:          Productivity/Networking/Security
Requires:       p11-kit = %{version}
Conflicts:      mozilla-nss-certs
%if %{_lib} == lib64
Provides:       libnssckbi.so()(64bit)
%else
Provides:       libnssckbi.so
%endif

%description nss-trust
Adaptor library to make NSS read the p11-kit trust store. It has
to be installed intead of mozilla-nss-certs.

%prep
%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1

%build
# just because of patch0
autoreconf -f -i
%configure %--with-trust-paths=%{trustdir_cfg}:%{trustdir_static}
make %{?_smp_mflags} -C trust asn
make %{?_smp_mflags}

%install
%make_install
#
install -d m 755 %{buildroot}%{trustdir_cfg}/{anchors,blacklist}
install -d m 755 %{buildroot}%{trustdir_static}/{anchors,blacklist}
# Create pkcs11 config directory
test ! -e %{buildroot}%{_sysconfdir}/pkcs11/modules
install -d %{buildroot}%{_sysconfdir}/pkcs11/modules
# Remove sample config away to doc folder. Having the sample there would conflict
# with future versions of the library on file level. As replacement, we package
# the file as documentation file.
rm %{buildroot}%{_sysconfdir}/pkcs11/pkcs11.conf.example
find %{buildroot}%{_libdir} -name '*.la' -type f -delete -print
#
install -d -m 755 %{buildroot}/etc/rpm/
cat <<'FIN' >%{buildroot}/etc/rpm/macros.%{name}
# Macros from %{name} package
%%pkidir_cfg             %{pkidir_cfg}
%%pkidir_static          %{pkidir_static}
%%trustdir_cfg           %{trustdir_cfg}
%%trustdir_static        %{trustdir_static}
FIN
#
# nss compat lib
ln -s %{_libdir}/pkcs11/p11-kit-trust.so %{buildroot}%{_libdir}/libnssckbi.so
#
# call update-ca-certificates when trust changes
rm %{buildroot}%{_libdir}/%{name}/trust-extract-compat
ln -s ../../sbin/update-ca-certificates %{buildroot}%{_libdir}/%{name}/p11-kit-extract-trust
export NO_BRP_STALE_LINK_ERROR=yes # *grr*

%clean
rm -rf %{buildroot}

%post -n libp11-kit0 -p /sbin/ldconfig

%postun -n libp11-kit0 -p /sbin/ldconfig

%files
%defattr(-,root,root)
%dir %{_libdir}/pkcs11
%dir %{_datadir}/%{name}
%dir %{_datadir}/%{name}/modules
%dir %{pkidir_cfg}
%dir %{trustdir_cfg}
%dir %{trustdir_cfg}/anchors
%dir %{trustdir_cfg}/blacklist
%dir %{pkidir_static}
%dir %{trustdir_static}
%dir %{trustdir_static}/anchors
%dir %{trustdir_static}/blacklist
%{_datadir}/%{name}/modules/p11-kit-trust.module
%{_libdir}/pkcs11/p11-kit-trust.so
%dir %{_libdir}/%{name}
%{_libdir}/%{name}/p11-kit-extract-trust

%files -n libp11-kit0
%defattr(-,root,root)
# Package the example conf file as documentation. Like this we're sure that we will
# not introduce conflicts with this version of the library and future ones.
%doc p11-kit/pkcs11.conf.example
%doc AUTHORS ChangeLog COPYING NEWS README
%dir %{_sysconfdir}/pkcs11
%dir %{_sysconfdir}/pkcs11/modules/
%{_libdir}/libp11-kit.so.*
%{_libdir}/p11-kit-proxy.so

%files tools
%defattr(-,root,root)
%{_bindir}/p11-kit
%{_bindir}/trust

%files devel
%defattr(-,root,root)
%config /etc/rpm/macros.%{name}
%{_includedir}/p11-kit-1/
%{_libdir}/libp11-kit.so
%{_libdir}/pkgconfig/p11-kit-1.pc
%doc %dir %{_datadir}/gtk-doc
%doc %dir %{_datadir}/gtk-doc/html
%doc %{_datadir}/gtk-doc/html/p11-kit/

%files nss-trust
%defattr(-,root,root)
%{_libdir}/libnssckbi.so

%changelog
openSUSE Build Service is sponsored by