# Template file for 'bearssl'
pkgname=bearssl
version=0.6
revision=2
build_style=gnu-makefile
make_build_args="D=.so.${version} LD=\$(CC) LDDLL=\$(CC) LDDLLFLAGS=-shared LDDLLFLAGS+=-Wl,-soname,lib${pkgname}.so.${version%%.*}"
short_desc="Implementation of the SSL/TLS protocol in C"
maintainer="Leah Neukirchen <leah@vuxu.org>"
license="MIT"
homepage="https://bearssl.org"
changelog="https://bearssl.org/changelog.html"
distfiles="https://bearssl.org/${pkgname}-${version}.tar.gz"
checksum=6705bba1714961b41a728dfc5debbe348d2966c117649392f8c8139efc83ff14
CFLAGS="-fPIC"

do_install() {
	vbin build/brssl
	vinstall "build/lib${pkgname}.a"             0644 usr/lib
	vinstall "build/lib${pkgname}.so.${version}" 0644 usr/lib
	ln -s "lib${pkgname}.so.${version}"     "${DESTDIR}/usr/lib/lib${pkgname}.so.${version%%.*}"
	ln -s "lib${pkgname}.so.${version%%.*}" "${DESTDIR}/usr/lib/lib${pkgname}.so"
	vcopy inc usr/include
	vlicense LICENSE.txt LICENSE
}

do_check() {
	cd "${wrksrc}/build"
	./testx509
	./testcrypto all
}

bearssl-devel_package() {
	short_desc+=" - development files"
	depends="${sourcepkg}>=${version}_${revision}"
	pkg_install() {
		vmove usr/include
		vmove usr/lib/*.a
		vmove usr/lib/*.so
	}
}
