mimalloc, new recipe (#9059)

This commit is contained in:
Schrijvers Luc
2023-07-23 08:49:48 +02:00
committed by GitHub
parent 2abad24440
commit b457621253
2 changed files with 119 additions and 0 deletions

View File

@@ -0,0 +1,69 @@
SUMMARY="A compact general purpose allocator with excellent performance"
DESCRIPTION="mimalloc (pronounced 'me-malloc') is a general purpose allocator with excellent \
performance characteristics.
Initially developed by Daan Leijen for the runtime systems of the Koka and Lean languages."
HOMEPAGE="https://github.com/microsoft/mimalloc"
COPYRIGHT="2018-2021 Microsoft Corporation, Daan Leijen"
LICENSE="MIT"
REVISION="1"
SOURCE_URI="$HOMEPAGE/archive/refs/tags/v$portVersion.tar.gz"
CHECKSUM_SHA256="2b1bff6f717f9725c70bf8d79e4786da13de8a270059e4ba0bdd262ae7be46eb"
SOURCE_FILENAME="mimalloc-v$portVersion.tar.gz"
PATCHES="mimalloc-$portVersion.patchset"
ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"
libVersion="2.1"
libVersionCompat="$libVersion compat >= ${libVersion%.*}"
PROVIDES="
mimalloc$secondaryArchSuffix = $portVersion
lib:libmimalloc$secondaryArchSuffix = $libVersionCompat
"
REQUIRES="
haiku$secondaryArchSuffix
lib:libatomic$secondaryArchSuffix
"
PROVIDES_devel="
mimalloc${secondaryArchSuffix}_devel = $portVersion
devel:libmimalloc$secondaryArchSuffix = $libVersionCompat
"
REQUIRES_devel="
mimalloc$secondaryArchSuffix == $portVersion base
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
"
BUILD_PREREQUIRES="
cmd:cmake
cmd:gcc$secondaryArchSuffix
cmd:make
"
BUILD()
{
cmake -Bbuild -S. -DCMAKE_BUILD_TYPE=Release \
$cmakeDirArgs
make -C build $jobArgs
}
INSTALL()
{
make -C build install
prepareInstalledDevelLib \
libmimalloc
fixPkgconfig
packageEntries devel \
$developDir \
$libDir/cmake
}
TEST()
{
make -C build test
}

View File

@@ -0,0 +1,50 @@
From 6c72e7b0df1484c7f8a6a1967030b31f6d6790d0 Mon Sep 17 00:00:00 2001
From: Begasus <begasus@gmail.com>
Date: Fri, 21 Jul 2023 12:49:43 +0000
Subject: Don't hardcode install paths
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2bcd1ef..72ea2f1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -262,11 +262,6 @@ if(MI_USE_CXX)
endif()
endif()
-if(CMAKE_SYSTEM_NAME MATCHES "Haiku")
- SET(CMAKE_INSTALL_LIBDIR ~/config/non-packaged/lib)
- SET(CMAKE_INSTALL_INCLUDEDIR ~/config/non-packaged/headers)
- endif()
-
# Compiler flags
if(CMAKE_C_COMPILER_ID MATCHES "AppleClang|Clang|GNU")
list(APPEND mi_cflags -Wall -Wextra -Wno-unknown-pragmas -fvisibility=hidden)
--
2.37.3
From ad9c184f58d2f1bec4907a86dd9b6faaba9c5274 Mon Sep 17 00:00:00 2001
From: Begasus <begasus@gmail.com>
Date: Fri, 21 Jul 2023 13:54:29 +0000
Subject: Fix missing header on Haiku
diff --git a/src/prim/unix/prim.c b/src/prim/unix/prim.c
index 314281f..605a684 100644
--- a/src/prim/unix/prim.c
+++ b/src/prim/unix/prim.c
@@ -55,6 +55,10 @@ terms of the MIT license. A copy of the license can be found in the file
#include <sys/syscall.h>
#endif
+#if defined(__HAIKU__)
+#include <fcntl.h>
+#endif
+
//------------------------------------------------------------------------------------
// Use syscalls for some primitives to allow for libraries that override open/read/close etc.
// and do allocation themselves; using syscalls prevents recursion when mimalloc is
--
2.37.3