# The naming scheme in non-Mandriva-based distros %if 0%{!?mklibname:1} %define mklibname(ds) lib%{1}%{?2:%{2}}%{-s:-static}%{-d:-devel} %endif %if 0%{!?mkrel:1} %define mkrel(c) %{1}%{?dist} %endif %define major 14 %define x509major 1 %define cryptomajor 7 %define libname %mklibname %{name} %{major} %define libx509 %mklibname mbedx509_ %{x509major} %define libcrypto %mklibname mbedcrypto %{cryptomajor} %define libeverest %mklibname everest %define develname %mklibname %{name} -d Name: mbedtls # Please stay on LTS branch 2.28.x: # https://www.trustedfirmware.org/blog/MBed-TLS_1-3/ Version: 2.28.10 Release: %mkrel 1 Summary: Light-weight cryptographic and SSL/TLS library Group: System/Libraries License: ASL 2.0 URL: https://www.trustedfirmware.org/projects/mbed-tls/ Source0: https://github.com/Mbed-TLS/mbedtls/releases/download/v%{version}/%{name}-%{version}.tar.bz2 BuildRequires: gcc BuildRequires: cmake # Support for pkcs11-helper and zlib were removed in mbedtls v3 BuildRequires: pkgconfig(libpkcs11-helper-1) BuildRequires: pkgconfig(zlib) BuildRequires: perl(open) %description mbed TLS (formerly known as PolarSSL) is an SSL library written in ANSI C. mbed TLS makes it easy for developers to include cryptographic and SSL/TLS capabilities in their (embedded) products with as little hassle as possible. It is designed to be readable, documented, tested, loosely coupled and portable. This package contains mbed TLS programs. %package -n %{libname} Summary: mbed TLS library Group: System/Libraries %description -n %{libname} mbed TLS (formerly known as PolarSSL) is an SSL library written in ANSI C. mbed TLS makes it easy for developers to include cryptographic and SSL/TLS capabilities in their (embedded) products with as little hassle as possible. It is designed to be readable, documented, tested, loosely coupled and portable. This package contains the library itself. %package -n %{libx509} Summary: mbed TLS X509 library Group: System/Libraries %description -n %{libx509} mbed TLS (formerly known as PolarSSL) is an SSL library written in ANSI C. mbed TLS makes it easy for developers to include cryptographic and SSL/TLS capabilities in their (embedded) products with as little hassle as possible. It is designed to be readable, documented, tested, loosely coupled and portable. This package contains mbed X509 library. %package -n %{libcrypto} Summary: mbed crypto library Group: System/Libraries %description -n %{libcrypto} mbed TLS (formerly known as PolarSSL) is an SSL library written in ANSI C. mbed TLS makes it easy for developers to include cryptographic and SSL/TLS capabilities in their (embedded) products with as little hassle as possible. It is designed to be readable, documented, tested, loosely coupled and portable. This package contains mbed mbedcrypto library. %package -n %{libeverest} Summary: mbed everest library Group: System/Libraries %description -n %{libeverest} mbed TLS (formerly known as PolarSSL) is an SSL library written in ANSI C. mbed TLS makes it easy for developers to include cryptographic and SSL/TLS capabilities in their (embedded) products with as little hassle as possible. It is designed to be readable, documented, tested, loosely coupled and portable. This package contains mbed everest library. %package -n %{develname} Summary: mbed TLS development files Group: Development/C Requires: %{libname} = %{version}-%{release} Requires: %{libx509} = %{version}-%{release} Requires: %{libcrypto} = %{version}-%{release} Provides: %{name}-devel = %{version}-%{release} %description -n %{develname} mbed TLS (formerly known as PolarSSL) is an SSL library written in ANSI C. mbed TLS makes it easy for developers to include cryptographic and SSL/TLS capabilities in their (embedded) products with as little hassle as possible. It is designed to be readable, documented, tested, loosely coupled and portable. This package contains development files. %prep %autosetup -p1 -n %{name}-%{version} # Enable MBEDTLS_THREADING_PTHREAD and MBEDTLS_THREADING_C flags # https://bugs.mageia.org/show_bug.cgi?id=15391#c4 sed -i -e 's|.*\(#define MBEDTLS_THREADING_C\)|\1|' \ -e 's|.*\(#define MBEDTLS_THREADING_PTHREAD\)|\1|' \ include/mbedtls/config.h %build %cmake \ -B build \ -DUSE_SHARED_MBEDTLS_LIBRARY=ON \ -DENABLE_ZLIB_SUPPORT=ON \ -DMBEDTLS_FATAL_WARNINGS=OFF \ -DCMAKE_POLICY_VERSION_MINIMUM=3.5 %make_build -C build %check %if 0%{?mageia} == 9 && 0%{?__python3:1} %make_build check PYTHON=%{__python3} %endif %install %make_install -C build # prevent possible file clashes pushd %{buildroot}%{_bindir} for i in *; do mv ${i} %{name}-${i}; done popd rm -f %{buildroot}%{_libdir}/*.a %files %doc ChangeLog README* %{_bindir}/%{name}-* %files -n %{libname} %license LICENSE %{_libdir}/lib%{name}.so.%{major} %{_libdir}/lib%{name}.so.%{version} %files -n %{libx509} %{_libdir}/libmbedx509.so.%{x509major} %{_libdir}/libmbedx509.so.%{version} %files -n %{libcrypto} %{_libdir}/libmbedcrypto.so.%{cryptomajor} %{_libdir}/libmbedcrypto.so.%{version} %files -n %{develname} %{_includedir}/%{name}/ %{_includedir}/psa/ %{_includedir}/everest/ %{_libdir}/pkgconfig/mbed*.pc %{_libdir}/libmbed*.so