# Contributor: Jakub Jirutka # Contributor: Nicolas Lorin # Maintainer: Jakub Jirutka pkgname=mimalloc2 _projname=mimalloc pkgver=2.2.3 _pkgver=${pkgver%_*} pkgrel=0 _pkgdesc="A compact general purpose allocator with excellent performance" pkgdesc="$_pkgdesc (in secure mode)" url="https://github.com/microsoft/mimalloc" arch="all" license="MIT" makedepends="cmake samurai" provides="mimalloc=$pkgver-r$pkgrel" subpackages=" $pkgname-dev $pkgname-insecure $pkgname-debug " source="https://github.com/microsoft/mimalloc/archive/v$_pkgver/$_projname-$_pkgver.tar.gz remove-include-linux-prctl-h.patch cmake-add-insecure-suffix.patch " builddir="$srcdir/$_projname-$_pkgver" case "$CARCH" in # test-stress segfaults # see https://github.com/microsoft/mimalloc/issues/1086 x86) options="!check";; esac _buildtypes='debug insecure secure' build() { # https://github.com/microsoft/mimalloc/issues/597 export CFLAGS="$CFLAGS -D__USE_ISOC11" _build out/debug -DCMAKE_BUILD_TYPE=Debug -DMI_DEBUG_FULL=ON # This is called "release" build by upstream. _build out/insecure -DCMAKE_BUILD_TYPE=Release -DMI_SECURE=OFF _build out/secure -DCMAKE_BUILD_TYPE=Release -DMI_SECURE=ON } _build() { local outdir="$1"; shift local crossopts= [ "$CBUILD" = "$CHOST" ] \ || crossopts='-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux' CFLAGS=${CFLAGS/-Os/} cmake -B "$outdir" -G Ninja \ -DCMAKE_INSTALL_PREFIX=/usr \ -DCMAKE_VERBOSE_MAKEFILE=ON \ -DMI_INSTALL_TOPLEVEL=ON \ $crossopts \ "$@" . cmake --build "$outdir" } check() { local btype; for btype in $_buildtypes; do msg "Testing $btype build" cd "$builddir"/out/$btype ctest --timeout 300 done } package() { local btype; for btype in $_buildtypes; do DESTDIR="$pkgdir" cmake --install out/$btype done cd "$pkgdir" ln -s libmimalloc-secure.so usr/lib/libmimalloc.so ln -s libmimalloc-secure.so.${pkgver%%.*} usr/lib/libmimalloc.so.${pkgver%%.*} ln -s libmimalloc-secure.so.${pkgver%.*} usr/lib/libmimalloc.so.${pkgver%.*} ln -s libmimalloc-secure.a usr/lib/libmimalloc.a sed 's/-secure/-insecure/g' usr/lib/cmake/mimalloc/mimalloc-release.cmake \ > usr/lib/cmake/mimalloc/mimalloc-insecure.cmake mv usr/lib/cmake/mimalloc/mimalloc-release.cmake usr/lib/cmake/mimalloc/mimalloc-secure.cmake ln -s mimalloc-secure.cmake usr/lib/cmake/mimalloc/mimalloc-release.cmake rm -f usr/lib/*.o } dev() { provides="mimalloc-dev=$pkgver-r$pkgrel" default_dev } insecure() { pkgdesc="$_pkgdesc (in insecure mode)" provides="mimalloc-insecure=$pkgver-r$pkgrel" amove usr/lib/libmimalloc-insecure.* } debug() { pkgdesc="$_pkgdesc (debug build)" provides="mimalloc-debug=$pkgver-r$pkgrel" options="!strip" amove usr/lib/libmimalloc-debug.* } sha512sums=" 55262050f63868e3029cd929a74d312dc0f34b606534b1d0b3735eecc8eed68aae97523a50228b4ac4044e1e03192f2909440e3a27607e2d364607ac0bda828f mimalloc-2.2.3.tar.gz 7015d5123280639f18b3a07b007de43bf3cb60009d144dcb6f9d027ba14b35a18ece5f8c21b3c63723e2f05b86c3ea5b64e521d61b54b1e5c885934904cbd63a remove-include-linux-prctl-h.patch 8b0542f0b5992cdc1423345ba980ead00ba89784b6608716bbc67587560a5782325af871d4084abf2b8f38abe3ac008ae733dbde0f5d84344689739cb49a1aff cmake-add-insecure-suffix.patch "