pantry/projects/github.com/Mbed-TLS/mbedtls/package.yml

70 lines
2.2 KiB
YAML
Raw Normal View History

distributable:
2024-03-28 18:51:27 +03:00
url: https://github.com/Mbed-TLS/mbedtls/releases/download/{{version.tag}}/mbedtls-{{version}}.tar.bz2
strip-components: 1
versions:
github: Mbed-TLS/mbedtls
provides:
- bin/generic_sum
build:
dependencies:
cmake.org: '*'
2023-08-03 21:43:16 +03:00
linux/aarch64:
llvm.org: <16 # otherwise we get an error from the arm_neon.h include
2023-10-03 18:23:56 +03:00
python.org: ~3.11
2023-08-03 21:43:16 +03:00
script:
# MBEDTLS_THREADING_PTHREAD - enable pthread mutexes
# MBEDTLS_THREADING_C - allow use of mutexes within mbed TLS
# MBEDTLS_SSL_DTLS_SRTP - enable DTLS-SRTP extension
2023-08-03 21:43:16 +03:00
- run: CFG=include/mbedtls/mbedtls_config.h
if: '>=3'
- run: CFG=include/mbedtls/config.h
if: '<3'
2023-08-03 21:43:16 +03:00
- |
sed -i.bak \
-e "s://#define MBEDTLS_THREADING_PTHREAD:#define MBEDTLS_THREADING_PTHREAD:" \
-e "s://#define MBEDTLS_THREADING_C:#define MBEDTLS_THREADING_C:" \
-e "s://#define MBEDTLS_SSL_DTLS_SRTP:#define MBEDTLS_SSL_DTLS_SRTP:" \
$CFG
rm $CFG.bak
- cmake -S . -B build $ARGS
- cmake --build build
# We run CTest because this is a crypto library. Running tests in parallel causes failures.
# https://github.com/Mbed-TLS/mbedtls/issues/4980
2023-08-03 21:43:16 +03:00
- ctest --parallel 1 --test-dir build --rerun-failed --output-on-failure
- cmake --install build
# Why does Mbedtls ship with a "Hello World" executable. Let's remove that.
2023-08-03 21:43:16 +03:00
- run: rm -f hello
working-directory: ${{prefix}}/bin/
# Rename benchmark & selftest, which are awfully generic names.
2023-08-03 21:43:16 +03:00
- run: |
mv benchmark mbedtls-benchmark
mv selftest mbedtls-selftest
working-directory: ${{prefix}}/bin
# Demonstration files shouldn't be in the main bin
2023-08-03 21:43:16 +03:00
- run: mv ../bin/mpi_demo mpi_demo
working-directory: ${{prefix}}/libexec
env:
ARGS:
- -DCMAKE_BUILD_TYPE=Release
- -DCMAKE_INSTALL_PREFIX={{prefix}}
- -DUSE_SHARED_MBEDTLS_LIBRARY=On
- -DPython3_EXECUTABLE=$(which python3)
- -DCMAKE_INSTALL_RPATH={{prefix}}
- -DGEN_FILES=OFF
test:
2023-08-03 21:43:16 +03:00
script:
- printf '%s' 'This is a test file' > testfile.txt
- test "$(generic_sum SHA256 testfile.txt)" = "$SUM"
env:
SUM: e2d0fe1585a63ec6009c8016ff8dda8b17719a637405a4e23c0ff81339148249 testfile.txt