File tpm2-pkcs11.spec of Package tpm2-pkcs11
%define realname tpm2-pkcs11
%define realver 1.7.0
%define srcext tar.gz
%define so_ver 0
# turn off the generation of debuginfo rpm (RH9) ??
%global debug_package %{nil}
# Common info
Name: libtpm2_pkcs11%{?so_ver:_%so_ver}
Version: %{realver}%{?extraver}
Release: wiz%{?extraver:0.}1%{?dist}
License: BSD-2-Clause
Group: Productivity/Security
URL: https://github.com/tpm2-software/tpm2-pkcs11
Summary: A PKCS#11 interface for TPM2 hardware
# Install-time parameters
Provides: %{realname} = %{version}-%{release}
# Build-time parameters
BuildRequires: autoconf autoconf-archive >= 2017.03.21 automake libtool
BuildRequires: pkg-config
BuildRequires: pkgconfig(sqlite3)
BuildRequires: pkgconfig(yaml-0.1)
BuildRequires: pkgconfig(libcrypto) >= 1.1.0
BuildRequires: pkgconfig(tss2-esys) >= 2.0
BuildRequires: pkgconfig(tss2-mu)
BuildRequires: pkgconfig(tss2-tctildr)
BuildRequires: pkgconfig(tss2-rc)
### BuildRequires: python3 >= 3.7
BuildRequires: tpm2-tools
BuildRequires: pkgconfig(p11-kit-1)
BuildRoot: %{_tmppath}/%{name}-root
Source: https://github.com/tpm2-software/tpm2-pkcs11/archive/refs/tags/%{realver}%{?extraver}.%{srcext}#/%{realname}-%{realver}%{?extraver}.%{srcext}
%description
PKCS #11 is a Public-Key Cryptography Standard that defines a standard method to
access cryptographic services from tokens/ devices such as hardware security
modules (HSM), smart cards, etc. In this project we intend to use a TPM2 device
as the cryptographic token.
%package -n %{realname}-devel
Group: Development/Languages/C and C++
Summary: Developent files for %{name}
Requires: %{name} = %{version}-%{release}
Provides: %{name}-devel = %{version}-%{release}
Provides: libtpm2_pkcs11-devel = %{version}-%{release}
%description -n %{realname}-devel
Headers and linraries to build software against %{name}.
%prep
%setup -q -n %{realname}-%{realver}%{?extraver}
echo %{realver}%{?extraver} > VERSION
%{__sed} -ri '/^git /d' bootstrap
if [ ! -x configure ]; then
./bootstrap
fi
%build
_CFLAGS='%{optflags} %{?gcc_lto}'
_LDFLAGS='-Wl,--as-needed -Wl,--strip-all -Wl,--no-undefined -Wl,-z,now -Wl,-z,relro %{?gcc_lto}'
%{configure} \
--disable-static \
--disable-hardening \
\
CFLAGS="$_CFLAGS" \
LDFLAGS="$_LDFLAGS"
%{__make} %{?_smp_mflags}
%install
%{__make} install DESTDIR=%{buildroot}
%clean
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}
%files
%defattr(-,root,root)
%license LICENSE
%doc CHANGELOG.md docs/*
%dir %{_libdir}/pkcs11
%{_libdir}/pkcs11/libtpm2_pkcs11.so
%{_libdir}/pkcs11/libtpm2_pkcs11.so.%{?so_ver}*
%dir %{_datadir}/p11-kit/modules
%dir %{_datadir}/p11-kit
%{_datadir}/p11-kit/modules/tpm2_pkcs11.module
%files -n %{realname}-devel
%defattr(-,root,root)
%{_libdir}/pkgconfig/tpm2-pkcs11.pc
%exclude %{_libdir}/pkcs11/libtpm2_pkcs11.la
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%changelog