# 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 oversion 4.1.2 %define mbedcryptomajor 18 %define mbedtlsmajor 23 %define mbedx509major 9 %define tfpsacmajor 2 %define libcrypto %mklibname mbedcrypto %{mbedcryptomajor} %define libtfpsac %mklibname tfpsac %{tfpsacmajor} %define libtls %mklibname %{name} %{mbedtlsmajor} %define libx509 %mklibname mbedx509_ %{mbedx509major} %define develname %mklibname %{name} -d %bcond_without check Name: mbedtls # Please stay on LTS branch 4.1.x: # https://www.trustedfirmware.org/blog/tf-m-v2-3-0_lts_etc Version: %{oversion} 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 >= 5.4 or clang >= 3.8) BuildRequires: cmake >= 3.10.2 BuildRequires: make >= 3.82 # Check: %if %{with check} BuildRequires: pkgconfig(python3) >= 3.8 BuildRequires: python3dist(jsonschema) BuildRequires: python3dist(jinja2) BuildRequires: perl BuildRequires: perl(open) %endif # Documentation: BuildRequires: doxygen >= 1.8.11 BuildRequires: python3dist(sphinx) BuildRequires: python3dist(breathe) BuildRequires: graphviz %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 %{libtls} Summary: mbed TLS library Group: System/Libraries %description -n %{libtls} 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 %{libtfpsac} Summary: mbed tfpsa crypto library Group: System/Libraries %description -n %{libtfpsac} 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 tfpsac mbedcrypto library. %package -n %{develname} Summary: mbed TLS development files Group: Development/C Requires: %{libtls} = %{version}-%{release} Requires: %{libx509} = %{version}-%{release} Requires: %{libcrypto} = %{version}-%{release} Provides: %{name}-devel = %{version}-%{release} Provides: pkgconfig(mbedcrypto) Provides: pkgconfig(mbedtls) Provides: pkgconfig(x509) %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 # 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/mbedtls_config.h %build %cmake \ -DUSE_SHARED_MBEDTLS_LIBRARY=ON \ -DUSE_STATIC_MBEDTLS_LIBRARY=OFF \ -DMBEDTLS_FATAL_WARNINGS=OFF %cmake_build %cmake_build --target=mbedtls-apidoc %check %if %{with check} %ifnarch %arm64 %{?ctest} %endif %endif %install %cmake_install # prevent possible file clashes pushd %{buildroot}%{_bindir} for i in *; do mv ${i} %{name}_${i}; done popd %files %doc ChangeLog README* %{_bindir}/%{name}_* %files -n %{libtls} %license LICENSE %{_libdir}/lib%{name}.so.%{mbedtlsmajor} %{_libdir}/lib%{name}.so.%{oversion} %files -n %{libx509} %{_libdir}/libmbedx509.so.%{mbedx509major} %{_libdir}/libmbedx509.so.%{oversion} %files -n %{libcrypto} %{_libdir}/libmbedcrypto.so.%{mbedcryptomajor} %{_libdir}/libmbedcrypto.so.%{oversion} %files -n %{libtfpsac} %{_libdir}/libtfpsacrypto.so.* %files -n %{develname} %{_includedir}/%{name}/ %{_includedir}/psa/ %{_includedir}/tf-psa-crypto/ %{_libdir}/pkgconfig/mbedcrypto.pc %{_libdir}/pkgconfig/mbedtls.pc %{_libdir}/pkgconfig/mbedx509.pc %{_libdir}/pkgconfig/tfpsacrypto.pc %{_libdir}/cmake/MbedTLS/*.cmake %{_libdir}/cmake/TF-PSA-Crypto/*.cmake %{_libdir}/libmbed*.so %{_libdir}/libtfpsacrypto.so %doc apidoc