summaryrefslogtreecommitdiff
path: root/repo/mbedtls/mbedtls.xibuild
blob: 4bcda208d6d919c04cf04c5310d7d8191f0d72e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/sh

NAME="mbedtls"
DESC="Light-weight cryptographic and SSL/TLS library"

MAKEDEPS=" cmake perl python ninja"

PKG_VER=2.28.1
SOURCE="https://github.com/ARMmbed/mbedtls/archive/v$PKG_VER.tar.gz"

prepare() {
	# Enable flags for non-embedded systems.
	sed -i \
		-e 's|//\(#define MBEDTLS_THREADING_C\)|\1|' \
		-e 's|//\(#define MBEDTLS_THREADING_PTHREAD\)|\1|' \
		"$BUILD_ROOT"/include/mbedtls/config.h
}

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE="MinSizeRel" \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_VERBOSE_MAKEFILE=ON \
		-DUSE_SHARED_MBEDTLS_LIBRARY=ON
	cmake --build build
}

check() {
	cd build
	CTEST_OUTPUT_ON_FAILURE=TRUE ctest
    cd ..
}

package() {
	DESTDIR="$PKG_DEST" cmake --install build
}