File tpm2-abrmd.spec of Package tpm2-abrmd

%define realname tpm2-abrmd
%define realver  2.4.1
%define srcext   tar.gz

%define so_ver   0

# 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-abrmd
Summary:       TPM2 Access Broker & Resource Management Daemon implementing the TCG spec

# Build-time parameters
BuildRequires: autoconf autoconf-archive >= 2017.03.21 automake libtool
BuildRequires: pkg-config
BuildRequires: pkgconfig(gio-unix-2.0)
BuildRequires: pkgconfig(glib-2.0)
BuildRequires: pkgconfig(gobject-2.0)
BuildRequires: pkgconfig(tss2-sys) >= 2.4.0
BuildRequires: pkgconfig(tss2-mu)
BuildRequires: pkgconfig(tss2-tctildr)
BuildRequires: pkgconfig(tss2-rc)
# gdbus-codegen
BuildRequires: glib2-devel
BuildRoot:     %{_tmppath}/%{name}-root
Source:        https://github.com/tpm2-software/tpm2-abrmd/archive/refs/tags/%{realver}%{?extraver}.%{srcext}#/%{realname}-%{realver}%{?extraver}.%{srcext}

%description
This is a system daemon implementing the TPM2 access broker (TAB) & Resource
Manager (RM) spec from the TCG.

%package -n libtss2-tcti-tabrmd-devel
Group:         Development/Languages/C and C++
Summary:       Development files for %{name}

Requires:      libtss2-tcti-tabrmd%{?so_ver} = %{version}-%{release}
Provides:      libtss2-tcti-tabrmd%{?so_ver}-devel = %{version}-%{release}
Provides:      %{name}-devel = %{version}-%{release}

%description -n libtss2-tcti-tabrmd-devel
Headers and libraries required to build software against the
Access Broker & Resource Manager TCTI module.

%package -n libtss2-tcti-tabrmd%{?so_ver}
Group:         System/Libraries
Summary:       TPM 2.0 TCTI module for interaction with the tpm2-abrmd

%description -n libtss2-tcti-tabrmd%{?so_ver}
tcti-tabrmd is a library that abstracts the IPC magic necessary to communicate
with the tpm2-abrmd. Consult the “TSS System Level API and TPM Command
Transmission Interface Specification” for a detailed discussion of the TCTI API.

%prep
%setup -q -n %{realname}-%{realver}%{?extraver}
echo %{realver}%{?extraver} > VERSION
if [ ! -x configure ]; then
    autoreconf --install
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 \
  \
  --with-systemdsystemunitdir=%{_unitdir} \
  --with-systemdpresetdir=%{_presetdir} \
  \
  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 CONTRIBUTING.md MAINTAINERS README.md RELEASE.md
%config %{_sysconfdir}/dbus-1/system.d/%{name}.conf
%{_sbindir}/%{name}
%{_unitdir}/%{name}.service
%{_presetdir}/%{name}.preset
%{_datadir}/dbus-1/system-services/com.intel.tss2.Tabrmd.service
%doc %{_mandir}/man8/tpm2-abrmd.8*

%files -n libtss2-tcti-tabrmd-devel
%defattr(-,root,root)
%dir %{_includedir}/tss2
%{_includedir}/tss2/tss2-tcti-tabrmd.h
%{_libdir}/libtss2-tcti-tabrmd.so
%{_libdir}/pkgconfig/tss2-tcti-tabrmd.pc
%doc %{_mandir}/man3/*
%exclude %{_libdir}/*.la

%files -n libtss2-tcti-tabrmd%{?so_ver}
%{_libdir}/libtss2-tcti-tabrmd.so.%{?so_ver}*
%doc %{_mandir}/man7/tss2-tcti-tabrmd.7*

%post   -n libtss2-tcti-tabrmd%{?so_ver} -p /sbin/ldconfig
%postun -n libtss2-tcti-tabrmd%{?so_ver} -p /sbin/ldconfig

%pre
%{service_add_pre %{name}.service}

%post
%{service_add_post %{name}.service}

%preun
%{service_del_preun %{name}.service}

%postun
%{service_del_postun %{name}.service}

%changelog
openSUSE Build Service is sponsored by