%define debug_package %{nil}
%global githubname   ipp-crypto-ippcp_2021.12.1
%global pathcryptomb sources/ippcp/crypto_mb

Name:               intel-ipp-crypto-mb
Summary:            Intel(R) IPP Cryptography multi-buffer library
Release:            1
Version:            2021.12.1
License:            Apache-2.0

URL:                https://github.com/intel/ipp-crypto
Source0:            %{githubname}.tar.gz

ExclusiveArch:      x86_64

BuildRequires:      cmake
BuildRequires:      gcc
BuildRequires:      gcc-c++
BuildRequires:      nasm
BuildRequires:      openssl-devel >= 1.1.1

%description
A software crypto library optimized for Intel architecture for packet
processing applications.
It contains universal and OpenSSL compatible APIs for cryptography operations.

%package devel
Summary:            Intel(R) IPP Cryptography multi-buffer library (Development Files)
Requires:           %{name} = %{version}-%{release}

%description devel
A software crypto library optimized for Intel architecture for packet
processing applications.
It contains development libraries and header files.

%package static
Summary:  Intel(R) IPP Cryptography multi-buffer library (Development Files)
Requires: %{name} = %{version}-%{release}

%description static 
Static file for %{name}.

%package doc
Summary:        Documentation files for %{name}
Requires:       %{name} = %{version}-%{release}
BuildArch:      noarch

%description doc
The %{name}-doc package contains documentation files for %{name}.

%prep
%autosetup -n %{githubname} -p1

%build
cd %{pathcryptomb} && rm -rf build && cmake . -B"build" \
       -DCMAKE_INSTALL_PREFIX=%{_prefix}
cd build && make clean && make -j

%install
cd %{pathcryptomb}/build
%make_install
mkdir -p %{buildroot}/%{_libdir}
mv %{buildroot}/%{_prefix}/lib/*.so* %{buildroot}/%{_libdir}/
mv %{buildroot}/%{_prefix}/lib/*.a %{buildroot}/%{_libdir}/
rm -rf %{buildroot}/%{_prefix}/lib

%files
%license LICENSE
%{_libdir}/libcrypto_mb.so.*

%files devel
%{_libdir}/libcrypto_mb.so
%{_includedir}/crypto_mb/*.h

%files static
%{_libdir}/libcrypto_mb.a

%files doc
%doc README.md
%doc sources/ippcp/crypto_mb/Readme.md

%changelog
* Wed Aug 28 2024 Aichun Shi <aichun.shi@intel.com> - 2021.12.1-1
- Initial Package

