File mbedtls.spec of Package mbedtls

#
# spec file for package mbedtls
#
# 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://bugs.opensuse.org/
#


%define lib_name lib%{name}9
Name:           mbedtls
Version:        1.3.17
Release:        0
Summary:        Open Source embedded SSL/TLS cryptographic library
License:        GPL-2.0+
Group:          Development/Libraries/C and C++
Url:            https://tls.mbed.org
Source:         https://tls.mbed.org/download/%{name}-%{version}-gpl.tgz
Source99:       baselibs.conf
BuildRequires:  cmake
BuildRequires:  pkgconfig
BuildRequires:  zlib-devel
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
A portable, easy to use, readable and flexible SSL library.

%package -n %{lib_name}
Summary:        Open Source embedded SSL/TLS cryptographic library
Group:          System/Libraries

%description -n %{lib_name}
A portable, easy to use, readable and flexible SSL library.

%package devel
Summary:        Open Source embedded SSL/TLS cryptographic library
Group:          Development/Libraries/C and C++
Requires:       %{lib_name} = %{version}-%{release}
Provides:       libpolarssl-devel = %{version}
Obsoletes:      libpolarssl-devel < %{version}
Provides:       polarssl-devel = %{version}
Obsoletes:      polarssl-devel < %{version}

%description devel
A portable, easy to use, readable and flexible SSL library.

%prep
%setup -q
sed -i 's|//\(#define POLARSSL_THREADING_C\)|\1|' include/polarssl/config.h
sed -i 's|//\(#define POLARSSL_THREADING_PTHREAD\)|\1|' include/polarssl/config.h

%build
%cmake \
  -DUSE_SHARED_MBEDTLS_LIBRARY=ON \
  -DUSE_STATIC_MBEDTLS_LIBRARY=OFF \
  -DENABLE_ZLIB_SUPPORT=ON \
  -DENABLE_PROGRAMS=OFF
make VERBOSE=1 %{?_smp_mflags}

%install
%cmake_install
# create compatibility symlink
ln -s %{_libdir}/libmbedtls.so %{buildroot}%{_libdir}/libpolarssl.so

%check
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:%{_builddir}/%{name}-%{version}/build/library
make -C build test %{?_smp_mflags}

%post -n %{lib_name} -p /sbin/ldconfig
%postun -n %{lib_name}  -p /sbin/ldconfig

%files devel
%defattr(-,root,root)
%dir %{_includedir}/polarssl
%{_includedir}/polarssl/*.h
%{_libdir}/libmbedtls.so
%{_libdir}/libpolarssl.so

%files -n %{lib_name}
%defattr(-,root,root)
%doc ChangeLog README.rst LICENSE
%{_libdir}/libmbedtls.so.*

%changelog
openSUSE Build Service is sponsored by