mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2026-05-17 10:36:22 +02:00
109 lines
3.0 KiB
Plaintext
109 lines
3.0 KiB
Plaintext
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
|
|
# Contributor: Nicolas Lorin <androw95220@gmail.com>
|
|
# Maintainer: Andy Postnikov <apostnikov@gmail.com>
|
|
pkgname=mimalloc3
|
|
_projname=mimalloc
|
|
pkgver=3.3.2
|
|
_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 !ppc64le !riscv64" # test-api and test-stress failed on riscv64 and ppc64le
|
|
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
|
|
cmake-add-insecure-suffix.patch
|
|
"
|
|
builddir="$srcdir/$_projname-$_pkgver"
|
|
|
|
_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 \
|
|
-DMI_NO_OPT_ARCH=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="
|
|
226bbd51eca36d7737ce5e2edba7e0a3beeca448462a861bcbfb6726a0994bc077b4c684d7ff8b0805d71bf770e00df14f10ed598256ee54a154d8cc08e6a5c1 mimalloc-3.3.2.tar.gz
|
|
8e7f634d0f9e12548e320206ab527622173f3b4ad0e860f428b2957baca54de2c7352ac3ae1a1eb37709a5c62f7ca3c882b975a5859c12c81ff1cf372e55fce3 cmake-add-insecure-suffix.patch
|
|
"
|