mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-23 12:10:06 +02:00
tbb: update to version 2022.3.0. (#13176)
Remove unused 2021.10.0 version. Clean up recipe a bit, reworked the .patchset more extensibly. Still leaving it disabled until further testing. Note: it should be possible to build this without the `hwloc` dependency. In that case, libtbbbind_*.so* are not generated. Kudos to Begasus for his help in testing this, and previous patchset!
This commit is contained in:
273
dev-cpp/tbb/patches/tbb-2022.3.0.patchset
Normal file
273
dev-cpp/tbb/patches/tbb-2022.3.0.patchset
Normal file
@@ -0,0 +1,273 @@
|
||||
From 4913c75e561ec3aaff1bf4cb35b43ed818640eed Mon Sep 17 00:00:00 2001
|
||||
From: Oscar Lesta <oscar.lesta@gmail.com>
|
||||
Date: Sun, 2 Nov 2025 07:05:17 -0300
|
||||
Subject: Fix compilation errors.
|
||||
|
||||
Minimal set of changes needed to make the build succeed.
|
||||
|
||||
Based on the "Haiku patches" commit from prevoius tbb-2022.0.0.patchset.
|
||||
|
||||
Co-authored-by: Schrijvers Luc <begasus@gmail.com>
|
||||
|
||||
diff --git a/include/oneapi/tbb/detail/_config.h b/include/oneapi/tbb/detail/_config.h
|
||||
index 1d36013..f89d97c 100644
|
||||
--- a/include/oneapi/tbb/detail/_config.h
|
||||
+++ b/include/oneapi/tbb/detail/_config.h
|
||||
@@ -277,7 +277,7 @@
|
||||
#define __TBB_CPP20_COMPARISONS_PRESENT 0
|
||||
#endif
|
||||
|
||||
-#define __TBB_RESUMABLE_TASKS (!__TBB_WIN8UI_SUPPORT && !__ANDROID__ && !__QNXNTO__ && (!__linux__ || __GLIBC__))
|
||||
+#define __TBB_RESUMABLE_TASKS (!__TBB_WIN8UI_SUPPORT && !__ANDROID__ && !__HAIKU__ && !__QNXNTO__ && (!__linux__ || __GLIBC__))
|
||||
|
||||
/* This macro marks incomplete code or comments describing ideas which are considered for the future.
|
||||
* See also for plain comment with TODO and FIXME marks for small improvement opportunities.
|
||||
diff --git a/include/oneapi/tbb/detail/_export.h b/include/oneapi/tbb/detail/_export.h
|
||||
index 24b6c08..dae3d8a 100644
|
||||
--- a/include/oneapi/tbb/detail/_export.h
|
||||
+++ b/include/oneapi/tbb/detail/_export.h
|
||||
@@ -21,7 +21,7 @@
|
||||
#define __TBB_EXPORT __declspec(dllexport)
|
||||
#elif defined(_WIN32) // Use .def files for these
|
||||
#define __TBB_EXPORT
|
||||
-#elif defined(__unix__) || defined(__APPLE__) // Use .def files for these
|
||||
+#elif defined(__unix__) || defined(__APPLE__) || defined(__HAIKU__) // Use .def files for these
|
||||
#define __TBB_EXPORT __attribute__ ((visibility ("default")))
|
||||
#else
|
||||
#error "Unknown platform/compiler"
|
||||
diff --git a/src/tbb/allocator.cpp b/src/tbb/allocator.cpp
|
||||
index 689c512..b0cc5fb 100644
|
||||
--- a/src/tbb/allocator.cpp
|
||||
+++ b/src/tbb/allocator.cpp
|
||||
@@ -40,7 +40,7 @@
|
||||
// memalign() and it offers nothing but overhead due to inconvenient interface. This is likely the case with other
|
||||
// standard libraries as well, and more libraries can be added to the preprocessor check below. Unfortunately, we
|
||||
// can't detect musl, so we simply enable memalign() on Linux and Android in general.
|
||||
-#if defined(linux) || defined(__linux) || defined(__linux__) || defined(__ANDROID__)
|
||||
+#if defined(linux) || defined(__linux) || defined(__linux__) || defined(__ANDROID__) || defined(__HAIKU__)
|
||||
#include <malloc.h> // memalign
|
||||
#define __TBB_USE_MEMALIGN
|
||||
#else
|
||||
@@ -121,7 +121,7 @@ static const dynamic_link_descriptor MallocLinkTable[] = {
|
||||
#define MALLOCLIB_NAME "libtbbmalloc" DEBUG_SUFFIX ".2.dylib"
|
||||
#elif __FreeBSD__ || __NetBSD__ || __OpenBSD__ || __sun || _AIX || __ANDROID__
|
||||
#define MALLOCLIB_NAME "libtbbmalloc" DEBUG_SUFFIX ".so"
|
||||
-#elif __unix__ // Note that order of these #elif's is important!
|
||||
+#elif __unix__ || __HAIKU__ // Note that order of these #elif's is important!
|
||||
#define MALLOCLIB_NAME "libtbbmalloc" DEBUG_SUFFIX ".so.2"
|
||||
#else
|
||||
#error Unknown OS
|
||||
diff --git a/src/tbb/rml_tbb.cpp b/src/tbb/rml_tbb.cpp
|
||||
index d1cd285..6b9b731 100644
|
||||
--- a/src/tbb/rml_tbb.cpp
|
||||
+++ b/src/tbb/rml_tbb.cpp
|
||||
@@ -52,7 +52,7 @@ namespace rml {
|
||||
#define RML_SERVER_NAME "libirml" DEBUG_SUFFIX ".1.dylib"
|
||||
#elif __FreeBSD__ || __NetBSD__ || __OpenBSD__ || __sun || _AIX
|
||||
#define RML_SERVER_NAME "libirml" DEBUG_SUFFIX ".so"
|
||||
-#elif __unix__
|
||||
+#elif __unix__ || __HAIKU__
|
||||
#define RML_SERVER_NAME "libirml" DEBUG_SUFFIX ".so.1"
|
||||
#else
|
||||
#error Unknown OS
|
||||
diff --git a/src/tbbmalloc/frontend.cpp b/src/tbbmalloc/frontend.cpp
|
||||
index 7457dd3..f3aed7b 100644
|
||||
--- a/src/tbbmalloc/frontend.cpp
|
||||
+++ b/src/tbbmalloc/frontend.cpp
|
||||
@@ -776,7 +776,7 @@ static inline unsigned int highestBitPos(unsigned int n)
|
||||
unsigned int pos;
|
||||
#if __ARCH_x86_32||__ARCH_x86_64
|
||||
|
||||
-# if __unix__||__APPLE__||__MINGW32__
|
||||
+# if __unix__||__APPLE__||__MINGW32__||__HAIKU__
|
||||
__asm__ ("bsr %1,%0" : "=r"(pos) : "r"(n));
|
||||
# elif (_WIN32 && (!_WIN64 || __INTEL_COMPILER))
|
||||
__asm
|
||||
diff --git a/src/tbbmalloc/tbbmalloc.cpp b/src/tbbmalloc/tbbmalloc.cpp
|
||||
index b72e03a..7b68679 100644
|
||||
--- a/src/tbbmalloc/tbbmalloc.cpp
|
||||
+++ b/src/tbbmalloc/tbbmalloc.cpp
|
||||
@@ -45,7 +45,7 @@ namespace internal {
|
||||
#define MALLOCLIB_NAME "libtbbmalloc" DEBUG_SUFFIX ".2.dylib"
|
||||
#elif __FreeBSD__ || __NetBSD__ || __OpenBSD__ || __sun || _AIX || __ANDROID__
|
||||
#define MALLOCLIB_NAME "libtbbmalloc" DEBUG_SUFFIX ".so"
|
||||
-#elif __unix__
|
||||
+#elif __unix__ || __HAIKU__
|
||||
#define MALLOCLIB_NAME "libtbbmalloc" DEBUG_SUFFIX __TBB_STRING(.so.2)
|
||||
#else
|
||||
#error Unknown OS
|
||||
--
|
||||
2.51.0
|
||||
|
||||
|
||||
From 49e6386f79518c43a69a2bd57d3f421b2ffe6445 Mon Sep 17 00:00:00 2001
|
||||
From: Oscar Lesta <oscar.lesta@gmail.com>
|
||||
Date: Sun, 2 Nov 2025 07:23:03 -0300
|
||||
Subject: Allow compilation on Haiku's revisions older than hrev58813.
|
||||
|
||||
Older versions don't support RTLD_NOLOAD.
|
||||
|
||||
This commit can be dropped after HaikuPorts builder (eventually)
|
||||
switch to beta6.
|
||||
|
||||
diff --git a/src/tbb/dynamic_link.cpp b/src/tbb/dynamic_link.cpp
|
||||
index c4abfc6..fbb5436 100644
|
||||
--- a/src/tbb/dynamic_link.cpp
|
||||
+++ b/src/tbb/dynamic_link.cpp
|
||||
@@ -534,7 +534,14 @@ namespace r1 {
|
||||
#endif /* !__TBB_DYNAMIC_LOAD_ENABLED */
|
||||
// RTLD_GLOBAL - to guarantee that old TBB will find the loaded library
|
||||
// RTLD_NOLOAD - not to load the library without the full path
|
||||
+ // Work-around for building on Haiku < hrev58813.
|
||||
+ #ifdef RTLD_NOLOAD
|
||||
library_handle = dlopen(library, RTLD_LAZY | RTLD_GLOBAL | RTLD_NOLOAD);
|
||||
+ #else
|
||||
+ // Nay trigger benign, but spurious, runtime_loader messages when calling this.
|
||||
+ // ("mold" suffers from this, for example)
|
||||
+ library_handle = dlopen(library, RTLD_LAZY | RTLD_GLOBAL);
|
||||
+ #endif
|
||||
#endif /* _WIN32 */
|
||||
if (library_handle) {
|
||||
if (!resolve_symbols(library_handle, descriptors, required)) {
|
||||
--
|
||||
2.51.0
|
||||
|
||||
|
||||
From 7ebfa2dd519d217fc06fcfad9c1da752dab7023b Mon Sep 17 00:00:00 2001
|
||||
From: Oscar Lesta <oscar.lesta@gmail.com>
|
||||
Date: Sat, 1 Nov 2025 14:33:07 -0300
|
||||
Subject: Do not attempt to load TCM on Haiku.
|
||||
|
||||
See comment on the diff as to why.
|
||||
|
||||
diff --git a/src/tbb/tcm_adaptor.cpp b/src/tbb/tcm_adaptor.cpp
|
||||
index 7fa71c3..9e17336 100644
|
||||
--- a/src/tbb/tcm_adaptor.cpp
|
||||
+++ b/src/tbb/tcm_adaptor.cpp
|
||||
@@ -246,8 +246,16 @@ void tcm_adaptor::initialize() {
|
||||
// Allow system loader to search for TCM in the environment rather than load it from certain
|
||||
// location.
|
||||
constexpr int flags = DYNAMIC_LINK_DEFAULT & ~DYNAMIC_LINK_BUILD_ABSOLUTE_PATH;
|
||||
+// No TCM available on Haiku, and this dynamic_link() call ends ups calling dlopen() without a
|
||||
+// full path name to "tcm", and without specifying RTLD_NOLOAD, which causes Haiku's runtime_loader
|
||||
+// to emit an annoying: "runtime_loader: Cannot open file tcm (needed by /boot/system/lib/libtbb.so.12.17): No such file or directory"
|
||||
+// each time libtbb is loaded.
|
||||
+// As there's no OpenMP implrementation from the Intel DPC++/C++ Compiler (necessary to make "tcm" work),
|
||||
+// this should be pretty harmless (and TCM is disabled by default, in any case).
|
||||
+#ifndef __HAIKU__
|
||||
tcm_functions_loaded = dynamic_link(TCMLIB_NAME, tcm_link_table, tcm_link_table_size,
|
||||
/*handle*/nullptr, flags);
|
||||
+#endif
|
||||
}
|
||||
|
||||
bool tcm_adaptor::is_initialized() {
|
||||
--
|
||||
2.51.0
|
||||
|
||||
|
||||
From 7eec43803f13fe8f786f8a19cee5ca831f4844ba Mon Sep 17 00:00:00 2001
|
||||
From: Oscar Lesta <oscar.lesta@gmail.com>
|
||||
Date: Sun, 2 Nov 2025 08:16:54 -0300
|
||||
Subject: Fix build of tests.
|
||||
|
||||
Co-authored-by: Schrijvers Luc <begasus@gmail.com>
|
||||
|
||||
diff --git a/test/common/utils_dynamic_libs.h b/test/common/utils_dynamic_libs.h
|
||||
index 99afca3..751c266 100644
|
||||
--- a/test/common/utils_dynamic_libs.h
|
||||
+++ b/test/common/utils_dynamic_libs.h
|
||||
@@ -60,7 +60,7 @@ namespace utils {
|
||||
// Android SDK build system does not support .so file name versioning
|
||||
#elif __FreeBSD__ || __NetBSD__ || __OpenBSD__ || __sun || _AIX || __ANDROID__
|
||||
#define EXT ".so"
|
||||
-#elif __unix__ // Order of these elif's matters!
|
||||
+#elif __unix__ || __HAIKU__ // Order of these elif's matters!
|
||||
#define EXT __TBB_STRING(.so.2)
|
||||
#else
|
||||
#error Unknown OS
|
||||
diff --git a/test/conformance/conformance_resumable_tasks.cpp b/test/conformance/conformance_resumable_tasks.cpp
|
||||
index 70fd878..4b8bfbe 100644
|
||||
--- a/test/conformance/conformance_resumable_tasks.cpp
|
||||
+++ b/test/conformance/conformance_resumable_tasks.cpp
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
#include "common/test.h"
|
||||
|
||||
-#if (!__TBB_WIN8UI_SUPPORT && !defined(WINAPI_FAMILY) && !__ANDROID__)
|
||||
+#if (!__TBB_WIN8UI_SUPPORT && !defined(WINAPI_FAMILY) && !__ANDROID__ && !__HAIKU__)
|
||||
|
||||
#include "oneapi/tbb/task.h"
|
||||
#include "oneapi/tbb/task_group.h"
|
||||
diff --git a/test/tbb/test_eh_thread.cpp b/test/tbb/test_eh_thread.cpp
|
||||
index a8885e6..ab23428 100644
|
||||
--- a/test/tbb/test_eh_thread.cpp
|
||||
+++ b/test/tbb/test_eh_thread.cpp
|
||||
@@ -34,7 +34,7 @@
|
||||
// On Windows there is no real thread number limit beside available memory.
|
||||
// Therefore, the test for thread limit is unreasonable.
|
||||
// TODO: enable limitThreads with sanitizer under docker
|
||||
-#if TBB_USE_EXCEPTIONS && !_WIN32 && !__ANDROID__
|
||||
+#if TBB_USE_EXCEPTIONS && !_WIN32 && !__ANDROID__ && !__HAIKU__
|
||||
|
||||
#include <limits.h>
|
||||
#include <sys/types.h>
|
||||
--
|
||||
2.51.0
|
||||
|
||||
|
||||
From 30b7f1920b369c2454eccd99dd1ee97ffbb77f20 Mon Sep 17 00:00:00 2001
|
||||
From: Oscar Lesta <oscar.lesta@gmail.com>
|
||||
Date: Sun, 2 Nov 2025 11:35:31 -0300
|
||||
Subject: Fixes around tbbbind functionality.
|
||||
|
||||
Make sure load_tbbbind_shared_object() returns something.
|
||||
|
||||
Also fix the build of the test: "test_tbbbind".
|
||||
|
||||
diff --git a/src/tbb/governor.cpp b/src/tbb/governor.cpp
|
||||
index 5a54e69..b6a8a99 100644
|
||||
--- a/src/tbb/governor.cpp
|
||||
+++ b/src/tbb/governor.cpp
|
||||
@@ -416,7 +416,7 @@ int (*get_default_concurrency_ptr)( int numa_id, int core_type_id, int max_threa
|
||||
void (*set_assertion_handler_ptr)( assertion_handler_type handler )
|
||||
= dummy_set_assertion_handler;
|
||||
|
||||
-#if _WIN32 || _WIN64 || __unix__ || __APPLE__
|
||||
+#if _WIN32 || _WIN64 || __unix__ || __APPLE__ || __HAIKU__
|
||||
|
||||
// Table describing how to link the handlers.
|
||||
static const dynamic_link_descriptor TbbBindLinkTable[] = {
|
||||
@@ -451,7 +451,7 @@ int core_types_count = 0;
|
||||
int* core_types_indexes = nullptr;
|
||||
|
||||
const char* load_tbbbind_shared_object() {
|
||||
-#if _WIN32 || _WIN64 || __unix__ || __APPLE__
|
||||
+#if _WIN32 || _WIN64 || __unix__ || __APPLE__ || __HAIKU__
|
||||
#if _WIN32 && !_WIN64
|
||||
// For 32-bit Windows applications, process affinity masks can only support up to 32 logical CPUs.
|
||||
SYSTEM_INFO si;
|
||||
diff --git a/src/tbb/load_tbbbind.h b/src/tbb/load_tbbbind.h
|
||||
index 21ce239..d794c3f 100644
|
||||
--- a/src/tbb/load_tbbbind.h
|
||||
+++ b/src/tbb/load_tbbbind.h
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
#include "oneapi/tbb/version.h" // __TBB_STRING
|
||||
|
||||
-#if _WIN32 || _WIN64 || __unix__ || __APPLE__
|
||||
+#if _WIN32 || _WIN64 || __unix__ || __APPLE__ || __HAIKU__
|
||||
|
||||
#if TBB_USE_DEBUG
|
||||
#define DEBUG_SUFFIX "_debug"
|
||||
@@ -34,7 +34,7 @@
|
||||
#elif __APPLE__
|
||||
#define LIBRARY_EXTENSION __TBB_STRING(.3.dylib)
|
||||
#define LIBRARY_PREFIX "lib"
|
||||
-#elif __unix__
|
||||
+#elif __unix__ || __HAIKU__
|
||||
#define LIBRARY_EXTENSION __TBB_STRING(.so.3)
|
||||
#define LIBRARY_PREFIX "lib"
|
||||
#endif /* __unix__ */
|
||||
--
|
||||
2.51.0
|
||||
|
||||
Reference in New Issue
Block a user