# Template file for 'mbedtls2'
pkgname=mbedtls2
version=2.28.10
revision=1
build_style=cmake
configure_args="-DENABLE_TESTING=1 -DUSE_SHARED_MBEDTLS_LIBRARY=1"
hostmakedepends="python3 perl"
short_desc="Portable cryptographic TLS library (version 2)"
maintainer="Orphaned <orphan@voidlinux.org>"
license="Apache-2.0"
homepage="https://tls.mbed.org/"
changelog="https://raw.githubusercontent.com/ARMmbed/mbedtls/mbedtls-${version%.*}/ChangeLog"
distfiles="https://github.com/ARMmbed/mbedtls/archive/refs/tags/v${version}.tar.gz"
checksum=0f2e0525903a89ae1d39ce439d858be66933bda54c5b6102b72a29ed8fe7c088

pre_configure() {
	./scripts/config.pl set MBEDTLS_THREADING_C
	./scripts/config.pl set MBEDTLS_THREADING_PTHREAD
}

post_install() {
	rm -r "$DESTDIR"/usr/bin
}

mbedtls2-devel_package() {
	short_desc+=" - development files"
	depends="${sourcepkg}-${version}_${revision}"
	conflicts="mbedtls-devel>=0"
	replaces="mbedtls-devel>=0"
	pkg_install() {
		vmove usr/include
		vmove "usr/lib/*.a"
		vmove "usr/lib/*.so"
		vmove usr/lib/pkgconfig
	}
}
