summaryrefslogtreecommitdiff
path: root/dev-cpp/tbb
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2021-10-30 19:43:03 +0100
committerV3n3RiX <venerix@koprulu.sector>2021-10-30 19:43:03 +0100
commit162945d2a91899b637bbb9e163b406350de12906 (patch)
tree49cc2cc66f724a7c6f033f93aaba4ae3be1f2259 /dev-cpp/tbb
parentf660c6de84558324d784218831d8f0782ee41e2e (diff)
gentoo resync : 30.10.2021
Diffstat (limited to 'dev-cpp/tbb')
-rw-r--r--dev-cpp/tbb/Manifest3
-rw-r--r--dev-cpp/tbb/files/tbb-2021.4.0-lto.patch247
-rw-r--r--dev-cpp/tbb/tbb-2021.4.0.ebuild37
3 files changed, 287 insertions, 0 deletions
diff --git a/dev-cpp/tbb/Manifest b/dev-cpp/tbb/Manifest
index 860716f5e2b2..9f769d8fd783 100644
--- a/dev-cpp/tbb/Manifest
+++ b/dev-cpp/tbb/Manifest
@@ -1,4 +1,7 @@
AUX tbb-2020.1-makefile-debug.patch 2640 BLAKE2B 98e1d88f279452898be78fb53235427a5c45a0056429e07acd5bc273a48c7214dc8df29c72cba344688f650fce25bba06f6f9e4dfbf1091260544e95159cf33d SHA512 9a29ff67321b75efe10621bfe924e89a5c51d4e7327e20aa69018aaea590189ed297b9ab94bd3b48172d0b093e3d2aaebfc7088b480364f6f6c7802a27d3c1e4
+AUX tbb-2021.4.0-lto.patch 9663 BLAKE2B c05245283427d6a715e835492c099bf106f1d0c3213750b4370a2ef951d90f3be00361e0f2f4632e787dd4ee78294fce3a7c3292ceaa76eb41a8597e4ce9d67b SHA512 4b6fbdfe56a5b1ee890891f9154c7d231d21619bb3260cce0a64d56d6f2f3cf7843dc62d553f36360e702a88d49a20f8fd775488800c2a5308237183535bb247
DIST tbb-2020.3.tar.gz 2639788 BLAKE2B 3e92bccdc8179fc049379ccbb8ad7f615623177abc61d813b1a601020c345137bfd7d4c4600cf5b0d587e5ebef677635c3c8124d06b05fdd3325128ed8c9f84a SHA512 04c4b5501418792827190691d03d20d4dc1fd3cbbcf459a4d40c5c2281d964e658f31f133ad3907b78e17ed04f4ff16728ed89487ed0ce2cb239f23feb34bd87
+DIST tbb-2021.4.0.tar.gz 2452533 BLAKE2B a635c6efa1894c33e2f75c1aa03b6c0f4a86ebef3b58fa42bd25b53d661ed7a9d21f49f121dd3679735f219fbfc35604600bcc72ba60d3602e6de77b0d62e37b SHA512 96da2bc351fd64dfa854f8e6cabc1c4e53af3d55760e99d6f83ad53779c727af333d13d6be0828ed70371cf796498d2063e9dd0e4b2f6451623bb5d28ccbf20b
EBUILD tbb-2020.3.ebuild 3391 BLAKE2B 518fa0a1a5ffc1b572b9366880f2e6a204e46f1751c923a76bd5cc96c69ad9bbc673bc89e23b9d46ef0c94e271d12001d0398d7e641d80a60d03fdaefa0789a5 SHA512 727e6797c6afc06f55359974add2b0578bcafa10b276bd603a8d6dc39adfe175cf89ee6c080d8543b4919bb9349adc812a4e3f39a5dcba68730acae30cc7be32
+EBUILD tbb-2021.4.0.ebuild 962 BLAKE2B cc32202a9668bde65cfd7df4ca8ea4d163c06f6beabb90c9b78a16701edab523ac30c86b26d12903efb4b7cab545c6e07ac5bfeafb95fc1b671f4acd96d0390b SHA512 920f4f0af51bbb40efb74b966fcccf9d9550d38f17533deecef6fce6d57a464b1a8b44071de5e4eeb9e4c83781179ed61d6a2c04487868e3568621ab0a324c12
MISC metadata.xml 688 BLAKE2B 5bd4c0fa3ce3f055bd8265a2133ad2b4ea6de984ccf295544f3013851b02a1f1d577070c2ecc1e2748fa8356d3d25278e9a8649a2523763eba6bc7e6ba830f79 SHA512 93b90fc74511f35e02dd7f7c7b3aeb08d2e4c88e2af852fcce40bdb780a3828975955b751542b8a9d3aa0561155858b91842f3cf98c713dcb08c9ce2152f0fe3
diff --git a/dev-cpp/tbb/files/tbb-2021.4.0-lto.patch b/dev-cpp/tbb/files/tbb-2021.4.0-lto.patch
new file mode 100644
index 000000000000..5be97b90605d
--- /dev/null
+++ b/dev-cpp/tbb/files/tbb-2021.4.0-lto.patch
@@ -0,0 +1,247 @@
+From 6feeba8035ea2bdf652d473a35730b19427752db Mon Sep 17 00:00:00 2001
+From: Ivan Kochin <kochin.ivan@intel.com>
+Date: Wed, 27 Oct 2021 17:23:32 +0300
+Subject: [PATCH] Use native CMake way to detect the IPO support (#608)
+
+* Use native CMake way to detect the IPO support
+
+Signed-off-by: Kochin Ivan <kochin.ivan@intel.com>
+---
+ CMakeLists.txt | 17 +++++++++++++++++
+ cmake/README.md | 1 +
+ cmake/compilers/Clang.cmake | 8 ++------
+ cmake/compilers/GNU.cmake | 8 +++-----
+ cmake/compilers/MSVC.cmake | 1 +
+ cmake/utils.cmake | 13 +++++++++++++
+ src/tbb/CMakeLists.txt | 5 ++---
+ src/tbbbind/CMakeLists.txt | 6 +++---
+ src/tbbmalloc/CMakeLists.txt | 5 ++---
+ 9 files changed, 44 insertions(+), 20 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 13b1dbc2c..4dbdadb97 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -103,6 +103,7 @@ option(TBBMALLOC_BUILD "Enable tbbmalloc build" ON)
+ option(TBB_CPF "Enable preview features of the library" OFF)
+ option(TBB_FIND_PACKAGE "Enable search for external oneTBB using find_package instead of build from sources" OFF)
+ option(TBB_DISABLE_HWLOC_AUTOMATIC_SEARCH "Disable HWLOC automatic search by pkg-config tool" OFF)
++option(TBB_ENABLE_IPO "Enable Interprocedural Optimization (IPO) during the compilation" ON)
+
+ if (NOT DEFINED BUILD_SHARED_LIBS)
+ set(BUILD_SHARED_LIBS ON)
+@@ -181,6 +182,22 @@ foreach(FILE_WITH_EXTRA_TARGETS ${FILES_WITH_EXTRA_TARGETS})
+ include(${FILE_WITH_EXTRA_TARGETS})
+ endforeach()
+
++# - Enabling LTO on Android causes the NDK bug.
++# NDK throws the warning: "argument unused during compilation: '-Wa,--noexecstack'"
++# - For some reason GCC does not instrument code with Thread Sanitizer when lto is enabled and C linker is used.
++if (TBB_ENABLE_IPO AND BUILD_SHARED_LIBS AND NOT ANDROID_PLATFORM AND NOT TBB_SANITIZE MATCHES "thread")
++ if (NOT CMAKE_VERSION VERSION_LESS 3.9)
++ cmake_policy(SET CMP0069 NEW)
++ include(CheckIPOSupported)
++ check_ipo_supported(RESULT TBB_IPO_PROPERTY)
++ else()
++ set(TBB_IPO_FLAGS TRUE)
++ endif()
++ if (TBB_IPO_PROPERTY OR TBB_IPO_FLAGS)
++ message(STATUS "IPO enabled")
++ endif()
++endif()
++
+ set(TBB_COMPILER_SETTINGS_FILE ${CMAKE_CURRENT_SOURCE_DIR}/cmake/compilers/${CMAKE_CXX_COMPILER_ID}.cmake)
+ if (EXISTS ${TBB_COMPILER_SETTINGS_FILE})
+ include(${TBB_COMPILER_SETTINGS_FILE})
+diff --git a/cmake/README.md b/cmake/README.md
+index ec56e423c..ed1631de3 100644
+--- a/cmake/README.md
++++ b/cmake/README.md
+@@ -16,6 +16,7 @@ TBB_CPF:BOOL - Enable preview features of the library (OFF by default)
+ TBB_INSTALL_VARS:BOOL - Enable auto-generated vars installation(packages generated by `cpack` and `make install` will also include the vars script)(OFF by default)
+ TBB_VALGRIND_MEMCHECK:BOOL - Enable scan for memory leaks using Valgrind (OFF by default)
+ TBB_DISABLE_HWLOC_AUTOMATIC_SEARCH - Disable HWLOC automatic search by pkg-config tool (OFF by default)
++TBB_ENABLE_IPO - Enable Interprocedural Optimization (IPO) during the compilation (ON by default)
+ ```
+
+ ## Configure, build and test
+diff --git a/cmake/compilers/Clang.cmake b/cmake/compilers/Clang.cmake
+index 183341fcc..69aa51932 100644
+--- a/cmake/compilers/Clang.cmake
++++ b/cmake/compilers/Clang.cmake
+@@ -58,12 +58,8 @@ if (MINGW)
+ list(APPEND TBB_COMMON_COMPILE_FLAGS -U__STRICT_ANSI__)
+ endif()
+
+-# Enabling LTO on Android causes the NDK bug.
+-# NDK throws the warning: "argument unused during compilation: '-Wa,--noexecstack'"
+-if (NOT ANDROID_PLATFORM AND BUILD_SHARED_LIBS)
+- set(TBB_IPO_COMPILE_FLAGS $<$<NOT:$<CONFIG:Debug>>:-flto>)
+- set(TBB_IPO_LINK_FLAGS $<$<NOT:$<CONFIG:Debug>>:-flto>)
+-endif()
++set(TBB_IPO_COMPILE_FLAGS $<$<NOT:$<CONFIG:Debug>>:-flto>)
++set(TBB_IPO_LINK_FLAGS $<$<NOT:$<CONFIG:Debug>>:-flto>)
+
+ # TBB malloc settings
+ set(TBBMALLOC_LIB_COMPILE_FLAGS -fno-rtti -fno-exceptions)
+diff --git a/cmake/compilers/GNU.cmake b/cmake/compilers/GNU.cmake
+index fa14c869e..a9cfa8927 100644
+--- a/cmake/compilers/GNU.cmake
++++ b/cmake/compilers/GNU.cmake
+@@ -63,11 +63,9 @@ if (MINGW)
+ list(APPEND TBB_COMMON_COMPILE_FLAGS -U__STRICT_ANSI__)
+ endif()
+
+-# For some reason GCC does not instrument code with Thread Sanitizer when lto is enabled and C linker is used.
+-if (NOT TBB_SANITIZE MATCHES "thread")
+- set(TBB_IPO_COMPILE_FLAGS $<$<NOT:$<CONFIG:Debug>>:-flto>)
+- set(TBB_IPO_LINK_FLAGS $<$<NOT:$<CONFIG:Debug>>:-flto>)
+-endif()
++set(TBB_IPO_COMPILE_FLAGS $<$<NOT:$<CONFIG:Debug>>:-flto>)
++set(TBB_IPO_LINK_FLAGS $<$<NOT:$<CONFIG:Debug>>:-flto>)
++
+
+ # TBB malloc settings
+ set(TBBMALLOC_LIB_COMPILE_FLAGS -fno-rtti -fno-exceptions)
+diff --git a/cmake/compilers/MSVC.cmake b/cmake/compilers/MSVC.cmake
+index 3447418cc..5767235a0 100644
+--- a/cmake/compilers/MSVC.cmake
++++ b/cmake/compilers/MSVC.cmake
+@@ -77,6 +77,7 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "(Clang|IntelLLVM)")
+ endif()
+ set(TBB_OPENMP_NO_LINK_FLAG TRUE)
+ set(TBB_IPO_COMPILE_FLAGS $<$<NOT:$<CONFIG:Debug>>:-flto>)
++ set(TBB_IPO_LINK_FLAGS $<$<NOT:$<CONFIG:Debug>>:-flto>)
+ else()
+ set(TBB_IPO_COMPILE_FLAGS $<$<NOT:$<CONFIG:Debug>>:/GL>)
+ set(TBB_IPO_LINK_FLAGS $<$<NOT:$<CONFIG:Debug>>:-LTCG> $<$<NOT:$<CONFIG:Debug>>:-INCREMENTAL:NO>)
+diff --git a/cmake/utils.cmake b/cmake/utils.cmake
+index 06d3a9aee..f74abfcf9 100644
+--- a/cmake/utils.cmake
++++ b/cmake/utils.cmake
+@@ -44,3 +44,16 @@ macro(tbb_install_target target)
+ COMPONENT devel)
+ endif()
+ endmacro()
++
++macro(tbb_handle_ipo target)
++ if (TBB_IPO_PROPERTY)
++ set_target_properties(${target} PROPERTIES INTERPROCEDURAL_OPTIMIZATION TRUE)
++ elseif (TBB_IPO_FLAGS)
++ target_compile_options(${target} PRIVATE ${TBB_IPO_COMPILE_FLAGS})
++ if (COMMAND target_link_options)
++ target_link_options(${target} PRIVATE ${TBB_IPO_LINK_FLAGS})
++ else()
++ target_link_libraries(${target} PRIVATE ${TBB_IPO_LINK_FLAGS})
++ endif()
++ endif()
++endmacro()
+diff --git a/src/tbb/CMakeLists.txt b/src/tbb/CMakeLists.txt
+index 80fdcdcde..021392d89 100644
+--- a/src/tbb/CMakeLists.txt
++++ b/src/tbb/CMakeLists.txt
+@@ -79,7 +79,6 @@ target_compile_options(tbb
+ ${TBB_WARNING_SUPPRESS}
+ ${TBB_LIB_COMPILE_FLAGS}
+ ${TBB_COMMON_COMPILE_FLAGS}
+- ${TBB_IPO_COMPILE_FLAGS}
+ )
+
+ # Avoid use of target_link_libraries here as it changes /DEF option to \DEF on Windows.
+@@ -89,6 +88,8 @@ set_target_properties(tbb PROPERTIES
+ SOVERSION ${TBB_BINARY_VERSION}
+ )
+
++tbb_handle_ipo(tbb)
++
+ if (TBB_DEF_FILE_PREFIX) # If there's no prefix, assume we're using export directives
+ set_target_properties(tbb PROPERTIES
+ LINK_FLAGS ${TBB_LINK_DEF_FILE_FLAG}${CMAKE_CURRENT_SOURCE_DIR}/def/${TBB_DEF_FILE_PREFIX}-tbb.def
+@@ -103,14 +104,12 @@ if (COMMAND target_link_options)
+ PRIVATE
+ ${TBB_LIB_LINK_FLAGS}
+ ${TBB_COMMON_LINK_FLAGS}
+- ${TBB_IPO_LINK_FLAGS}
+ )
+ else()
+ target_link_libraries(tbb
+ PRIVATE
+ ${TBB_LIB_LINK_FLAGS}
+ ${TBB_COMMON_LINK_FLAGS}
+- ${TBB_IPO_LINK_FLAGS}
+ )
+ endif()
+
+diff --git a/src/tbbbind/CMakeLists.txt b/src/tbbbind/CMakeLists.txt
+index 99b7ccaac..3233ec718 100644
+--- a/src/tbbbind/CMakeLists.txt
++++ b/src/tbbbind/CMakeLists.txt
+@@ -46,7 +46,6 @@ function(tbbbind_build TBBBIND_NAME REQUIRED_HWLOC_TARGET)
+ ${TBB_WARNING_LEVEL}
+ ${TBB_LIB_COMPILE_FLAGS}
+ ${TBB_COMMON_COMPILE_FLAGS}
+- ${TBB_IPO_COMPILE_FLAGS}
+ )
+
+ # Avoid use of target_link_libraries here as it changes /DEF option to \DEF on Windows.
+@@ -55,6 +54,9 @@ function(tbbbind_build TBBBIND_NAME REQUIRED_HWLOC_TARGET)
+ VERSION ${TBBBIND_BINARY_VERSION}.${TBB_BINARY_MINOR_VERSION}
+ SOVERSION ${TBBBIND_BINARY_VERSION}
+ )
++
++ tbb_handle_ipo(${TBBBIND_NAME})
++
+ if (TBB_DEF_FILE_PREFIX) # If there's no prefix, assume we're using export directives
+ set_target_properties(${TBBBIND_NAME} PROPERTIES
+ LINK_FLAGS ${TBB_LINK_DEF_FILE_FLAG}${CMAKE_CURRENT_SOURCE_DIR}/def/${TBB_DEF_FILE_PREFIX}-tbbbind.def
+@@ -69,14 +71,12 @@ function(tbbbind_build TBBBIND_NAME REQUIRED_HWLOC_TARGET)
+ PRIVATE
+ ${TBB_LIB_LINK_FLAGS}
+ ${TBB_COMMON_LINK_FLAGS}
+- ${TBB_IPO_LINK_FLAGS}
+ )
+ else()
+ target_link_libraries(${TBBBIND_NAME}
+ PRIVATE
+ ${TBB_LIB_LINK_FLAGS}
+ ${TBB_COMMON_LINK_FLAGS}
+- ${TBB_IPO_LINK_FLAGS}
+ )
+ endif()
+
+diff --git a/src/tbbmalloc/CMakeLists.txt b/src/tbbmalloc/CMakeLists.txt
+index f77bc8f10..5a851851f 100644
+--- a/src/tbbmalloc/CMakeLists.txt
++++ b/src/tbbmalloc/CMakeLists.txt
+@@ -59,7 +59,6 @@ target_compile_options(tbbmalloc
+ ${TBB_LIB_COMPILE_FLAGS}
+ ${TBBMALLOC_LIB_COMPILE_FLAGS}
+ ${TBB_COMMON_COMPILE_FLAGS}
+- ${TBB_IPO_COMPILE_FLAGS}
+ )
+
+ enable_language(C)
+@@ -72,6 +71,8 @@ set_target_properties(tbbmalloc PROPERTIES
+ LINKER_LANGUAGE C
+ )
+
++tbb_handle_ipo(tbbmalloc)
++
+ if (TBB_DEF_FILE_PREFIX) # If there's no prefix, assume we're using export directives
+ set_target_properties(tbbmalloc PROPERTIES
+ LINK_FLAGS ${TBB_LINK_DEF_FILE_FLAG}${CMAKE_CURRENT_SOURCE_DIR}/def/${TBB_DEF_FILE_PREFIX}-tbbmalloc.def
+@@ -88,14 +89,12 @@ if (COMMAND target_link_options)
+ PRIVATE
+ ${TBB_LIB_LINK_FLAGS}
+ ${TBB_COMMON_LINK_FLAGS}
+- ${TBB_IPO_LINK_FLAGS}
+ )
+ else()
+ target_link_libraries(tbbmalloc
+ PRIVATE
+ ${TBB_LIB_LINK_FLAGS}
+ ${TBB_COMMON_LINK_FLAGS}
+- ${TBB_IPO_LINK_FLAGS}
+ )
+ endif()
+
diff --git a/dev-cpp/tbb/tbb-2021.4.0.ebuild b/dev-cpp/tbb/tbb-2021.4.0.ebuild
new file mode 100644
index 000000000000..9a99edb24ae8
--- /dev/null
+++ b/dev-cpp/tbb/tbb-2021.4.0.ebuild
@@ -0,0 +1,37 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit cmake-multilib flag-o-matic toolchain-funcs
+
+DESCRIPTION="High level abstract threading library"
+HOMEPAGE="https://www.threadingbuildingblocks.org"
+SRC_URI="https://github.com/oneapi-src/oneTBB/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz"
+S="${WORKDIR}/oneTBB-${PV}"
+
+LICENSE="Apache-2.0"
+# https://github.com/oneapi-src/oneTBB/blob/master/CMakeLists.txt#L53
+# libtbb<SONAME>-libtbbmalloc<SONAME>-libtbbbind<SONAME>
+SLOT="0/12-2-3"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc ~ppc64 ~riscv ~sparc ~x86 ~amd64-linux ~x86-linux"
+IUSE="test"
+RESTRICT="!test? ( test )"
+
+RDEPEND="sys-apps/hwloc:="
+DEPEND="${RDEPEND}"
+BDEPEND="virtual/pkgconfig"
+
+PATCHES=(
+ "${FILESDIR}"/${P}-lto.patch
+)
+
+src_configure() {
+ local mycmakeargs=(
+ -DTBB_TEST=$(usex test)
+ -DTBB_ENABLE_IPO=OFF
+ -DTBB_STRICT=OFF
+ )
+
+ cmake-multilib_src_configure
+}