Name:         trousers
Version:      0.3.13
Release:      12
Summary:      The open-source TCG Software Stack
License:      BSD
Url:          http://trousers.sourceforge.net
Source0:      http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz
#Acknowledge Source1 from Fedora.
Source1:      tcsd.service
#Acknowledge Patch1 & Patch2 from Fedora.
Patch0001:    trousers-0.3.13-noinline.patch
Patch0002:    trousers-openssl1.1.patch

Patch9000:    Fixed-incorrect-check-of-the-result-of-getpeername-2.patch
Patch9001:    Fixed-the-wrong-type-used-while-comparing-IPv4-addre.patch
Patch9002:    Fixed-the-wrong-type-used-while-comparing-IPv6-addre.patch
Patch9003:    Fixed-failure-to-recognise-connections-from-localhos.patch
Patch9004:    Removed-misguided-attempt-to-free-memory-in-Tspi_Con.patch
Patch9005:    Fixed-possible-double-free-when-freeing-context-memo.patch
Patch9006:    PATCH-Fix-memory-leak-in-Tspi_Context_Connect.patch
Patch9007:    PATCH-Fix-more-memory-leaks-in-Tspi_Context_Connect.patch
Patch9008:    PATCH-Fix-uninitialized-memory-error.patch

BuildRequires:    libtool openssl-devel systemd
Requires:         shadow-utils systemd-units

Provides:         trousers-lib
Obsoletes:        trousers-lib
%description
Trousers is an Trusted Computing Software Stack. By using trousers you
can develop applications based on the Trusted Platform Module(TPM). The
TPM enables more secure storage. It provides hardware-based protection
of data because the private key used to protect the data is never exposed
in the clear outside of the TPM's own internal memory area.

%package devel
Summary: Trousers header files, documentation and trousers tCG device driver library
Requires: %{name} = %{version}-%{release}

Provides:  trousers-static
Obsoletes: trousers-static

%description devel
Includes header files, static library and other development files using trousers.

%package help
Summary:   Documents for trousers

%description help
Man pages and other related documents.





%prep
%autosetup -n %{name}-%{version} -p1


%build
%configure --with-gui=openssl
%make_build -k

%install
mkdir -p %{buildroot}/%{_localstatedir}/lib/tpm
%make_install
rm -f %{buildroot}/%{_libdir}/libtspi.la
mkdir -p %{buildroot}%{_unitdir}
install -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}/

%pre

%post
%systemd_post tcsd.service
/sbin/ldconfig

%preun
%systemd_preun tcsd.service

%postun
%systemd_postun_with_restart tcsd.service
/sbin/ldconfig

%files
%doc README ChangeLog
%license LICENSE
%{_sbindir}/tcsd
%config(noreplace) %attr(0600, tss, tss) %{_sysconfdir}/tcsd.conf
%attr(0644,root,root) %{_unitdir}/tcsd.service
%attr(0700, tss, tss) %{_localstatedir}/lib/tpm/
%{_libdir}/libtspi.so.*

%files devel
%doc doc/LTC-TSS_LLD_08_r2.pdf doc/TSS_programming_SNAFUs.txt
%attr(0755, root, root) %{_libdir}/libtspi.so
%{_includedir}/tss/
%{_includedir}/trousers/
%{_libdir}/libtddl.a

%files help
%{_mandir}/man3/Tspi_*
%{_mandir}/man5/*
%{_mandir}/man8/*





%changelog
* Wed Sep 4 2019 Zaiwang Li<lizaiwang1@huawei.com> - 0.3.13-12
- Init package
