Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-libs/libomp/
Date: Fri, 05 Aug 2022 19:50:15
Message-Id: 1659729001.00aaf980b83cb9816d9ef3faec1fe6eb2d164737.mgorny@gentoo
1 commit: 00aaf980b83cb9816d9ef3faec1fe6eb2d164737
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Fri Aug 5 19:48:46 2022 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Fri Aug 5 19:50:01 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=00aaf980
7
8 sys-libs/libomp: Add 16.* live ebuilds
9
10 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
11
12 sys-libs/libomp/libomp-16.0.0.9999.ebuild | 129 ++++++++++++++++++++++++++++++
13 1 file changed, 129 insertions(+)
14
15 diff --git a/sys-libs/libomp/libomp-16.0.0.9999.ebuild b/sys-libs/libomp/libomp-16.0.0.9999.ebuild
16 new file mode 100644
17 index 000000000000..8ba05d6be239
18 --- /dev/null
19 +++ b/sys-libs/libomp/libomp-16.0.0.9999.ebuild
20 @@ -0,0 +1,129 @@
21 +# Copyright 1999-2022 Gentoo Authors
22 +# Distributed under the terms of the GNU General Public License v2
23 +
24 +EAPI=8
25 +
26 +CMAKE_ECLASS=cmake
27 +PYTHON_COMPAT=( python3_{8..11} )
28 +inherit cmake-multilib linux-info llvm llvm.org python-any-r1
29 +
30 +DESCRIPTION="OpenMP runtime library for LLVM/clang compiler"
31 +HOMEPAGE="https://openmp.llvm.org"
32 +
33 +LICENSE="Apache-2.0-with-LLVM-exceptions || ( UoI-NCSA MIT )"
34 +SLOT="0"
35 +KEYWORDS=""
36 +IUSE="
37 + debug hwloc offload ompt test
38 + llvm_targets_AMDGPU llvm_targets_NVPTX
39 +"
40 +RESTRICT="!test? ( test )"
41 +
42 +RDEPEND="
43 + hwloc? ( >=sys-apps/hwloc-2.5:0=[${MULTILIB_USEDEP}] )
44 + offload? (
45 + virtual/libelf:=[${MULTILIB_USEDEP}]
46 + dev-libs/libffi:=[${MULTILIB_USEDEP}]
47 + ~sys-devel/llvm-${PV}[${MULTILIB_USEDEP}]
48 + )
49 +"
50 +# tests:
51 +# - dev-python/lit provides the test runner
52 +# - sys-devel/llvm provide test utils (e.g. FileCheck)
53 +# - sys-devel/clang provides the compiler to run tests
54 +DEPEND="
55 + ${RDEPEND}
56 +"
57 +BDEPEND="
58 + dev-lang/perl
59 + offload? (
60 + llvm_targets_AMDGPU? ( sys-devel/clang )
61 + llvm_targets_NVPTX? ( sys-devel/clang )
62 + virtual/pkgconfig
63 + )
64 + test? (
65 + $(python_gen_any_dep 'dev-python/lit[${PYTHON_USEDEP}]')
66 + sys-devel/clang
67 + )
68 +"
69 +
70 +LLVM_COMPONENTS=( openmp cmake llvm/include )
71 +llvm.org_set_globals
72 +
73 +python_check_deps() {
74 + has_version "dev-python/lit[${PYTHON_USEDEP}]"
75 +}
76 +
77 +kernel_pds_check() {
78 + if use kernel_linux && kernel_is -lt 4 15 && kernel_is -ge 4 13; then
79 + local CONFIG_CHECK="~!SCHED_PDS"
80 + local ERROR_SCHED_PDS="\
81 +PDS scheduler versions >= 0.98c < 0.98i (e.g. used in kernels >= 4.13-pf11
82 +< 4.14-pf9) do not implement sched_yield() call which may result in horrible
83 +performance problems with libomp. If you are using one of the specified
84 +kernel versions, you may want to disable the PDS scheduler."
85 +
86 + check_extra_config
87 + fi
88 +}
89 +
90 +pkg_pretend() {
91 + kernel_pds_check
92 +}
93 +
94 +pkg_setup() {
95 + use offload && LLVM_MAX_SLOT=${PV%%.*} llvm_pkg_setup
96 + use test && python-any-r1_pkg_setup
97 +}
98 +
99 +multilib_src_configure() {
100 + # LLVM_ENABLE_ASSERTIONS=NO does not guarantee this for us, #614844
101 + use debug || local -x CPPFLAGS="${CPPFLAGS} -DNDEBUG"
102 +
103 + local libdir="$(get_libdir)"
104 + local mycmakeargs=(
105 + -DOPENMP_LIBDIR_SUFFIX="${libdir#lib}"
106 +
107 + -DLIBOMP_USE_HWLOC=$(usex hwloc)
108 + -DLIBOMP_OMPT_SUPPORT=$(usex ompt)
109 +
110 + -DOPENMP_ENABLE_LIBOMPTARGET=$(usex offload)
111 +
112 + # do not install libgomp.so & libiomp5.so aliases
113 + -DLIBOMP_INSTALL_ALIASES=OFF
114 + # disable unnecessary hack copying stuff back to srcdir
115 + -DLIBOMP_COPY_EXPORTS=OFF
116 + )
117 +
118 + if use offload; then
119 + if has "${CHOST%%-*}" aarch64 powerpc64le x86_64; then
120 + mycmakeargs+=(
121 + -DLIBOMPTARGET_BUILD_AMDGPU_PLUGIN=$(usex llvm_targets_AMDGPU)
122 + -DLIBOMPTARGET_BUILD_CUDA_PLUGIN=$(usex llvm_targets_NVPTX)
123 + )
124 + else
125 + mycmakeargs+=(
126 + -DLIBOMPTARGET_BUILD_AMDGPU_PLUGIN=OFF
127 + -DLIBOMPTARGET_BUILD_CUDA_PLUGIN=OFF
128 + )
129 + fi
130 + fi
131 +
132 + use test && mycmakeargs+=(
133 + # this project does not use standard LLVM cmake macros
134 + -DOPENMP_LLVM_LIT_EXECUTABLE="${EPREFIX}/usr/bin/lit"
135 + -DOPENMP_LIT_ARGS="$(get_lit_flags)"
136 +
137 + -DOPENMP_TEST_C_COMPILER="$(type -P "${CHOST}-clang")"
138 + -DOPENMP_TEST_CXX_COMPILER="$(type -P "${CHOST}-clang++")"
139 + )
140 + addpredict /dev/nvidiactl
141 + cmake_src_configure
142 +}
143 +
144 +multilib_src_test() {
145 + # respect TMPDIR!
146 + local -x LIT_PRESERVES_TMP=1
147 +
148 + cmake_build check-libomp
149 +}