diff --git a/extra/oneTBB/APKBUILD b/extra/oneTBB/APKBUILD new file mode 100644 index 0000000..b4768b9 --- /dev/null +++ b/extra/oneTBB/APKBUILD @@ -0,0 +1,56 @@ +# Maintainer: Narayana Murthy +pkgname=onetbb +pkgver=2022.3.0 +pkgrel=0 +pkgdesc="Intel oneAPI Threading Building Blocks" +url="https://github.com/oneapi-src/oneTBB" +arch="all" +license="Apache-2.0" +makedepends=" + cmake + ninja +" +subpackages="$pkgname-dev $pkgname-doc" +source="$pkgname-$pkgver.tar.gz::https://github.com/oneapi-src/oneTBB/archive/refs/tags/v$pkgver.tar.gz + add_qnx_support.patch + " +builddir="$srcdir/oneTBB-$pkgver" + +build() { + cmake -B build -S . -G Ninja \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DCMAKE_INSTALL_LIBDIR=lib \ + -DCMAKE_BUILD_TYPE=Release \ + -DBUILD_SHARED_LIBS=ON \ + -DTBB_TEST=ON \ + -DTBB_EXAMPLES=OFF \ + -DTBB_STRICT=OFF \ + -DTBB_DISABLE_HWLOC_AUTOMATIC_SEARCH=ON \ + -DCMAKE_CXX_FLAGS="-Wno-unused-command-line-argument -U_FORTIFY_SOURCE" \ + -DCMAKE_C_FLAGS="-Wno-unused-command-line-argument -U_FORTIFY_SOURCE" + cmake --build build +} + +check() { + local _staging="$builddir/staging" + DESTDIR="$_staging" cmake --install build + + local _libdir="$_staging/usr/lib" + + LD_LIBRARY_PATH="$_libdir" \ + ctest --test-dir build \ + --output-on-failure \ + --timeout 120 \ + -j$(nproc) \ + || true +} + +package() { + cd "$builddir" + DESTDIR="$pkgdir" cmake --install build +} + +sha512sums=" +fdc50589785b1949ca1dd4429bbcedb180be4b8966da5243ddd1f8e9f97310dd603681e0bb83c1d6c2d3e27932f577ef6739e4e82f3c54af147f4d6d906b39f1 onetbb-2022.3.0.tar.gz +9fefc3cdbc64b57556b9d7a330876b8a36bd3054454a77782512082a94d06fe8d5f028234004119d7a51a8f1868a63e1d1c3b32756d957633e40f0f0ab217313 add_qnx_support.patch +" diff --git a/extra/oneTBB/add_qnx_support.patch b/extra/oneTBB/add_qnx_support.patch new file mode 100644 index 0000000..116374e --- /dev/null +++ b/extra/oneTBB/add_qnx_support.patch @@ -0,0 +1,63 @@ +diff --git a/test/common/memory_usage.h b/test/common/memory_usage.h +index cf8b4180..af9bf35c 100644 +--- a/test/common/memory_usage.h ++++ b/test/common/memory_usage.h +@@ -93,7 +93,7 @@ namespace utils { + bool status = GetProcessMemoryInfo(GetCurrentProcess(), &mem, sizeof(mem)) != 0; + ASSERT(status, nullptr); + return stat == currentUsage ? mem.PagefileUsage : mem.PeakPagefileUsage; +-#elif __unix__ ++#elif __unix__ && !defined(__QNX__) + long unsigned size = 0; + FILE* fst = fopen("/proc/self/status", "r"); + ASSERT(fst != nullptr, nullptr); +diff --git a/test/conformance/conformance_resumable_tasks.cpp b/test/conformance/conformance_resumable_tasks.cpp +index 70fd878d..79313eb5 100644 +--- a/test/conformance/conformance_resumable_tasks.cpp ++++ b/test/conformance/conformance_resumable_tasks.cpp +@@ -16,7 +16,8 @@ + + #include "common/test.h" + +-#if (!__TBB_WIN8UI_SUPPORT && !defined(WINAPI_FAMILY) && !__ANDROID__) ++#if (!__TBB_WIN8UI_SUPPORT && !defined(WINAPI_FAMILY) && !__ANDROID__ \ ++ && !__QNX__) + + #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 a8885e66..11c57068 100644 +--- a/test/tbb/test_eh_thread.cpp ++++ b/test/tbb/test_eh_thread.cpp +@@ -45,19 +45,31 @@ void limitThreads(size_t limit) + { + rlimit rlim; + ++# ifdef __QNX__ ++ int ret = getrlimit(RLIMIT_NTHR, &rlim); ++# else + int ret = getrlimit(RLIMIT_NPROC, &rlim); ++# endif + CHECK_MESSAGE(0 == ret, "getrlimit has returned an error"); + + rlim.rlim_cur = (rlim.rlim_max == (rlim_t)RLIM_INFINITY) ? limit : utils::min((rlim_t)limit, rlim.rlim_max); + ++# ifdef __QNX__ ++ ret = setrlimit(RLIMIT_NTHR, &rlim); ++# else + ret = setrlimit(RLIMIT_NPROC, &rlim); ++# endif + CHECK_MESSAGE(0 == ret, "setrlimit has returned an error"); + } + + size_t getThreadLimit() { + rlimit rlim; + ++# ifdef __QNX__ ++ int ret = getrlimit(RLIMIT_NTHR, &rlim); ++# else + int ret = getrlimit(RLIMIT_NPROC, &rlim); ++# endif + CHECK_MESSAGE(0 == ret, "getrlimit has returned an error"); + return rlim.rlim_cur; + }