From c08e70d5c1fa886f20543b4d016fcfc9a833a7f1 Mon Sep 17 00:00:00 2001 From: Ella-0 <23418164+Ella-0@users.noreply.github.com> Date: Tue, 29 Jun 2021 23:30:28 +0100 Subject: [PATCH] added onetbb --- pkgs/tbb/build.sh | 36 ++++++++++++++++++++++++++++++ pkgs/tbb/musl-malloc-proxy.patch | 38 ++++++++++++++++++++++++++++++++ pkgs/tbb/musl-rtld.patch | 14 ++++++++++++ 3 files changed, 88 insertions(+) create mode 100644 pkgs/tbb/build.sh create mode 100644 pkgs/tbb/musl-malloc-proxy.patch create mode 100644 pkgs/tbb/musl-rtld.patch diff --git a/pkgs/tbb/build.sh b/pkgs/tbb/build.sh new file mode 100644 index 0000000..b44a5be --- /dev/null +++ b/pkgs/tbb/build.sh @@ -0,0 +1,36 @@ +pkgname=tbb +pkgver=master + +fetch() { + curl -L "https://github.com/oneapi-src/oneTBB/archive/refs/heads/master.tar.gz" -o $pkgname-$pkgver.tar.xz + tar -xf $pkgname-$pkgver.tar.xz + mv oneTBB-$pkgver $pkgname-$pkgver + mkdir $pkgname-$pkgver/build + cd $pkgname-$pkgver + patch -p1 < ../../musl-malloc-proxy.patch + patch -p1 < ../../musl-rtld.patch +} + +build() { + cd $pkgname-$pkgver + cd build + cmake -G Ninja ../ \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DCMAKE_INSTALL_LIBDIR=lib \ + -DTBB_TEST=OFF \ + -DCMAKE_CXX_FLAGS=-Wno-unused-command-line-argument + samu +} + +package() { + cd $pkgname-$pkgver + cd build + DESTDIR=$pkgdir samu install +} + +license() { + cd $pkgname-$pkgver + cat LICENSE.txt +# cat COPYING +} diff --git a/pkgs/tbb/musl-malloc-proxy.patch b/pkgs/tbb/musl-malloc-proxy.patch new file mode 100644 index 0000000..410cf58 --- /dev/null +++ b/pkgs/tbb/musl-malloc-proxy.patch @@ -0,0 +1,38 @@ +--- a/src/tbbmalloc_proxy/proxy.cpp ++++ b/src/tbbmalloc_proxy/proxy.cpp +@@ -24,7 +24,8 @@ + // of aligned_alloc as required by new C++ standard, this makes it hard to + // redefine aligned_alloc here. However, running on systems with new libc + // version, it still needs it to be redefined, thus tricking system headers +-#if defined(__GLIBC_PREREQ) && !__GLIBC_PREREQ(2, 16) && _GLIBCXX_HAVE_ALIGNED_ALLOC ++#if defined(__GLIBC_PREREQ) ++#if !__GLIBC_PREREQ(2, 16) && _GLIBCXX_HAVE_ALIGNED_ALLOC + // tell that there is no aligned_alloc + #undef _GLIBCXX_HAVE_ALIGNED_ALLOC + // trick to define another symbol instead +@@ -32,7 +33,8 @@ + // Fix the state and undefine the trick + #include + #undef aligned_alloc +-#endif // defined(__GLIBC_PREREQ)&&!__GLIBC_PREREQ(2, 16)&&_GLIBCXX_HAVE_ALIGNED_ALLOC ++#endif // !__GLIBC_PREREQ(2, 16)&&_GLIBCXX_HAVE_ALIGNED_ALLOC ++#endif // defined(__GLIBC_PREREQ) + #endif // __linux__ && !__ANDROID__ + + #include "proxy.h" +@@ -253,6 +255,7 @@ + return 1; + } + ++#ifdef __GLIBC__ + struct mallinfo mallinfo() __THROW + { + struct mallinfo m; +@@ -260,6 +263,7 @@ + + return m; + } ++#endif + + #if __ANDROID__ + // Android doesn't have malloc_usable_size, provide it to be compatible diff --git a/pkgs/tbb/musl-rtld.patch b/pkgs/tbb/musl-rtld.patch new file mode 100644 index 0000000..2e8a37a --- /dev/null +++ b/pkgs/tbb/musl-rtld.patch @@ -0,0 +1,14 @@ +--- a/src/tbb/dynamic_link.cpp ++++ b/src/tbb/dynamic_link.cpp +@@ -413,9 +413,9 @@ + int flags = RTLD_NOW; + if (local_binding) { + flags = flags | RTLD_LOCAL; +-#if __linux__ && !__ANDROID__ && !__TBB_USE_ADDRESS_SANITIZER ++#if __linux__ && defined(__GLIBC__) && !__TBB_USE_ADDRESS_SANITIZER + flags = flags | RTLD_DEEPBIND; +-#endif /*__linux__ && !__ANDROID__ && !__TBB_USE_ADDRESS_SANITIZER*/ ++#endif /*__linux__ && defined(__GLIBC__) && !__TBB_USE_ADDRESS_SANITIZER*/ + } else { + flags = flags | RTLD_GLOBAL; + }