3 |
3 |
|
4 |
4 |
EAPI=8
|
5 |
5 |
|
6 |
|
PYTHON_COMPAT=( python3_{9..11} )
|
7 |
|
inherit flag-o-matic cmake-multilib linux-info llvm llvm.org python-any-r1
|
|
6 |
PYTHON_COMPAT=( python3_{10..12} )
|
|
7 |
inherit flag-o-matic cmake-multilib linux-info llvm llvm.org
|
|
8 |
inherit python-single-r1 toolchain-funcs
|
8 |
9 |
|
9 |
10 |
DESCRIPTION="OpenMP runtime library for LLVM/clang compiler"
|
10 |
11 |
HOMEPAGE="https://openmp.llvm.org"
|
11 |
12 |
|
12 |
13 |
LICENSE="Apache-2.0-with-LLVM-exceptions || ( UoI-NCSA MIT )"
|
13 |
14 |
SLOT="0/${LLVM_SOABI}"
|
14 |
|
KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~riscv ~x86 ~amd64-linux ~x64-macos"
|
|
15 |
KEYWORDS="amd64 arm arm64 ~loong ppc ppc64 ~riscv x86 ~amd64-linux ~x64-macos"
|
15 |
16 |
IUSE="
|
16 |
|
debug hwloc offload ompt test
|
|
17 |
debug gdb-plugin hwloc offload ompt test
|
17 |
18 |
llvm_targets_AMDGPU llvm_targets_NVPTX
|
18 |
19 |
"
|
|
20 |
REQUIRED_USE="
|
|
21 |
gdb-plugin? ( ${PYTHON_REQUIRED_USE} )
|
|
22 |
"
|
19 |
23 |
RESTRICT="!test? ( test )"
|
20 |
24 |
|
21 |
25 |
RDEPEND="
|
|
26 |
gdb-plugin? ( ${PYTHON_DEPS} )
|
22 |
27 |
hwloc? ( >=sys-apps/hwloc-2.5:0=[${MULTILIB_USEDEP}] )
|
23 |
28 |
offload? (
|
24 |
|
virtual/libelf:=[${MULTILIB_USEDEP}]
|
25 |
29 |
dev-libs/libffi:=[${MULTILIB_USEDEP}]
|
26 |
30 |
~sys-devel/llvm-${PV}[${MULTILIB_USEDEP}]
|
27 |
31 |
llvm_targets_AMDGPU? ( dev-libs/rocr-runtime:= )
|
... | ... | |
42 |
46 |
virtual/pkgconfig
|
43 |
47 |
)
|
44 |
48 |
test? (
|
45 |
|
$(python_gen_any_dep 'dev-python/lit[${PYTHON_USEDEP}]')
|
|
49 |
${PYTHON_DEPS}
|
|
50 |
$(python_gen_cond_dep '
|
|
51 |
dev-python/lit[${PYTHON_USEDEP}]
|
|
52 |
')
|
46 |
53 |
sys-devel/clang
|
47 |
54 |
)
|
48 |
55 |
"
|
49 |
56 |
|
50 |
57 |
LLVM_COMPONENTS=( openmp cmake llvm/include )
|
51 |
|
LLVM_PATCHSET=15.0.7-r6
|
52 |
58 |
llvm.org_set_globals
|
53 |
59 |
|
54 |
|
python_check_deps() {
|
55 |
|
python_has_version "dev-python/lit[${PYTHON_USEDEP}]"
|
56 |
|
}
|
57 |
|
|
58 |
60 |
kernel_pds_check() {
|
59 |
61 |
if use kernel_linux && kernel_is -lt 4 15 && kernel_is -ge 4 13; then
|
60 |
62 |
local CONFIG_CHECK="~!SCHED_PDS"
|
... | ... | |
74 |
76 |
|
75 |
77 |
pkg_setup() {
|
76 |
78 |
use offload && LLVM_MAX_SLOT=${LLVM_MAJOR} llvm_pkg_setup
|
77 |
|
use test && python-any-r1_pkg_setup
|
|
79 |
if use gdb-plugin || use test; then
|
|
80 |
python-single-r1_pkg_setup
|
|
81 |
fi
|
78 |
82 |
}
|
79 |
83 |
|
80 |
84 |
multilib_src_configure() {
|
... | ... | |
84 |
88 |
# LLVM_ENABLE_ASSERTIONS=NO does not guarantee this for us, #614844
|
85 |
89 |
use debug || local -x CPPFLAGS="${CPPFLAGS} -DNDEBUG"
|
86 |
90 |
|
|
91 |
local build_omptarget=OFF
|
|
92 |
# upstream disallows building libomptarget when sizeof(void*) != 8
|
|
93 |
if use offload &&
|
|
94 |
"$(tc-getCC)" ${CFLAGS} ${CPPFLAGS} -c -x c - -o /dev/null \
|
|
95 |
<<-EOF &>/dev/null
|
|
96 |
int test[sizeof(void *) == 8 ? 1 : -1];
|
|
97 |
EOF
|
|
98 |
then
|
|
99 |
build_omptarget=ON
|
|
100 |
fi
|
|
101 |
|
87 |
102 |
local libdir="$(get_libdir)"
|
88 |
103 |
local mycmakeargs=(
|
89 |
104 |
-DOPENMP_LIBDIR_SUFFIX="${libdir#lib}"
|
90 |
105 |
|
91 |
106 |
-DLIBOMP_USE_HWLOC=$(usex hwloc)
|
|
107 |
-DLIBOMP_OMPD_GDB_SUPPORT=$(multilib_native_usex gdb-plugin)
|
92 |
108 |
-DLIBOMP_OMPT_SUPPORT=$(usex ompt)
|
93 |
109 |
|
94 |
|
-DOPENMP_ENABLE_LIBOMPTARGET=$(usex offload)
|
|
110 |
-DOPENMP_ENABLE_LIBOMPTARGET=${build_omptarget}
|
95 |
111 |
|
96 |
112 |
# do not install libgomp.so & libiomp5.so aliases
|
97 |
113 |
-DLIBOMP_INSTALL_ALIASES=OFF
|
98 |
114 |
# disable unnecessary hack copying stuff back to srcdir
|
99 |
115 |
-DLIBOMP_COPY_EXPORTS=OFF
|
|
116 |
# prevent trying to access the GPU
|
|
117 |
-DLIBOMPTARGET_AMDGPU_ARCH=LIBOMPTARGET_AMDGPU_ARCH-NOTFOUND
|
100 |
118 |
)
|
101 |
119 |
|
102 |
|
if use offload; then
|
|
120 |
if [[ ${build_omptarget} == ON ]]; then
|
103 |
121 |
if has "${CHOST%%-*}" aarch64 powerpc64le x86_64; then
|
104 |
122 |
mycmakeargs+=(
|
105 |
123 |
-DLIBOMPTARGET_BUILD_AMDGPU_PLUGIN=$(usex llvm_targets_AMDGPU)
|