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