File tpm2-tools.spec of Package tpm2-tools

%define realname tpm2-tools
%define realver  5.3
%define srcext   tar.gz

# turn off the generation of debuginfo rpm  (RH9) ??
%global debug_package %{nil}

# Common info
Name:          %{realname}
Version:       %{realver}
Release:       wiz%{?extraver:0.}1%{?dist}
License:       BSD-2-Clause
Group:         Productivity/Security
URL:           https://github.com/tpm2-software/tpm2-tools
Summary:       Trusted Platform Module (TPM2.0) tools

# Install-time parameters
Provides:      tpm2.0-tools = %{version}-%{release}
Obsoletes:     tpm2.0-tools < %{version}-%{release}

# Build-time parameters
BuildRequires: autoconf autoconf-archive >= 2017.03.21 automake libtool
BuildRequires: pkg-config
BuildRequires: pkgconfig(tss2-fapi) >= 3.0.0
BuildRequires: pkgconfig(tss2-esys) >= 3.0.0
BuildRequires: pkgconfig(tss2-tctildr)
BuildRequires: pkgconfig(tss2-mu)
BuildRequires: pkgconfig(tss2-rc)
BuildRequires: pkgconfig(tss2-sys)
BuildRequires: pkgconfig(libcrypto) >= 1.1.0
BuildRequires: pkgconfig(libcurl)
%if 0%{?suse_version}
BuildRequires: pkgconfig(efivar)
%endif
BuildRequires: pkgconfig(bash-completion)
# man pages
#BuildRequires: pandoc
BuildRoot:     %{_tmppath}/%{name}-root
Source:        https://github.com/tpm2-software/tpm2-tools/archive/refs/tags/%{realver}%{?extraver}.%{srcext}#/%{realname}-%{realver}%{?extraver}.%{srcext}

%description
The TPM (Trusted Platform Module) 2.0 tools based on tpm2-tss

%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 docs/LICENSE
%doc docs/AUTHORS.md docs/CHANGELOG.md docs/CONTRIBUTING.md docs/MAINTAINERS.md docs/RELEASE.md docs/README.md
%{_bindir}/*
%dir %{_datadir}/bash-completion/completions
%dir %{_datadir}/bash-completion
%{_datadir}/bash-completion/completions/*
### %doc %{_mandir}/man1/*

%changelog
openSUSE Build Service is sponsored by