Browse Source

Update tbb 2022.0 (#5931)

* Update tbb 2022.0

See if the package can pass ci

* Create fix-mingw-compilation.patch

* add patch

test fix-mingw-compilation.patch
Altina Orion 9 months ago
parent
commit
1bb029de8e

+ 49 - 0
packages/t/tbb/patches/2022.0.0/fix-mingw-compilation.patch

@@ -0,0 +1,49 @@
+diff --git a/cmake/compilers/Clang.cmake b/cmake/compilers/Clang.cmake
+index dcd66634..c8f67d4a 100644
+--- a/cmake/compilers/Clang.cmake
++++ b/cmake/compilers/Clang.cmake
+@@ -66,7 +66,7 @@ endif()
+ set(TBB_COMMON_COMPILE_FLAGS ${TBB_COMMON_COMPILE_FLAGS} -Wformat -Wformat-security -Werror=format-security -fPIC $<$<NOT:$<BOOL:${EMSCRIPTEN}>>:-fstack-protector-strong>)
+ 
+ # -z switch is not supported on MacOS
+-if (NOT APPLE)
++if (NOT APPLE AND NOT MINGW)
+     set(TBB_LIB_LINK_FLAGS ${TBB_LIB_LINK_FLAGS} -Wl,-z,relro,-z,now)
+ endif()
+ 
+diff --git a/cmake/compilers/GNU.cmake b/cmake/compilers/GNU.cmake
+index cf6d8bdb..8f4dbc7f 100644
+--- a/cmake/compilers/GNU.cmake
++++ b/cmake/compilers/GNU.cmake
+@@ -36,6 +36,10 @@ if (NOT CMAKE_GENERATOR MATCHES "Ninja" AND NOT CMAKE_CXX_DEPENDS_USE_COMPILER)
+ endif()
+ 
+ 
++if(MINGW)
++  set(_tbb_gnu_asm_major_version "2")
++  set(_tbb_gnu_asm_minor_version "43")
++else()
+ # Binutils < 2.31.1 do not support the tpause instruction. When compiling with
+ # a modern version of GCC (supporting it) but relying on an outdated assembler,
+ # will result in an error reporting "no such instruction: tpause".
+@@ -61,6 +65,7 @@ unset(ASSEMBLER_VERSION_LINE_OUT)
+ unset(ASSEMBLER_VERSION_LINE_ERR)
+ unset(ASSEMBLER_VERSION_LINE)
+ message(TRACE "Extracted GNU assembler version: major=${_tbb_gnu_asm_major_version} minor=${_tbb_gnu_asm_minor_version}")
++endif()
+ 
+ math(EXPR _tbb_gnu_asm_version_number  "${_tbb_gnu_asm_major_version} * 1000 + ${_tbb_gnu_asm_minor_version}")
+ set(TBB_COMMON_COMPILE_FLAGS ${TBB_COMMON_COMPILE_FLAGS} "-D__TBB_GNU_ASM_VERSION=${_tbb_gnu_asm_version_number}")
+diff --git a/include/oneapi/tbb/profiling.h b/include/oneapi/tbb/profiling.h
+index 412b5a35..fccaba5f 100644
+--- a/include/oneapi/tbb/profiling.h
++++ b/include/oneapi/tbb/profiling.h
+@@ -132,7 +132,7 @@ namespace d1 {
+         r1::call_itt_notify(static_cast<int>(t), ptr);
+     }
+ 
+-#if (_WIN32||_WIN64) && !__MINGW32__
++#if (_WIN32||_WIN64)
+     inline void itt_set_sync_name(void* obj, const wchar_t* name) {
+         r1::itt_set_sync_name(obj, name);
+     }

+ 5 - 2
packages/t/tbb/xmake.lua

@@ -22,6 +22,7 @@ package("tbb")
         add_versions("2021.11.0", "782ce0cab62df9ea125cdea253a50534862b563f1d85d4cda7ad4e77550ac363")
         add_versions("2021.12.0", "c7bb7aa69c254d91b8f0041a71c5bcc3936acb64408a1719aec0b2b7639dd84f")
         add_versions("2021.13.0", "3ad5dd08954b39d113dc5b3f8a8dc6dc1fd5250032b7c491eb07aed5c94133e1")
+        add_versions("2022.0.0", "e8e89c9c345415b17b30a2db3095ba9d47647611662073f7fbf54ad48b7f3c2a")
     else
         add_urls("https://github.com/oneapi-src/oneTBB/archive/refs/tags/v$(version).tar.gz")
         add_versions("2020.3", "ebc4f6aa47972daed1f7bf71d100ae5bf6931c2e3144cf299c8cc7d041dca2f3")
@@ -34,11 +35,13 @@ package("tbb")
         add_versions("2021.11.0", "782ce0cab62df9ea125cdea253a50534862b563f1d85d4cda7ad4e77550ac363")
         add_versions("2021.12.0", "c7bb7aa69c254d91b8f0041a71c5bcc3936acb64408a1719aec0b2b7639dd84f")
         add_versions("2021.13.0", "3ad5dd08954b39d113dc5b3f8a8dc6dc1fd5250032b7c491eb07aed5c94133e1")
-    
+        add_versions("2022.0.0", "e8e89c9c345415b17b30a2db3095ba9d47647611662073f7fbf54ad48b7f3c2a")
+        
         add_patches("2020.3", "patches/2020.3/gcc13.patch", "419557beb877a72fa394c886fbb674c1b0c300fee7f2ec4e2de39ceeeb6b95fd")
         add_patches("2021.2.0", "patches/2021.2.0/gcc11.patch", "181511cf4878460cb48ac0531d3ce8d1c57626d698e9001a0951c728fab176fb")
         add_patches("2021.5.0", "patches/2021.5.0/i386.patch", "1a1c11724839cf98b1b8f4d415c0283ec7719c330b11503c578739eb02889ec0")
-
+        add_patches("2022.0.0", "patches/2022.0.0/fix-mingw-compilation.patch", "917999038883152acd2e8b59edbc67081d4c9cb6a15113ce28d38274fe8fb0d9")
+        
         if is_plat("macosx") then
             add_configs("compiler", {description = "Compiler used to compile tbb." , default = "clang", type = "string", values = {"clang", "gcc", "icc", "cl", "icl", "[others]"}})
         else