From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1709432-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id 0915115813A
	for <garchives@archives.gentoo.org>; Wed, 15 Jan 2025 04:24:20 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id D63EDE0830;
	Wed, 15 Jan 2025 04:24:12 +0000 (UTC)
Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id B7E37E0830
	for <gentoo-commits@lists.gentoo.org>; Wed, 15 Jan 2025 04:24:12 +0000 (UTC)
Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id D4604342FAD
	for <gentoo-commits@lists.gentoo.org>; Wed, 15 Jan 2025 04:24:11 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 1C0FD215F
	for <gentoo-commits@lists.gentoo.org>; Wed, 15 Jan 2025 04:24:08 +0000 (UTC)
From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Michał Górny" <mgorny@gentoo.org>
Message-ID: <1736915041.c0c7ea9d5d1f890f593b4913a5a33b6bcde7d60a.mgorny@gentoo>
Subject: [gentoo-commits] repo/gentoo:master commit in: llvm-runtimes/offload/
X-VCS-Repository: repo/gentoo
X-VCS-Files: llvm-runtimes/offload/Manifest llvm-runtimes/offload/offload-19.1.7.ebuild
X-VCS-Directories: llvm-runtimes/offload/
X-VCS-Committer: mgorny
X-VCS-Committer-Name: Michał Górny
X-VCS-Revision: c0c7ea9d5d1f890f593b4913a5a33b6bcde7d60a
X-VCS-Branch: master
Date: Wed, 15 Jan 2025 04:24:08 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply
X-Archives-Salt: 8f3fbbc1-aa61-4d62-8302-3c1e3e8a69b6
X-Archives-Hash: 32644aef590a01fec4216a4293bb7738

commit:     c0c7ea9d5d1f890f593b4913a5a33b6bcde7d60a
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue Jan 14 20:01:40 2025 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed Jan 15 04:24:01 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c0c7ea9d

llvm-runtimes/offload: Add 19.1.7

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

 llvm-runtimes/offload/Manifest              |   2 +
 llvm-runtimes/offload/offload-19.1.7.ebuild | 161 ++++++++++++++++++++++++++++
 2 files changed, 163 insertions(+)

diff --git a/llvm-runtimes/offload/Manifest b/llvm-runtimes/offload/Manifest
index 8cac0ae7bdc6..8fb6e9b616d8 100644
--- a/llvm-runtimes/offload/Manifest
+++ b/llvm-runtimes/offload/Manifest
@@ -1,5 +1,7 @@
 DIST llvm-project-19.1.6.src.tar.xz 141248428 BLAKE2B b35ab0c754f28c850ac6fd4ee584e963b1d5cf06885c59827ee4ac11f93cde5b8e0268fbed560839137de2c495c9da2b889331cd12a8a02958d8e0cbdbed2607 SHA512 d411a6d913d6a1e1f3c16cfc1ce81c1e6292ea370703f55fb67c7af62f02193d53f5ef7823c8679d6f25cbe47b40236fcaf37044ad7cdfada8166efe7eb106b3
 DIST llvm-project-19.1.6.src.tar.xz.sig 438 BLAKE2B 1791e98252ab78a9a762ef601ff9edee115385181781c8100f14ec80061d7888ee4c4c519297a0e89b9c7ab2203aa9d5bb3084ea1d0f0024c2acf84826fd370b SHA512 8e79a39a4f54da3579794f9b5a009ea8ee56c7bc1805187274794ce56e81aa492ea93f5c7839a59beedcf7d657acded5ecb75d5803658cce1f9e8f753439c6c4
+DIST llvm-project-19.1.7.src.tar.xz 141249332 BLAKE2B 1259ed7f9aca7b35e89d818befdee20fd8bed4d2dc2c2c6f6f56451fd43d35ac03a0a5a406e142d22b25137999dc5b17471c196f8fcf79f20a8296832d900f6d SHA512 c7d63286d662707a9cd54758c9e3aaf52794a91900c484c4a6efa62d90bc719d5e7a345e4192feeb0c9fd11c82570d64677c781e5be1d645556b6aa018e47ec8
+DIST llvm-project-19.1.7.src.tar.xz.sig 438 BLAKE2B 4015140f4ba77de45039bdbdfbaf6f30e75705123d067ea97175d91d7a5b6a75008df01d99ae7aa16aaa3b101f3f41e38d01f04158f95a261d617b3ede0254cd SHA512 195797b06ac80a742e0ccbc03a50dc06dd2e04377d783d5474e3e72c5a75203b60292b047929312a411d22b137a239943fba414a4d136a2be14cbff978eb6bda
 DIST llvm-project-2529a8df53af9bc6cecfd6c83404ffa5e89e3370.tar.gz 224493461 BLAKE2B 0d3c757a8f34a9bf6b2ac0ad394cc1f8125cfee534c8bd0c5875eba56fe0171892586ec05b6f1e859e5962f81c76c9a315f60bcda012df73a3bd66709b265038 SHA512 a49fa1da2fd398b279a90292704e30d8ff7163219bfd91c4a80fa5123d957cdef52d2ee41710a8bcbfea3d9a5eec269dfc756584fcc27a495f7f381176de4e69
 DIST llvm-project-8af4d206e0f979f68925a08f9dffd60a98ce97e2.tar.gz 224825146 BLAKE2B 36e9c8f9615d65fc72beb699c4ce5959676975267a4c4288a01009d26ab84ae411f2855e4e6475957b91ddc21da29251ab22e331395bc9fee0f9bc907a05384a SHA512 ec72cdd7cc6d9bef31ae9295606d18e4935468fe60ab632aced21261d437e76f11d83d0d7199a6028689990260d9155098f7d64e97db0e0af28ea6c75a773bcc
 DIST llvm-project-ccfe0de0e1e37ed369c9bf89dd0188ba0afb2e9a.tar.gz 224396427 BLAKE2B 6e13c65d2ba83fdaf2db20a58b878106568406f07f9c2ceb47e4d2572fb041211384ed67c43801764060101ec4a1b04c18bf4097f37512d2751aa5860c1a8dc3 SHA512 ef4512b735568aaa627a7f4e9bac3fc4722db7a2b8bd1610faaf066856be9474fb297fd75b3c0dcc76f60ab35c3110fd329faad3e8d9b75e93844d56f41c03d1

diff --git a/llvm-runtimes/offload/offload-19.1.7.ebuild b/llvm-runtimes/offload/offload-19.1.7.ebuild
new file mode 100644
index 000000000000..aeded58f646b
--- /dev/null
+++ b/llvm-runtimes/offload/offload-19.1.7.ebuild
@@ -0,0 +1,161 @@
+# Copyright 1999-2025 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}"
+KEYWORDS="~amd64 ~arm64 ~ppc64"
+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_DEPS}
+		$(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 )
+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+=";gfx700;gfx701;gfx801;gfx803;gfx900;gfx902;gfx906"
+			gpus+=";gfx908;gfx90a;gfx90c;gfx940;gfx941;gfx942"
+			gpus+=";gfx1010;gfx1030;gfx1031;gfx1032;gfx1033"
+			gpus+=";gfx1034;gfx1035;gfx1036;gfx1100;gfx1101;gfx1102"
+			gpus+=";gfx1103;gfx1150;gfx1151;gfx1152"
+		fi
+		if use llvm_targets_NVPTX; then
+			plugins+=";cuda"
+			build_devicertl=TRUE
+			gpus+=";sm_35;sm_37;sm_50;sm_52;sm_53;sm_60;sm_61;sm_62"
+			gpus+=";sm_70;sm_72;sm_75;sm_80;sm_86;sm_87;sm_89;sm_90"
+		fi
+	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
+}