LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File mbedtls.spec of Package mbedtls (Project home:aevseev)

%define realname mbedtls
%define realver  2.8.0
%define extraver -apache
%define srcext   tgz

%define crypto_so_ver  1
%define tls_so_ver    10
%define x509_so_ver    0

# Common info
Name:          %{realname}
Version:       %{realver}
Release:       wiz%{?extraver:0.}1%{?dist}
License:       Apache-2.0
Group:         Productivity/Networking/Security
URL:           https://tls.mbed.org/
Summary:       Implementation of Secure Sockets Layer (SSL) protocol

BuildRequires: cmake pkgconfig
BuildRequires: zlib-devel
%if 0%{?suse_version}
BuildRequires: pkcs11-helper-devel
%endif
BuildRoot:     %{_tmppath}/%{name}-root
Source:        https://tls.mbed.org/download/%{realname}-%{realver}%{?extraver}.%{srcext}

%description
mbed TLS (formerly known as PolarSSL) makes it trivially easy for developers to
include cryptographic and SSL/TLS capabilities in their (embedded) products,
facilitating this functionality with a minimal coding footprint.

%package -n libmbedtls%{tls_so_ver}
Group:         System/Libraries
Summary:       Implementation of Secure Sockets Layer (SSL) protocol

# Install-time parameters
Provides:      libmbedcrypto%{crypto_so_ver} = %{version}-%{release}
Provides:      libmbedcrypto = %{version}-%{release}
Provides:      libmbedtls = %{version}-%{release}
Provides:      libmbedx509%{x509_so_ver} = %{version}-%{release}
Provides:      libmbedx509 = %{version}-%{release}

%description -n libmbedtls%{tls_so_ver}
mbed TLS (formerly known as PolarSSL) makes it trivially easy for developers to
include cryptographic and SSL/TLS capabilities in their (embedded) products,
facilitating this functionality with a minimal coding footprint.

%package devel
Group:         Development/Languages/C and C++
Summary:       Development files for %{name}
Requires:      libmbedtls%{tls_so_ver} = %{version}-%{release}
Provides:      libmbedtls-devel = %{version}-%{release}
Provides:      libmbedtls%{tls_so_ver}-devel = %{version}-%{release}
Provides:      libmbedcrypto-devel = %{version}-%{release}
Provides:      libmbedx509-devel = %{version}-%{release}
Obsoletes:     libmbedtls-devel < %{version}-%{release}

%description devel
Development files for %{name}

# Preparation step (unpackung and patching if necessary)
%prep
%setup -q -n %{realname}-%{realver}

%build
mkdir build
cd build
cmake .. \
 -DCMAKE_INSTALL_PREFIX=%{_prefix} \
 -DCMAKE_BUILD_TYPE=Release \
 -DCMAKE_C_FLAGS_RELEASE="%{optflags} %{?gcc_lto}" \
 -DCMAKE_EXE_LINKER_FLAGS_RELEASE="-Wl,--as-needed -Wl,--strip-all %{?gcc_lto}" \
 -DCMAKE_MODULE_LINKER_FLAGS_RELEASE="-Wl,--as-needed -Wl,--strip-all %{?gcc_lto}" \
 -DCMAKE_SHARED_LINKER_FLAGS_RELEASE="-Wl,--as-needed -Wl,--strip-all %{?gcc_lto} -shared" \
 -DCMAKE_SKIP_RPATH=YES \
 -DCMAKE_VERBOSE_MAKEFILE=YES \
 \
 -DLIB_INSTALL_DIR=%{_lib} \
 -DENABLE_ZLIB_SUPPORT=ON \
%if 0%{?suse_version}
 -DUSE_PKCS11_HELPER_LIBRARY=ON \
%endif
 -DUSE_STATIC_MBEDTLS_LIBRARY=OFF \
 -DUSE_SHARED_MBEDTLS_LIBRARY=ON
%{__make} %{?_smp_mflags}

%install
%{__make} -C build install DESTDIR=%{buildroot}

%clean
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}

%files
%defattr(-,root,root)
%doc LICENSE README.md apache-2.0.txt
%{_bindir}/*

%files -n libmbedtls%{tls_so_ver}
%defattr(-,root,root)
%doc LICENSE README.md apache-2.0.txt
%{_libdir}/libmbedcrypto.so.%{crypto_so_ver}*
%{_libdir}/libmbedtls.so.%{tls_so_ver}*
%{_libdir}/libmbedx509.so.%{x509_so_ver}*
%{_libdir}/*.so.%{version}

# Development stuff
%files devel
%defattr(-,root,root)
%{_includedir}/%{realname}
%{_libdir}/*.so

%post   -n libmbedtls%{tls_so_ver} -p /sbin/ldconfig
%postun -n libmbedtls%{tls_so_ver} -p /sbin/ldconfig

%changelog