From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1622350-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 (2048 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id E9DAB158043
	for <garchives@archives.gentoo.org>; Thu, 18 Apr 2024 18:14:03 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 24AE6E2A43;
	Thu, 18 Apr 2024 18:14:01 +0000 (UTC)
Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4])
	(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 C7FCAE2A42
	for <gentoo-commits@lists.gentoo.org>; Thu, 18 Apr 2024 18:14:00 +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 B59DD3434BD
	for <gentoo-commits@lists.gentoo.org>; Thu, 18 Apr 2024 18:13:59 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 4089B172D
	for <gentoo-commits@lists.gentoo.org>; Thu, 18 Apr 2024 18:13:57 +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: <1713464023.5b0231c3f729b2749a947be76a46b6dee8566ec7.mgorny@gentoo>
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-libs/libomp/
X-VCS-Repository: repo/gentoo
X-VCS-Files: sys-libs/libomp/Manifest sys-libs/libomp/libomp-18.1.4.ebuild
X-VCS-Directories: sys-libs/libomp/
X-VCS-Committer: mgorny
X-VCS-Committer-Name: Michał Górny
X-VCS-Revision: 5b0231c3f729b2749a947be76a46b6dee8566ec7
X-VCS-Branch: master
Date: Thu, 18 Apr 2024 18:13:57 +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: e961c67a-3353-4fae-abb4-6b04f52f300e
X-Archives-Hash: f8b8fd3a88ea4459e9158a903af38041

commit:     5b0231c3f729b2749a947be76a46b6dee8566ec7
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Thu Apr 18 11:29:38 2024 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Apr 18 18:13:43 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5b0231c3

sys-libs/libomp: Add 18.1.4

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

 sys-libs/libomp/Manifest             |   2 +
 sys-libs/libomp/libomp-18.1.4.ebuild | 161 +++++++++++++++++++++++++++++++++++
 2 files changed, 163 insertions(+)

diff --git a/sys-libs/libomp/Manifest b/sys-libs/libomp/Manifest
index 3b18335c7afb..f97313aefc1c 100644
--- a/sys-libs/libomp/Manifest
+++ b/sys-libs/libomp/Manifest
@@ -8,5 +8,7 @@ DIST llvm-project-17.0.6.src.tar.xz 127838860 BLAKE2B d6ede1a9fda8756995c3e06541
 DIST llvm-project-17.0.6.src.tar.xz.sig 438 BLAKE2B 186e75b6a0fbfe1e85408589c149e1800fcc47d685b74e4260018e05cd08bc793d1d1197c9c50e177eea941a3d0c65cb0c583ce6dae449099b920adf8a508ef7 SHA512 f78c55053a6450625f3e95f52c305110b4468a9854fec75831b65b8d6ceee3c9206ab9e63c4b5fda8be9bd344f72cfbdaae0520ed240abd505e08ebeaa25d340
 DIST llvm-project-18.1.3.src.tar.xz 132049300 BLAKE2B 0681177cfe6a65f5cf11942381078388e8f5d9d5a4bb50b040e4c10a3898e7311ff379fcca008e82e4bef225792a38eb77f722c972725b9251a0fda29d8d7ecc SHA512 b8b8a00c560bc7d4c4b5d533b92dbd52f2c0254f0acf687e787e8b7fa780cd5d96f6e9709356d2c406c0b36b186dee4de6b1bc1928a97de0bda863fa873e0783
 DIST llvm-project-18.1.3.src.tar.xz.sig 566 BLAKE2B dcecf41346cc864c6e5bedd3a7db3db4f32a68534364d2537a15ca7e4e2f2d35a22722385ac556d2a4ac48ab37567566094f223534e696299f98040e702146d0 SHA512 b7e50779841891e9ed9de5ed917c5be3209a52a5d98c67a032509ae8fad8a2a882bf619c66d2ee45bb53dfb03d750cb94dc4b2750ec2a8edb0465700d5bc657c
+DIST llvm-project-18.1.4.src.tar.xz 132054668 BLAKE2B 94bbad3b185fd07cbace4eff79aba80fbdd5e072739250e3927fe1848bcf3f8d355eb1f384e57306707eb702acc7ab01b732590735be7950221607664d04b0a6 SHA512 b1b214ae91f3705d8ea345547ad53f1e5d7d884c1eb6958bc41c14ac4b3e407771ccc2b693686ff103c8232c2c3942731d6db9a9cb4f735e6c6a0674739d0b29
+DIST llvm-project-18.1.4.src.tar.xz.sig 566 BLAKE2B b74fd219d7bcdf197b4e711cfbb25c40e9d8d2c7341de0215d8c31f330f396e9c166ff63513829cdc9cef349f08238f66a4dc949fa97958a7af496abae369eaa SHA512 4f456edf4fb454815acaef6855b1a0991f229810a32e9369af83388e37f0ef8964308e1e93bd6216024cdd67e86caaadc8d5794467857cc6fe561c9fa6ca7386
 DIST llvm-project-a8b0ecd2605ff23f495a8af64e06c35f86834e54.tar.gz 208451583 BLAKE2B 3f8557637b9d10ed924cfec0b3e83d85996417df24b317cac55740aa199ef97cf7560fe634debd1dbfc7c9fc25aa2b2643fccaecc4c866481dc57b11eba1d02f SHA512 1f4bf5a8a59582af426ad13cc828e1e482c5c831ed5a4bb0da419ed3cf67e5e485fd36074603ad22328e35be44b8ccd2d92d1382bc7a228fdf38d458a2321e07
 DIST llvm-project-ee284d2da0720dc21191d6f545504cbfcf5dcbcf.tar.gz 208883034 BLAKE2B e37c9f1a6a4d0caa9a3091f979dd09f509d458f8b7b30286c77dd2385aea748b7aac6dd488c79573f82feb655aa321717bd2fb46bba4a12b388b52064f6e13bf SHA512 1335ade87cd2accc47ac47ed2ab302999e375808b158b6c9d31fac9059cbb992d2bdaaadf1fd9a1b37268c1123d43346ea4d150894d6d2e6f80ba790b65b93b1

diff --git a/sys-libs/libomp/libomp-18.1.4.ebuild b/sys-libs/libomp/libomp-18.1.4.ebuild
new file mode 100644
index 000000000000..5f6fa687234c
--- /dev/null
+++ b/sys-libs/libomp/libomp-18.1.4.ebuild
@@ -0,0 +1,161 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{10..12} )
+inherit flag-o-matic cmake-multilib linux-info llvm.org llvm-utils
+inherit python-single-r1 toolchain-funcs
+
+DESCRIPTION="OpenMP runtime library for LLVM/clang compiler"
+HOMEPAGE="https://openmp.llvm.org"
+
+LICENSE="Apache-2.0-with-LLVM-exceptions || ( UoI-NCSA MIT )"
+SLOT="0/${LLVM_SOABI}"
+KEYWORDS="~amd64 ~arm ~arm64 ~loong ~ppc64 ~riscv ~x86 ~amd64-linux ~x64-macos"
+IUSE="
+	debug gdb-plugin hwloc offload ompt test
+	llvm_targets_AMDGPU llvm_targets_NVPTX
+"
+REQUIRED_USE="
+	gdb-plugin? ( ${PYTHON_REQUIRED_USE} )
+"
+RESTRICT="!test? ( test )"
+
+RDEPEND="
+	gdb-plugin? ( ${PYTHON_DEPS} )
+	hwloc? ( >=sys-apps/hwloc-2.5:0=[${MULTILIB_USEDEP}] )
+	offload? (
+		dev-libs/libffi:=[${MULTILIB_USEDEP}]
+		~sys-devel/llvm-${PV}[${MULTILIB_USEDEP}]
+		llvm_targets_AMDGPU? ( dev-libs/rocr-runtime:= )
+	)
+"
+# tests:
+# - dev-python/lit provides the test runner
+# - sys-devel/llvm provide test utils (e.g. FileCheck)
+# - sys-devel/clang provides the compiler to run tests
+DEPEND="
+	${RDEPEND}
+"
+BDEPEND="
+	dev-lang/perl
+	offload? (
+		llvm_targets_AMDGPU? ( sys-devel/clang )
+		llvm_targets_NVPTX? ( sys-devel/clang )
+		virtual/pkgconfig
+	)
+	test? (
+		${PYTHON_DEPS}
+		$(python_gen_cond_dep '
+			dev-python/lit[${PYTHON_USEDEP}]
+		')
+		sys-devel/clang
+	)
+"
+
+LLVM_COMPONENTS=( openmp cmake llvm/include )
+llvm.org_set_globals
+
+kernel_pds_check() {
+	if use kernel_linux && kernel_is -lt 4 15 && kernel_is -ge 4 13; then
+		local CONFIG_CHECK="~!SCHED_PDS"
+		local ERROR_SCHED_PDS="\
+PDS scheduler versions >= 0.98c < 0.98i (e.g. used in kernels >= 4.13-pf11
+< 4.14-pf9) do not implement sched_yield() call which may result in horrible
+performance problems with libomp. If you are using one of the specified
+kernel versions, you may want to disable the PDS scheduler."
+
+		check_extra_config
+	fi
+}
+
+pkg_pretend() {
+	kernel_pds_check
+}
+
+pkg_setup() {
+	if use gdb-plugin || use test; then
+		python-single-r1_pkg_setup
+	fi
+}
+
+multilib_src_configure() {
+	use offload && llvm_prepend_path "${LLVM_MAJOR}"
+
+	# LTO causes issues in other packages building, #870127
+	filter-lto
+
+	# LLVM_ENABLE_ASSERTIONS=NO does not guarantee this for us, #614844
+	use debug || local -x CPPFLAGS="${CPPFLAGS} -DNDEBUG"
+
+	local build_omptarget=OFF
+	# upstream disallows building libomptarget when sizeof(void*) != 8
+	if use offload &&
+		"$(tc-getCC)" ${CFLAGS} ${CPPFLAGS} -c -x c - -o /dev/null \
+		<<-EOF &>/dev/null
+			int test[sizeof(void *) == 8 ? 1 : -1];
+		EOF
+	then
+		build_omptarget=ON
+	fi
+
+	local libdir="$(get_libdir)"
+	local mycmakeargs=(
+		-DOPENMP_LIBDIR_SUFFIX="${libdir#lib}"
+
+		-DLIBOMP_USE_HWLOC=$(usex hwloc)
+		-DLIBOMP_OMPD_GDB_SUPPORT=$(multilib_native_usex gdb-plugin)
+		-DLIBOMP_OMPT_SUPPORT=$(usex ompt)
+
+		-DOPENMP_ENABLE_LIBOMPTARGET=${build_omptarget}
+
+		# do not install libgomp.so & libiomp5.so aliases
+		-DLIBOMP_INSTALL_ALIASES=OFF
+		# disable unnecessary hack copying stuff back to srcdir
+		-DLIBOMP_COPY_EXPORTS=OFF
+	)
+
+	if [[ ${build_omptarget} == ON ]]; then
+		local ffi_cflags=$($(tc-getPKG_CONFIG) --cflags-only-I libffi)
+		local ffi_ldflags=$($(tc-getPKG_CONFIG) --libs-only-L libffi)
+		mycmakeargs+=(
+			-DFFI_INCLUDE_DIR="${ffi_cflags#-I}"
+			-DFFI_LIBRARY_DIR="${ffi_ldflags#-L}"
+		)
+
+		if has "${CHOST%%-*}" aarch64 powerpc64le x86_64; then
+			mycmakeargs+=(
+				-DLIBOMPTARGET_BUILD_AMDGPU_PLUGIN=$(usex llvm_targets_AMDGPU)
+				-DLIBOMPTARGET_BUILD_CUDA_PLUGIN=$(usex llvm_targets_NVPTX)
+
+				# prevent trying to access the GPU
+				-DLIBOMPTARGET_AMDGPU_ARCH=LIBOMPTARGET_AMDGPU_ARCH-NOTFOUND
+				-DLIBOMPTARGET_NVPTX_ARCH=LIBOMPTARGET_NVPTX_ARCH-NOTFOUND
+			)
+		else
+			mycmakeargs+=(
+				-DLIBOMPTARGET_BUILD_AMDGPU_PLUGIN=OFF
+				-DLIBOMPTARGET_BUILD_CUDA_PLUGIN=OFF
+			)
+		fi
+	fi
+
+	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++")"
+	)
+	addpredict /dev/nvidiactl
+	cmake_src_configure
+}
+
+multilib_src_test() {
+	# respect TMPDIR!
+	local -x LIT_PRESERVES_TMP=1
+
+	cmake_build check-libomp
+}