# Template file for 'mimalloc'
pkgname=mimalloc
version=3.4.3
revision=1
build_style=cmake
configure_args="-DCMAKE_BUILD_TYPE=Release -DMI_BUILD_OBJECT=OFF
 -DMI_INSTALL_TOPLEVEL=ON $(vopt_bool secure MI_SECURE)"
short_desc="General purpose allocator with excellent performance characteristics"
maintainer="Peter Wang <novalazy@gmail.com>"
license="MIT"
homepage="https://github.com/microsoft/mimalloc"
distfiles="https://github.com/microsoft/mimalloc/archive/refs/tags/v${version}.tar.gz"
checksum=7b043c26b64dde66344d144fbcac3664858a4eb32197793ea2a18feb32741ca1

build_options="secure"
build_options_default="secure"
desc_option_secure="Build mimalloc in secure mode"

if [ "${XBPS_TARGET_LIBC}" = "musl" ]; then
	configure_args+=" -DMI_LIBC_MUSL=ON"
fi

post_install() {
	vlicense LICENSE
}

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