File libica2.spec of Package libica2

#
# spec file for package libica2
#
# Copyright (c) 2016 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://bugzilla.suse.com/
#


Name:           libica2
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  gcc-c++
BuildRequires:  libtool
BuildRequires:  openssl-devel
Summary:        An Interface Library for the ICA Device Driver
License:        CPL-1.0
Group:          Hardware/Other
Version:        2.6.2
Release:        0
Source:         libica-%{version}.tgz
Source1:        libica-SuSE.tar.bz2
# The icaioctl.h file came from https://sourceforge.net/p/opencryptoki/icadd/ci/master/tree/
Source3:        icaioctl.h
Source4:        README.SUSE
Source5:        sysconfig.z90crypt
Source6:        baselibs.conf
Patch1:         fix-initialization-of-s390-hardware-switches-1.patch
Patch2:         fix-initialization-of-s390-hardware-switches-2.patch
Patch3:         rng-performance.patch
Url:            http://sourceforge.net/projects/opencryptoki/files/libica
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
PreReq:         %fillup_prereq %insserv_prereq
ExclusiveArch:  s390 s390x
Obsoletes:      libica < %{version}
Provides:       libica = %{version}
Obsoletes:      libica-2_1_0 < %{version}
Provides:       libica-2_1_0 = %{version}
Obsoletes:      libica-2_3_0 < %{version}
Provides:       libica-2_3_0 = %{version}

%description
This package contains the interface library routines used by IBM
modules to interface with the IBM eServer Cryptographic Accelerator
(ICA).


%package        devel
Summary:        SDK for libica
Group:          Development/Libraries
Obsoletes:      libica-2_1_0-devel < %{version}
Provides:       libica-2_1_0-devel = %{version}
Obsoletes:      libica-2_3_0-devel < %{version}
Provides:       libica-2_3_0-devel = %{version}
Obsoletes:      libica-devel < %{version}
Provides:       libica-devel = %{version}
Requires:       libica2
Requires:       libopenssl-devel

%description devel
This package contains the interface library routines used by IBM
modules to interface with the IBM eServer Cryptographic Accelerator
(ICA).

This RPM contains all the tools necessary to compile and link using
the libica library.


%prep
%setup -n libica-%{version}
%setup -n libica-%{version} -T -D -a 1
%patch1 -p1
%patch2 -p1
%patch3 -p1

%build
mkdir -p include/linux/
cp %{S:3} include/linux/

autoreconf --force --install
export CFLAGS="$RPM_OPT_FLAGS -I./include -fPIC"
export CPPFLAGS="$RPM_OPT_FLAGS -I./include -fPIC"
%configure
unset CFLAGS
unset CPPFLAGS
make clean
make

%install
mkdir -p $RPM_BUILD_ROOT/usr/include
make DESTDIR=$RPM_BUILD_ROOT install
cp -p include/ica_api.h $RPM_BUILD_ROOT/usr/include
%ifarch s390 s390x
cp -a SuSE/* $RPM_BUILD_ROOT
install -D %{S:5} $RPM_BUILD_ROOT/var/adm/fillup-templates/sysconfig.z90crypt
%endif
cp -a $RPM_SOURCE_DIR/README.SUSE .
rm -f $RPM_BUILD_ROOT/%{_libdir}/libica.la

%post
/sbin/ldconfig
%ifarch s390 s390x
%{fillup_and_insserv -n boot.z90crypt}
%endif

%preun
%stop_on_removal boot.z90crypt

%postun
/sbin/ldconfig
%restart_on_update boot.z90crypt
%{insserv_cleanup}

%files
%defattr(-, root, root)
%doc README.SUSE
%doc COPYING
%doc LICENSE
%ifarch s390 s390x
/etc/init.d/boot.z90crypt
/usr/sbin/rcz90crypt
%attr(0644,root,root) /var/adm/fillup-templates/sysconfig.z90crypt
%{_bindir}/icainfo
%{_bindir}/icastats
%{_mandir}/man1/icainfo.1.gz
%{_mandir}/man1/icastats.1.gz
%endif
%{_libdir}/libica.so.2*
# Must be in here, otherwise openssl-ibmca does not find it via DSO_load() bsc#952871
%{_libdir}/libica.so

%files devel
%defattr(-, root, root)
%{_libdir}/libica.a
%attr(0644,root,root) /usr/include/ica_api.h

%changelog
openSUSE Build Service is sponsored by