%define		build_compat32 %{?_with_compat32:1}%{!?_with_compat32:0}

%define         pkg_version 0.23.20
%define         pkg_release 1%{?_dist_release}

Name:           p11-kit
Version:        %{pkg_version}
Release:        %{pkg_release}
Summary:        Provides a way to load and enumerate PKCS#11 modules
Group:          System Environment/Libraries

License:        LGPLv2+
URL:            https://p11-glue.github.io/p11-glue/p11-kit.html
Source0:        https://github.com/p11-glue/p11-kit/releases/download/%{version}/%{name}-%{version}.tar.xz

BuildRoot:      %{_tmppath}/%{name}-%{version}-root

BuildRequires:	libtasn1-devel
BuildRequires:	libffi-devel
BuildRequires:	ca-certificates

Requires:		ca-certificates


Vendor:		Project Vine
Distribution:	Vine Linux

%description
Provides a way to load and enumerate PKCS#11 modules. Provides a standard
configuration setup for installing PKCS#11 modules in such a way that
they're discoverable.

Also solves problems with coordinating the use of PKCS#11 by different
components or libraries living in the same process.


%package	devel
Summary:        Development tools for p11-kit
Summary(ja):    p11-kit の開発環境
Group:          Development/Libraries
Requires:       %{name} = %{version}-%{release}
Requires:       pkgconfig

%description devel
Header files and libraries for building a extension library for the
p11-kit.


%package        docs
Summary:        Documentation for p11-kit
Summary(ja):    p11-kit 用のドキュメント
Group:          Documentation
Requires:       %{name} = %{version}-%{release}
BuildArch:      noarch

%description    docs
This package contains documentation for p11-kit.


# compat32
%package -n compat32-%{name}
Summary:        Provides a way to load and enumerate PKCS#11 modules
Group:          System Environment/Libraries
Requires:	%{name} = %{version}-%{release}

%description -n compat32-%{name}
Provides a way to load and enumerate PKCS#11 modules. Provides a standard
configuration setup for installing PKCS#11 modules in such a way that
they're discoverable.

Also solves problems with coordinating the use of PKCS#11 by different
components or libraries living in the same process.

%package -n compat32-%{name}-devel
Summary:        Development tools for p11-kit
Summary(ja):    p11-kit の開発環境
Group:          Development/Libraries
Requires:       compat32-%{name} = %{version}-%{release}
Requires:	%{name}-devel = %{version}-%{release}
Requires:       pkgconfig

%description -n compat32-%{name}-devel
Header files and libraries for building a extension library for the
p11-kit.


%prep
%setup -q

%build
%configure \
	--disable-static \

make V=0

%install
rm -rf $RPM_BUILD_ROOT
make DESTDIR=$RPM_BUILD_ROOT install INSTALL="%{__install} -p -c"

find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} \;

%clean
rm -rf $RPM_BUILD_ROOT

%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig

%post -n compat32-%{name} -p /sbin/ldconfig
%postun -n compat32-%{name} -p /sbin/ldconfig

%files
%defattr(-,root,root,-)
%license COPYING
%doc ChangeLog AUTHORS NEWS README*
%{_sysconfdir}/pkcs11/pkcs11.conf.example
%{_bindir}/p11-kit
%{_bindir}/trust
%{_libdir}/libp11-kit.so.*
%{_libdir}/p11-kit-proxy.so
%{_libdir}/pkcs11/p11-kit-trust.so
%{_libdir}/pkcs11/p11-kit-client.so
%{_libexecdir}/p11-kit/p11-kit-remote
%{_libexecdir}/p11-kit/p11-kit-server
%{_libexecdir}/p11-kit/trust-extract-compat
%{_datadir}/%{name}

%files devel
%defattr(-, root, root,-)
%{_includedir}/p11-kit-1
%{_libdir}/libp11-kit.so
%{_libdir}/pkgconfig/p11-kit-1.pc

%files docs
%defattr(-, root, root,-)
%{_datadir}/gtk-doc/html/p11-kit

# compat32
%if %{build_compat32}
%files -n compat32-%{name}
%defattr(-, root, root)
%{_libdir}/lib*.so.*

%files -n compat32-%{name}-devel
%defattr(-, root, root)
%{_libdir}/lib*.so
%endif


%changelog
* Thu Mar 26 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 0.23.20-1
- new upstream release.

* Sat Oct 31 2015 Yoji TOYODA <bsyamato@sea.plala.or.jp> 0.23.1-1
- new upstream release

* Sun Oct 26 2014 Yoji TOYODA <bsyamato@sea.plala.or.jp> 0.22.1-1
- new upstream release

* Sun Sep 07 2014 Yoji TOYODA <bsyamato@sea.plala.or.jp> 0.20.5-1
- new upstream release

* Sun Jul 06 2014 Yoji TOYODA <bsyamato@sea.plala.or.jp> 0.20.3-1
- new upstream release

* Sat Mar 29 2014 Yoji TOYODA <bsyamato@sea.plala.or.jp> 0.20.2-1
- new upstream release

* Tue Dec 31 2013 Yoji TOYODA <bsyamato@sea.plala.or.jp> 0.20.1-2
- rebuild with VineSeed environment

* Sat Oct 26 2013 Yoji TOYODA <bsyamato@sea.plala.or.jp> 0.20.1-1
- new upstream release
- add BuildRequires: libffi-devel

* Wed Apr 17 2013 Yoji TOYODA <bsyamato@sea.plala.or.jp> 0.18.1-1
- new upstream release
- add BuildRequires: libtasn1-devel, ca-certificates
- add Requires: ca-certificates

* Fri Sep 28 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 0.14-1
- new upstream release

* Fri Mar 16 2012 Toshiharu Kudoh <toshi.kd2@gmail.com> 0.12-1
- new upstream release

* Fri Sep 23 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> 0.6-1
- new upstream release
- create compat32 sub packages

* Sun Aug 14 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> 0.3-1
- initial build for Vine Linux

