1 |
commit: d54c2c9388acb851a5bd7c48962bb7b68ca5d39c |
2 |
Author: Sam James <sam <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Oct 29 21:21:59 2021 +0000 |
4 |
Commit: Sam James <sam <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Oct 29 22:22:31 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d54c2c93 |
7 |
|
8 |
dev-cpp/tbb: add 2021.4.0 |
9 |
|
10 |
Bug: https://bugs.gentoo.org/713582 |
11 |
Signed-off-by: Sam James <sam <AT> gentoo.org> |
12 |
|
13 |
dev-cpp/tbb/Manifest | 1 + |
14 |
dev-cpp/tbb/files/tbb-2021.4.0-lto.patch | 247 +++++++++++++++++++++++++++++++ |
15 |
dev-cpp/tbb/tbb-2021.4.0.ebuild | 37 +++++ |
16 |
3 files changed, 285 insertions(+) |
17 |
|
18 |
diff --git a/dev-cpp/tbb/Manifest b/dev-cpp/tbb/Manifest |
19 |
index d2d3f1d78cf..fee2e0bbf7f 100644 |
20 |
--- a/dev-cpp/tbb/Manifest |
21 |
+++ b/dev-cpp/tbb/Manifest |
22 |
@@ -1 +1,2 @@ |
23 |
DIST tbb-2020.3.tar.gz 2639788 BLAKE2B 3e92bccdc8179fc049379ccbb8ad7f615623177abc61d813b1a601020c345137bfd7d4c4600cf5b0d587e5ebef677635c3c8124d06b05fdd3325128ed8c9f84a SHA512 04c4b5501418792827190691d03d20d4dc1fd3cbbcf459a4d40c5c2281d964e658f31f133ad3907b78e17ed04f4ff16728ed89487ed0ce2cb239f23feb34bd87 |
24 |
+DIST tbb-2021.4.0.tar.gz 2452533 BLAKE2B a635c6efa1894c33e2f75c1aa03b6c0f4a86ebef3b58fa42bd25b53d661ed7a9d21f49f121dd3679735f219fbfc35604600bcc72ba60d3602e6de77b0d62e37b SHA512 96da2bc351fd64dfa854f8e6cabc1c4e53af3d55760e99d6f83ad53779c727af333d13d6be0828ed70371cf796498d2063e9dd0e4b2f6451623bb5d28ccbf20b |
25 |
|
26 |
diff --git a/dev-cpp/tbb/files/tbb-2021.4.0-lto.patch b/dev-cpp/tbb/files/tbb-2021.4.0-lto.patch |
27 |
new file mode 100644 |
28 |
index 00000000000..5be97b90605 |
29 |
--- /dev/null |
30 |
+++ b/dev-cpp/tbb/files/tbb-2021.4.0-lto.patch |
31 |
@@ -0,0 +1,247 @@ |
32 |
+From 6feeba8035ea2bdf652d473a35730b19427752db Mon Sep 17 00:00:00 2001 |
33 |
+From: Ivan Kochin <kochin.ivan@×××××.com> |
34 |
+Date: Wed, 27 Oct 2021 17:23:32 +0300 |
35 |
+Subject: [PATCH] Use native CMake way to detect the IPO support (#608) |
36 |
+ |
37 |
+* Use native CMake way to detect the IPO support |
38 |
+ |
39 |
+Signed-off-by: Kochin Ivan <kochin.ivan@×××××.com> |
40 |
+--- |
41 |
+ CMakeLists.txt | 17 +++++++++++++++++ |
42 |
+ cmake/README.md | 1 + |
43 |
+ cmake/compilers/Clang.cmake | 8 ++------ |
44 |
+ cmake/compilers/GNU.cmake | 8 +++----- |
45 |
+ cmake/compilers/MSVC.cmake | 1 + |
46 |
+ cmake/utils.cmake | 13 +++++++++++++ |
47 |
+ src/tbb/CMakeLists.txt | 5 ++--- |
48 |
+ src/tbbbind/CMakeLists.txt | 6 +++--- |
49 |
+ src/tbbmalloc/CMakeLists.txt | 5 ++--- |
50 |
+ 9 files changed, 44 insertions(+), 20 deletions(-) |
51 |
+ |
52 |
+diff --git a/CMakeLists.txt b/CMakeLists.txt |
53 |
+index 13b1dbc2c..4dbdadb97 100644 |
54 |
+--- a/CMakeLists.txt |
55 |
++++ b/CMakeLists.txt |
56 |
+@@ -103,6 +103,7 @@ option(TBBMALLOC_BUILD "Enable tbbmalloc build" ON) |
57 |
+ option(TBB_CPF "Enable preview features of the library" OFF) |
58 |
+ option(TBB_FIND_PACKAGE "Enable search for external oneTBB using find_package instead of build from sources" OFF) |
59 |
+ option(TBB_DISABLE_HWLOC_AUTOMATIC_SEARCH "Disable HWLOC automatic search by pkg-config tool" OFF) |
60 |
++option(TBB_ENABLE_IPO "Enable Interprocedural Optimization (IPO) during the compilation" ON) |
61 |
+ |
62 |
+ if (NOT DEFINED BUILD_SHARED_LIBS) |
63 |
+ set(BUILD_SHARED_LIBS ON) |
64 |
+@@ -181,6 +182,22 @@ foreach(FILE_WITH_EXTRA_TARGETS ${FILES_WITH_EXTRA_TARGETS}) |
65 |
+ include(${FILE_WITH_EXTRA_TARGETS}) |
66 |
+ endforeach() |
67 |
+ |
68 |
++# - Enabling LTO on Android causes the NDK bug. |
69 |
++# NDK throws the warning: "argument unused during compilation: '-Wa,--noexecstack'" |
70 |
++# - For some reason GCC does not instrument code with Thread Sanitizer when lto is enabled and C linker is used. |
71 |
++if (TBB_ENABLE_IPO AND BUILD_SHARED_LIBS AND NOT ANDROID_PLATFORM AND NOT TBB_SANITIZE MATCHES "thread") |
72 |
++ if (NOT CMAKE_VERSION VERSION_LESS 3.9) |
73 |
++ cmake_policy(SET CMP0069 NEW) |
74 |
++ include(CheckIPOSupported) |
75 |
++ check_ipo_supported(RESULT TBB_IPO_PROPERTY) |
76 |
++ else() |
77 |
++ set(TBB_IPO_FLAGS TRUE) |
78 |
++ endif() |
79 |
++ if (TBB_IPO_PROPERTY OR TBB_IPO_FLAGS) |
80 |
++ message(STATUS "IPO enabled") |
81 |
++ endif() |
82 |
++endif() |
83 |
++ |
84 |
+ set(TBB_COMPILER_SETTINGS_FILE ${CMAKE_CURRENT_SOURCE_DIR}/cmake/compilers/${CMAKE_CXX_COMPILER_ID}.cmake) |
85 |
+ if (EXISTS ${TBB_COMPILER_SETTINGS_FILE}) |
86 |
+ include(${TBB_COMPILER_SETTINGS_FILE}) |
87 |
+diff --git a/cmake/README.md b/cmake/README.md |
88 |
+index ec56e423c..ed1631de3 100644 |
89 |
+--- a/cmake/README.md |
90 |
++++ b/cmake/README.md |
91 |
+@@ -16,6 +16,7 @@ TBB_CPF:BOOL - Enable preview features of the library (OFF by default) |
92 |
+ 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) |
93 |
+ TBB_VALGRIND_MEMCHECK:BOOL - Enable scan for memory leaks using Valgrind (OFF by default) |
94 |
+ TBB_DISABLE_HWLOC_AUTOMATIC_SEARCH - Disable HWLOC automatic search by pkg-config tool (OFF by default) |
95 |
++TBB_ENABLE_IPO - Enable Interprocedural Optimization (IPO) during the compilation (ON by default) |
96 |
+ ``` |
97 |
+ |
98 |
+ ## Configure, build and test |
99 |
+diff --git a/cmake/compilers/Clang.cmake b/cmake/compilers/Clang.cmake |
100 |
+index 183341fcc..69aa51932 100644 |
101 |
+--- a/cmake/compilers/Clang.cmake |
102 |
++++ b/cmake/compilers/Clang.cmake |
103 |
+@@ -58,12 +58,8 @@ if (MINGW) |
104 |
+ list(APPEND TBB_COMMON_COMPILE_FLAGS -U__STRICT_ANSI__) |
105 |
+ endif() |
106 |
+ |
107 |
+-# Enabling LTO on Android causes the NDK bug. |
108 |
+-# NDK throws the warning: "argument unused during compilation: '-Wa,--noexecstack'" |
109 |
+-if (NOT ANDROID_PLATFORM AND BUILD_SHARED_LIBS) |
110 |
+- set(TBB_IPO_COMPILE_FLAGS $<$<NOT:$<CONFIG:Debug>>:-flto>) |
111 |
+- set(TBB_IPO_LINK_FLAGS $<$<NOT:$<CONFIG:Debug>>:-flto>) |
112 |
+-endif() |
113 |
++set(TBB_IPO_COMPILE_FLAGS $<$<NOT:$<CONFIG:Debug>>:-flto>) |
114 |
++set(TBB_IPO_LINK_FLAGS $<$<NOT:$<CONFIG:Debug>>:-flto>) |
115 |
+ |
116 |
+ # TBB malloc settings |
117 |
+ set(TBBMALLOC_LIB_COMPILE_FLAGS -fno-rtti -fno-exceptions) |
118 |
+diff --git a/cmake/compilers/GNU.cmake b/cmake/compilers/GNU.cmake |
119 |
+index fa14c869e..a9cfa8927 100644 |
120 |
+--- a/cmake/compilers/GNU.cmake |
121 |
++++ b/cmake/compilers/GNU.cmake |
122 |
+@@ -63,11 +63,9 @@ if (MINGW) |
123 |
+ list(APPEND TBB_COMMON_COMPILE_FLAGS -U__STRICT_ANSI__) |
124 |
+ endif() |
125 |
+ |
126 |
+-# For some reason GCC does not instrument code with Thread Sanitizer when lto is enabled and C linker is used. |
127 |
+-if (NOT TBB_SANITIZE MATCHES "thread") |
128 |
+- set(TBB_IPO_COMPILE_FLAGS $<$<NOT:$<CONFIG:Debug>>:-flto>) |
129 |
+- set(TBB_IPO_LINK_FLAGS $<$<NOT:$<CONFIG:Debug>>:-flto>) |
130 |
+-endif() |
131 |
++set(TBB_IPO_COMPILE_FLAGS $<$<NOT:$<CONFIG:Debug>>:-flto>) |
132 |
++set(TBB_IPO_LINK_FLAGS $<$<NOT:$<CONFIG:Debug>>:-flto>) |
133 |
++ |
134 |
+ |
135 |
+ # TBB malloc settings |
136 |
+ set(TBBMALLOC_LIB_COMPILE_FLAGS -fno-rtti -fno-exceptions) |
137 |
+diff --git a/cmake/compilers/MSVC.cmake b/cmake/compilers/MSVC.cmake |
138 |
+index 3447418cc..5767235a0 100644 |
139 |
+--- a/cmake/compilers/MSVC.cmake |
140 |
++++ b/cmake/compilers/MSVC.cmake |
141 |
+@@ -77,6 +77,7 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "(Clang|IntelLLVM)") |
142 |
+ endif() |
143 |
+ set(TBB_OPENMP_NO_LINK_FLAG TRUE) |
144 |
+ set(TBB_IPO_COMPILE_FLAGS $<$<NOT:$<CONFIG:Debug>>:-flto>) |
145 |
++ set(TBB_IPO_LINK_FLAGS $<$<NOT:$<CONFIG:Debug>>:-flto>) |
146 |
+ else() |
147 |
+ set(TBB_IPO_COMPILE_FLAGS $<$<NOT:$<CONFIG:Debug>>:/GL>) |
148 |
+ set(TBB_IPO_LINK_FLAGS $<$<NOT:$<CONFIG:Debug>>:-LTCG> $<$<NOT:$<CONFIG:Debug>>:-INCREMENTAL:NO>) |
149 |
+diff --git a/cmake/utils.cmake b/cmake/utils.cmake |
150 |
+index 06d3a9aee..f74abfcf9 100644 |
151 |
+--- a/cmake/utils.cmake |
152 |
++++ b/cmake/utils.cmake |
153 |
+@@ -44,3 +44,16 @@ macro(tbb_install_target target) |
154 |
+ COMPONENT devel) |
155 |
+ endif() |
156 |
+ endmacro() |
157 |
++ |
158 |
++macro(tbb_handle_ipo target) |
159 |
++ if (TBB_IPO_PROPERTY) |
160 |
++ set_target_properties(${target} PROPERTIES INTERPROCEDURAL_OPTIMIZATION TRUE) |
161 |
++ elseif (TBB_IPO_FLAGS) |
162 |
++ target_compile_options(${target} PRIVATE ${TBB_IPO_COMPILE_FLAGS}) |
163 |
++ if (COMMAND target_link_options) |
164 |
++ target_link_options(${target} PRIVATE ${TBB_IPO_LINK_FLAGS}) |
165 |
++ else() |
166 |
++ target_link_libraries(${target} PRIVATE ${TBB_IPO_LINK_FLAGS}) |
167 |
++ endif() |
168 |
++ endif() |
169 |
++endmacro() |
170 |
+diff --git a/src/tbb/CMakeLists.txt b/src/tbb/CMakeLists.txt |
171 |
+index 80fdcdcde..021392d89 100644 |
172 |
+--- a/src/tbb/CMakeLists.txt |
173 |
++++ b/src/tbb/CMakeLists.txt |
174 |
+@@ -79,7 +79,6 @@ target_compile_options(tbb |
175 |
+ ${TBB_WARNING_SUPPRESS} |
176 |
+ ${TBB_LIB_COMPILE_FLAGS} |
177 |
+ ${TBB_COMMON_COMPILE_FLAGS} |
178 |
+- ${TBB_IPO_COMPILE_FLAGS} |
179 |
+ ) |
180 |
+ |
181 |
+ # Avoid use of target_link_libraries here as it changes /DEF option to \DEF on Windows. |
182 |
+@@ -89,6 +88,8 @@ set_target_properties(tbb PROPERTIES |
183 |
+ SOVERSION ${TBB_BINARY_VERSION} |
184 |
+ ) |
185 |
+ |
186 |
++tbb_handle_ipo(tbb) |
187 |
++ |
188 |
+ if (TBB_DEF_FILE_PREFIX) # If there's no prefix, assume we're using export directives |
189 |
+ set_target_properties(tbb PROPERTIES |
190 |
+ LINK_FLAGS ${TBB_LINK_DEF_FILE_FLAG}${CMAKE_CURRENT_SOURCE_DIR}/def/${TBB_DEF_FILE_PREFIX}-tbb.def |
191 |
+@@ -103,14 +104,12 @@ if (COMMAND target_link_options) |
192 |
+ PRIVATE |
193 |
+ ${TBB_LIB_LINK_FLAGS} |
194 |
+ ${TBB_COMMON_LINK_FLAGS} |
195 |
+- ${TBB_IPO_LINK_FLAGS} |
196 |
+ ) |
197 |
+ else() |
198 |
+ target_link_libraries(tbb |
199 |
+ PRIVATE |
200 |
+ ${TBB_LIB_LINK_FLAGS} |
201 |
+ ${TBB_COMMON_LINK_FLAGS} |
202 |
+- ${TBB_IPO_LINK_FLAGS} |
203 |
+ ) |
204 |
+ endif() |
205 |
+ |
206 |
+diff --git a/src/tbbbind/CMakeLists.txt b/src/tbbbind/CMakeLists.txt |
207 |
+index 99b7ccaac..3233ec718 100644 |
208 |
+--- a/src/tbbbind/CMakeLists.txt |
209 |
++++ b/src/tbbbind/CMakeLists.txt |
210 |
+@@ -46,7 +46,6 @@ function(tbbbind_build TBBBIND_NAME REQUIRED_HWLOC_TARGET) |
211 |
+ ${TBB_WARNING_LEVEL} |
212 |
+ ${TBB_LIB_COMPILE_FLAGS} |
213 |
+ ${TBB_COMMON_COMPILE_FLAGS} |
214 |
+- ${TBB_IPO_COMPILE_FLAGS} |
215 |
+ ) |
216 |
+ |
217 |
+ # Avoid use of target_link_libraries here as it changes /DEF option to \DEF on Windows. |
218 |
+@@ -55,6 +54,9 @@ function(tbbbind_build TBBBIND_NAME REQUIRED_HWLOC_TARGET) |
219 |
+ VERSION ${TBBBIND_BINARY_VERSION}.${TBB_BINARY_MINOR_VERSION} |
220 |
+ SOVERSION ${TBBBIND_BINARY_VERSION} |
221 |
+ ) |
222 |
++ |
223 |
++ tbb_handle_ipo(${TBBBIND_NAME}) |
224 |
++ |
225 |
+ if (TBB_DEF_FILE_PREFIX) # If there's no prefix, assume we're using export directives |
226 |
+ set_target_properties(${TBBBIND_NAME} PROPERTIES |
227 |
+ LINK_FLAGS ${TBB_LINK_DEF_FILE_FLAG}${CMAKE_CURRENT_SOURCE_DIR}/def/${TBB_DEF_FILE_PREFIX}-tbbbind.def |
228 |
+@@ -69,14 +71,12 @@ function(tbbbind_build TBBBIND_NAME REQUIRED_HWLOC_TARGET) |
229 |
+ PRIVATE |
230 |
+ ${TBB_LIB_LINK_FLAGS} |
231 |
+ ${TBB_COMMON_LINK_FLAGS} |
232 |
+- ${TBB_IPO_LINK_FLAGS} |
233 |
+ ) |
234 |
+ else() |
235 |
+ target_link_libraries(${TBBBIND_NAME} |
236 |
+ PRIVATE |
237 |
+ ${TBB_LIB_LINK_FLAGS} |
238 |
+ ${TBB_COMMON_LINK_FLAGS} |
239 |
+- ${TBB_IPO_LINK_FLAGS} |
240 |
+ ) |
241 |
+ endif() |
242 |
+ |
243 |
+diff --git a/src/tbbmalloc/CMakeLists.txt b/src/tbbmalloc/CMakeLists.txt |
244 |
+index f77bc8f10..5a851851f 100644 |
245 |
+--- a/src/tbbmalloc/CMakeLists.txt |
246 |
++++ b/src/tbbmalloc/CMakeLists.txt |
247 |
+@@ -59,7 +59,6 @@ target_compile_options(tbbmalloc |
248 |
+ ${TBB_LIB_COMPILE_FLAGS} |
249 |
+ ${TBBMALLOC_LIB_COMPILE_FLAGS} |
250 |
+ ${TBB_COMMON_COMPILE_FLAGS} |
251 |
+- ${TBB_IPO_COMPILE_FLAGS} |
252 |
+ ) |
253 |
+ |
254 |
+ enable_language(C) |
255 |
+@@ -72,6 +71,8 @@ set_target_properties(tbbmalloc PROPERTIES |
256 |
+ LINKER_LANGUAGE C |
257 |
+ ) |
258 |
+ |
259 |
++tbb_handle_ipo(tbbmalloc) |
260 |
++ |
261 |
+ if (TBB_DEF_FILE_PREFIX) # If there's no prefix, assume we're using export directives |
262 |
+ set_target_properties(tbbmalloc PROPERTIES |
263 |
+ LINK_FLAGS ${TBB_LINK_DEF_FILE_FLAG}${CMAKE_CURRENT_SOURCE_DIR}/def/${TBB_DEF_FILE_PREFIX}-tbbmalloc.def |
264 |
+@@ -88,14 +89,12 @@ if (COMMAND target_link_options) |
265 |
+ PRIVATE |
266 |
+ ${TBB_LIB_LINK_FLAGS} |
267 |
+ ${TBB_COMMON_LINK_FLAGS} |
268 |
+- ${TBB_IPO_LINK_FLAGS} |
269 |
+ ) |
270 |
+ else() |
271 |
+ target_link_libraries(tbbmalloc |
272 |
+ PRIVATE |
273 |
+ ${TBB_LIB_LINK_FLAGS} |
274 |
+ ${TBB_COMMON_LINK_FLAGS} |
275 |
+- ${TBB_IPO_LINK_FLAGS} |
276 |
+ ) |
277 |
+ endif() |
278 |
+ |
279 |
|
280 |
diff --git a/dev-cpp/tbb/tbb-2021.4.0.ebuild b/dev-cpp/tbb/tbb-2021.4.0.ebuild |
281 |
new file mode 100644 |
282 |
index 00000000000..9a99edb24ae |
283 |
--- /dev/null |
284 |
+++ b/dev-cpp/tbb/tbb-2021.4.0.ebuild |
285 |
@@ -0,0 +1,37 @@ |
286 |
+# Copyright 1999-2021 Gentoo Authors |
287 |
+# Distributed under the terms of the GNU General Public License v2 |
288 |
+ |
289 |
+EAPI=8 |
290 |
+ |
291 |
+inherit cmake-multilib flag-o-matic toolchain-funcs |
292 |
+ |
293 |
+DESCRIPTION="High level abstract threading library" |
294 |
+HOMEPAGE="https://www.threadingbuildingblocks.org" |
295 |
+SRC_URI="https://github.com/oneapi-src/oneTBB/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz" |
296 |
+S="${WORKDIR}/oneTBB-${PV}" |
297 |
+ |
298 |
+LICENSE="Apache-2.0" |
299 |
+# https://github.com/oneapi-src/oneTBB/blob/master/CMakeLists.txt#L53 |
300 |
+# libtbb<SONAME>-libtbbmalloc<SONAME>-libtbbbind<SONAME> |
301 |
+SLOT="0/12-2-3" |
302 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc ~ppc64 ~riscv ~sparc ~x86 ~amd64-linux ~x86-linux" |
303 |
+IUSE="test" |
304 |
+RESTRICT="!test? ( test )" |
305 |
+ |
306 |
+RDEPEND="sys-apps/hwloc:=" |
307 |
+DEPEND="${RDEPEND}" |
308 |
+BDEPEND="virtual/pkgconfig" |
309 |
+ |
310 |
+PATCHES=( |
311 |
+ "${FILESDIR}"/${P}-lto.patch |
312 |
+) |
313 |
+ |
314 |
+src_configure() { |
315 |
+ local mycmakeargs=( |
316 |
+ -DTBB_TEST=$(usex test) |
317 |
+ -DTBB_ENABLE_IPO=OFF |
318 |
+ -DTBB_STRICT=OFF |
319 |
+ ) |
320 |
+ |
321 |
+ cmake-multilib_src_configure |
322 |
+} |