commit:     1b3fe748b877a62ba8db1203f9379eebe8f45011
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Dec 27 20:37:51 2024 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri Dec 27 21:25:04 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1b3fe748

llvm-runtimes/offload: Add 20.0.0_pre20241227 snapshot

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 llvm-runtimes/offload/Manifest                     |   1 +
 .../offload/offload-20.0.0_pre20241227.ebuild      | 155 +++++++++++++++++++++
 2 files changed, 156 insertions(+)

diff --git a/llvm-runtimes/offload/Manifest b/llvm-runtimes/offload/Manifest
index a4a99701e9dd..791456aba4b8 100644
--- a/llvm-runtimes/offload/Manifest
+++ b/llvm-runtimes/offload/Manifest
@@ -3,3 +3,4 @@ DIST llvm-project-19.1.6.src.tar.xz.sig 438 BLAKE2B 
1791e98252ab78a9a762ef601ff9
 DIST llvm-project-32f7f0010bca99ee4bd917f57272733fb2bf3bd9.tar.gz 223983502 
BLAKE2B 
fd3e6b0b795abc42568ef98fa774d927029c18838a5d0f34eaa66c37976444a63f2fc5d883f3bf3a98533f51e387936f1c659230f31c757d26153425696a16cd
 SHA512 
65a345ad5b77c627008f759947e5e9f28a62c8992d7146113e0446e5849feaf9088c15c8b22ca0824af5b927d6a417f5326258b489fb8ccea78ec9e0e0fe8fba
 DIST llvm-project-49a5ad8e5714fd404210279303acc97b495d66d0.tar.gz 224456065 
BLAKE2B 
0077b9d37c479ac6190cc4b897cc35d6f1f3e6a772cd0620bcb1006afc19377e9968e38fb9d9adffe316e85290c9045deecbf9bf62b440c55968634b442edb31
 SHA512 
45d779eb27c230f656fda47c85127381cab8c8f7f75d77411c6960269f8aad5fa3c99c024a98ab8a349da1c88ad9d892cc82f91a6f344b791b281449031ae49a
 DIST llvm-project-665d79f2e967a5eee6fff93685e45f50cf24cab2.tar.gz 224186302 
BLAKE2B 
6d4a02b6cfaf53324161c43ed02024f0fea0e7de25a9150cc0168602d7dff3f618026fa8318aa6e03904a9424afa1f12c5eb33bfdfa82e72210f34e5829a7804
 SHA512 
7482e176b1e2389b0dd0e67271cdb0489e9db0595874408156a034b40d336ecd960c63b89c237ca22eee3650880b0f08a97de14f8a17c918245915d422e568c9
+DIST llvm-project-ccfe0de0e1e37ed369c9bf89dd0188ba0afb2e9a.tar.gz 224396427 
BLAKE2B 
6e13c65d2ba83fdaf2db20a58b878106568406f07f9c2ceb47e4d2572fb041211384ed67c43801764060101ec4a1b04c18bf4097f37512d2751aa5860c1a8dc3
 SHA512 
ef4512b735568aaa627a7f4e9bac3fc4722db7a2b8bd1610faaf066856be9474fb297fd75b3c0dcc76f60ab35c3110fd329faad3e8d9b75e93844d56f41c03d1

diff --git a/llvm-runtimes/offload/offload-20.0.0_pre20241227.ebuild 
b/llvm-runtimes/offload/offload-20.0.0_pre20241227.ebuild
new file mode 100644
index 000000000000..e215172e31f1
--- /dev/null
+++ b/llvm-runtimes/offload/offload-20.0.0_pre20241227.ebuild
@@ -0,0 +1,155 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{10..13} )
+inherit cmake flag-o-matic llvm.org python-any-r1 toolchain-funcs
+
+DESCRIPTION="OpenMP offloading support"
+HOMEPAGE="https://openmp.llvm.org";
+
+LICENSE="Apache-2.0-with-LLVM-exceptions || ( UoI-NCSA MIT )"
+SLOT="0/${LLVM_SOABI}"
+IUSE="+debug ompt test llvm_targets_AMDGPU llvm_targets_NVPTX"
+RESTRICT="!test? ( test )"
+
+RDEPEND="
+       dev-libs/libffi:=
+       ~llvm-core/llvm-${PV}
+       ~llvm-runtimes/openmp-${PV}[ompt?]
+       llvm_targets_AMDGPU? ( dev-libs/rocr-runtime:= )
+"
+DEPEND="
+       ${RDEPEND}
+"
+# tests:
+# - dev-python/lit provides the test runner
+# - llvm-core/llvm provide test utils (e.g. FileCheck)
+# - llvm-core/clang provides the compiler to run tests
+BDEPEND="
+       dev-lang/perl
+       virtual/pkgconfig
+       llvm_targets_AMDGPU? ( llvm-core/clang )
+       llvm_targets_NVPTX? ( llvm-core/clang )
+       test? (
+               $(python_gen_any_dep '
+                       dev-python/lit[${PYTHON_USEDEP}]
+               ')
+               llvm-core/clang
+       )
+"
+# TODO: can it be fixed to compile with gcc?
+BDEPEND+="
+       llvm-core/clang
+"
+
+LLVM_COMPONENTS=( offload cmake runtimes/cmake libc/shared )
+LLVM_TEST_COMPONENTS=( openmp/cmake )
+llvm.org_set_globals
+
+pkg_pretend() {
+       if [[ ${LLVM_ALLOW_GPU_TESTING} ]]; then
+               ewarn "LLVM_ALLOW_GPU_TESTING set.  This package will run tests 
against your"
+               ewarn "GPU if it is supported.  Note that these tests may be 
flaky, fail or"
+               ewarn "hang, or even cause your GPU to crash (requiring a 
reboot)."
+       fi
+}
+
+python_check_deps() {
+       python_has_version "dev-python/lit[${PYTHON_USEDEP}]"
+}
+
+pkg_setup() {
+       if use test; then
+               python-any-r1_pkg_setup
+       fi
+}
+
+src_configure() {
+       # TODO
+       local -x CC=${CHOST}-clang
+       local -x CXX=${CHOST}-clang++
+       strip-unsupported-flags
+
+       # LLVM_ENABLE_ASSERTIONS=NO does not guarantee this for us, #614844
+       use debug || local -x CPPFLAGS="${CPPFLAGS} -DNDEBUG"
+
+       local libdir="$(get_libdir)"
+       local ffi_cflags=$($(tc-getPKG_CONFIG) --cflags-only-I libffi)
+       local ffi_ldflags=$($(tc-getPKG_CONFIG) --libs-only-L libffi)
+       local plugins="host"
+       local gpus=
+       local build_devicertl=FALSE
+
+       if has "${CHOST%%-*}" aarch64 powerpc64le x86_64; then
+               if use llvm_targets_AMDGPU; then
+                       plugins+=";amdgpu"
+                       build_devicertl=TRUE
+                       gpus+="amdgpu"
+               fi
+               if use llvm_targets_NVPTX; then
+                       plugins+=";cuda"
+                       build_devicertl=TRUE
+                       gpus+="nvptx"
+               fi
+               [[ ${gpus} == amdgpunvptx ]] && gpus=all
+       fi
+
+       local mycmakeargs=(
+               -DLLVM_ROOT="${ESYSROOT}/usr/lib/llvm/${LLVM_MAJOR}"
+
+               -DOFFLOAD_LIBDIR_SUFFIX="${libdir#lib}"
+               -DLIBOMPTARGET_PLUGINS_TO_BUILD="${plugins}"
+               -DLIBOMPTARGET_OMPT_SUPPORT="$(usex ompt)"
+               -DLIBOMPTARGET_BUILD_DEVICERTL_BCLIB="${build_devicertl}"
+
+               # this breaks building static target libs
+               -DBUILD_SHARED_LIBS=OFF
+
+               -DFFI_INCLUDE_DIR="${ffi_cflags#-I}"
+               -DFFI_LIBRARY_DIR="${ffi_ldflags#-L}"
+       )
+
+       [[ ! ${LLVM_ALLOW_GPU_TESTING} ]] && mycmakeargs+=(
+               # prevent trying to access the GPU
+               -DLIBOMPTARGET_AMDGPU_ARCH=LIBOMPTARGET_AMDGPU_ARCH-NOTFOUND
+               -DLIBOMPTARGET_NVPTX_ARCH=LIBOMPTARGET_NVPTX_ARCH-NOTFOUND
+       )
+       [[ -n ${gpus} ]] && mycmakeargs+=(
+               -DLIBOMPTARGET_DEVICE_ARCHITECTURES="${gpus}"
+       )
+       use test && mycmakeargs+=(
+               # this project does not use standard LLVM cmake macros
+               -DOPENMP_LLVM_LIT_EXECUTABLE="${EPREFIX}/usr/bin/lit"
+               -DOPENMP_LIT_ARGS="$(get_lit_flags)"
+
+               -DOPENMP_TEST_C_COMPILER="$(type -P "${CHOST}-clang")"
+               -DOPENMP_TEST_CXX_COMPILER="$(type -P "${CHOST}-clang++")"
+               # requires flang
+               -DOPENMP_TEST_Fortran_COMPILER=
+       )
+
+       cmake_src_configure
+
+       if [[ -z ${gpus} ]]; then
+               # clang requires libomptarget.devicertl.a, but it can be empty
+               > "${BUILD_DIR}"/libomptarget.devicertl.a || die
+       fi
+}
+
+src_test() {
+       # respect TMPDIR!
+       local -x LIT_PRESERVES_TMP=1
+
+       cmake_build check-offload
+}
+
+src_install() {
+       cmake_src_install
+
+       if [[ ! -f ${ED}/usr/$(get_libdir)/libomptarget.devicertl.a ]]
+       then
+               dolib.a "${BUILD_DIR}"/libomptarget.devicertl.a
+       fi
+}

Reply via email to