File tss2.spec of Package tss2

#
# spec file for package tss2
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

%{!?__global_ldflags: %global __global_ldflags -Wl,-z,relro}

Name:           tss2
Version:        886
Release:        0
Summary:        IBM's TCG Software Stack (TSS) for TPM 2.0 and related utilities
License:        BSD-2-Clause
Group:          Applications/System	

Url:            https://sourceforge.net/projects/ibmtpm20tss/
Source0:        https://downloads.sourceforge.net/project/ibmtpm20tss/ibmtss%{version}.tar

Patch101:       0001-libtss-add-correct-soname.patch
Patch102:       0002-tssProperties-add-TPM_USE_RESOURCE_MANAGER.patch

BuildRequires:  openssl-devel
Requires:       openssl

%description
TSS2 is a user space Trusted Computing Group's Software Stack (TSS) for
TPM 2.0.  It implements the functionality equivalent to the TCG TSS
working group's ESAPI, SAPI, and TCTI layers (and perhaps more) but with
a hopefully far simpler interface.

It comes with about 80 "TPM tools" that can be used for rapid prototyping,
education and debugging. 

%package devel
Summary:        Development libraries and headers for IBM's TSS 2.0
Group:          Development/Libraries
Requires:       %{name} = %{version}-%{release}

%description devel
Development libraries and headers for IBM's TSS 2.0. You will need this in
order to build TSS 2.0 applications.

%prep
%setup -q -c

%patch101 -p1
%patch102 -p1

%build
# nonstandard variable names are used in place of CFLAGS and LDFLAGS
pushd utils

make -f makefile CCFLAGS="%{optflags} -DTPM_POSIX -DTPM_NUVOTON -DTPM_INTERFACE_TYPE_DEFAULT=\\\"dev\\\" -DTPM_DEVICE_DEFAULT=\\\"/dev/tpms0\\\" -c" LNAFLAGS="%{__global_ldflags}"
popd

%install
# Prefix for namespacing
BIN_PREFIX=tss
mkdir -p %{buildroot}/%{_bindir}
mkdir -p %{buildroot}/%{_libdir}
mkdir -p %{buildroot}/%{_includedir}/%{name}/
#mkdir -p %{buildroot}/%{_mandir}/man1
pushd utils
# Pick out executables and copy with namespacing
for f in *; do
	if [[ -x $f && -f $f && ! $f =~ .*\..* ]]; then
		cp -p $f %{buildroot}/%{_bindir}/${BIN_PREFIX}$f
	fi;
done
cp -p libtss.so %{buildroot}/%{_libdir}/libtss.so.0.0.1
cp -p %{name}/*.h %{buildroot}/%{_includedir}/%{name}/
#cp -p man/man1/tss*.1 %{buildroot}/%{_mandir}/man1/
popd

# Make symbolic links to the shared lib
pushd %{buildroot}/%{_libdir}
rm -f libtss.so.0
ln -sf libtss.so.0.0.1 libtss.so.0
rm -f libtss.so
ln -sf libtss.so.0.0.1 libtss.so
popd

%post -p /sbin/ldconfig 
%postun -p /sbin/ldconfig

%files
%doc LICENSE
%{_bindir}/tss*
%{_libdir}/libtss.so.0
%{_libdir}/libtss.so.0.*
#%attr(0644, root, root) %{_mandir}/man1/tss*.1*

%files devel
%{_includedir}/%{name}
%{_libdir}/libtss.so
%doc ibmtss.doc

%changelog
openSUSE Build Service is sponsored by