The Mbed TLS package provides TLS libraries and aims to flexible and portable.
Install Mbed TLS by running the following commands:
mkdir build &&
cd build &&
CFLAGS="-Wno-unterminated-string-initialization" \
CXXFLAGS="-Wno-unterminated-string-initialization" \
cmake -D CMAKE_INSTALL_PREFIX=/usr \
-D CMAKE_BUILD_TYPE=Release \
-D CMAKE_SKIP_RPATH=ON \
-D USE_SHARED_MBEDTLS_LIBRARY=ON \
-D USE_STATIC_MBEDTLS_LIBRARY=OFF \
-G Ninja .. &&
ninja
Now, as the root user:
DESTDIR=$PWD/DESTDIR ninja install &&
pushd DESTDIR/usr/bin &&
for i in *; do
mv -v {,mbedtls_}$i
done
popd &&
cp -vR DESTDIR/usr/* /usr
C{,XX}FLAGS="-Wno-unterminated-string-initialization":
These variables disable a false positive being triggered by
GCC-15.x.x.
-D
CMAKE_SKIP_INSTALL_RPATH=ON: This switch makes
cmake remove
hardcoded library search paths (rpath) when installing a binary
executable file or a shared library. This package does not need
rpath once it's installed into the standard location, and rpath may
sometimes cause unwanted effects or even security issues.
-D
USE_SHARED_MBEDTLS_LIBRARY=ON: This parameter ensures
shared libraries are built.
-D
USE_STATIC_MBEDTLS_LIBRARY=OFF: This parameter ensures
the main libraries are not statically built.
pushd DESTDIR/usr/bin ...: These commands rename the programs as to not conflict with those that may be installed by other programs.