softhsm/softhsm.spec
2019-12-25 17:20:16 +08:00

104 lines
3.0 KiB
RPMSpec

Name: softhsm
Version: 2.5.0
Release: 2
Summary: Software version of a PKCS#11 Hardware Security Module
License: BSD
URL: http://www.opendnssec.org/
Source: http://dist.opendnssec.org/source/%{name}-%{version}.tar.gz
Source1: http://dist.opendnssec.org/source/%{name}-%{version}.tar.gz.sig
BuildRequires: openssl-devel >= 1.0.1k-6, sqlite-devel >= 3.4.2, cppunit-devel
BuildRequires: gcc-c++, pkgconfig, p11-kit-devel, nss-devel
Requires: shadow-utils, p11-kit, nss-tools, openssl-libs >= 1.0.1k-6
%description
OpenDNSSEC is providing a software implementation of a generic
cryptographic device with a PKCS#11 interface, the SoftHSM. SoftHSM is
designed to meet the requirements of OpenDNSSEC, but can also work together
with other cryptographic products because of the PKCS#11 interface.
%package devel
Summary: Development package of softhsm that includes the header files
Requires: %{name} = %{version}-%{release}, openssl-devel, sqlite-devel
BuildRequires: autoconf, libtool, automake
%description devel
The devel package contains the libsofthsm include files
%package_help
%prep
%autosetup -n %{name}-%{version}
sed -i "s:full_libdir/softhsm:full_libdir:g" configure
sed -i 's:^full_libdir=":#full_libdir=":g' configure.ac
sed -i "s:libdir)/@PACKAGE@:libdir):" Makefile.in
%build
%configure --libdir=%{_libdir}/pkcs11 --with-openssl=%{_prefix} --enable-ecc --disable-gost \
--with-migrate --enable-visibility --with-p11-kit=%{_datadir}/p11-kit/modules/
make %{?_smp_mflags}
%check
%install
rm -rf %{buildroot}
make DESTDIR=%{buildroot} install
mkdir -p %{buildroot}%{_includedir}/softhsm
cp src/lib/*.h %{buildroot}%{_includedir}/softhsm
mkdir -p %{buildroot}/%{_sharedstatedir}/softhsm/tokens
mkdir -p %{buildroot}/%{_libdir}/softhsm/
cd %{buildroot}/%{_libdir}
ln -sf ./pkcs11/libsofthsm2.so ./softhsm/libsofthsm.so
ln -sf ./pkcs11/libsofthsm2.so %{buildroot}/%{_libdir}/libsofthsm2.so
rm %{buildroot}/%{_sysconfdir}/softhsm2.conf.sample
rm -f %{buildroot}/%{_libdir}/pkcs11/*a
%files
%config(noreplace) %{_sysconfdir}/softhsm2.conf
%{_bindir}/*
%dir %{_libdir}/softhsm
%{_libdir}/softhsm/libsofthsm.so
%{_libdir}/pkcs11/libsofthsm2.so
%{_libdir}/libsofthsm2.so
%attr(0664,root,root) %{_datadir}/p11-kit/modules/softhsm2.module
%attr(0750,ods,ods) %dir %{_sharedstatedir}/softhsm
%attr(1770,ods,ods) %dir %{_sharedstatedir}/softhsm/tokens
%doc LICENSE README.md NEWS
%files devel
%attr(0755,root,root) %dir %{_includedir}/softhsm
%{_includedir}/softhsm/*.h
%files help
%{_mandir}/*/*
%pre
getent group ods >/dev/null || groupadd -r ods
getent passwd ods >/dev/null || \
useradd -r -g ods -d %{_sharedstatedir}/softhsm -s /sbin/nologin \
-c "softhsm private keys owner" ods
exit 0
%post
%triggerpostun -- softhsm < 2.0.0
if [ -f /var/softhsm/slot0.db ]; then
runuser -g ods ods -c 'softhsm2-migrate --db /var/softhsm/slot0.db --pin 1234 --slot 0' || :
fi
%changelog
* Tue Dec 24 2019 openEuler Buildteam <buildteam@openeuler.org> 2.5.0-2
- Spec format
* Tue Sep 3 2019 openEuler Buildteam <buildteam@openeuler.org> 2.5.0-1
- Package init