commit:     9b3e40bb2ab6366003b2dc967b3265a46a2fa14a
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun Dec 31 15:25:24 2023 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun Dec 31 15:25:24 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9b3e40bb

dev-lang/ispc: Add OpenMP task model support

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

 dev-lang/ispc/ispc-1.22.0-r1.ebuild | 12 +++++++++---
 dev-lang/ispc/metadata.xml          |  5 +++++
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/dev-lang/ispc/ispc-1.22.0-r1.ebuild 
b/dev-lang/ispc/ispc-1.22.0-r1.ebuild
index 129779363d29..7b18a7303e8a 100644
--- a/dev-lang/ispc/ispc-1.22.0-r1.ebuild
+++ b/dev-lang/ispc/ispc-1.22.0-r1.ebuild
@@ -6,7 +6,7 @@ EAPI=8
 PYTHON_COMPAT=( python3_{10..12} )
 LLVM_MAX_SLOT=17
 
-inherit cmake multiprocessing python-any-r1 llvm
+inherit cmake llvm multiprocessing python-any-r1 toolchain-funcs
 
 DESCRIPTION="Intel SPMD Program Compiler"
 HOMEPAGE="
@@ -21,13 +21,13 @@ SRC_URI="
 LICENSE="BSD BSD-2 UoI-NCSA"
 SLOT="0"
 KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~x86"
-IUSE="examples test"
+IUSE="examples openmp test"
 RESTRICT="!test? ( test )"
 
 DEPEND="
-       dev-cpp/tbb:=
        <sys-devel/clang-$((${LLVM_MAX_SLOT} + 1)):=
        sys-libs/ncurses:=
+       !openmp? ( dev-cpp/tbb:= )
 "
 RDEPEND="
        ${DEPEND}
@@ -38,7 +38,12 @@ BDEPEND="
        ${PYTHON_DEPS}
 "
 
+pkg_pretend() {
+       [[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
+}
+
 pkg_setup() {
+       [[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
        llvm_pkg_setup
        python-any-r1_pkg_setup
 }
@@ -62,6 +67,7 @@ src_configure() {
                -DISPC_INCLUDE_EXAMPLES=OFF
                -DISPC_INCLUDE_TESTS=$(usex test)
                -DISPC_INCLUDE_UTILS=OFF
+               -DISPCRT_BUILD_TASK_MODEL=$(usex openmp OpenMP TBB)
        )
        cmake_src_configure
 }

diff --git a/dev-lang/ispc/metadata.xml b/dev-lang/ispc/metadata.xml
index d25a0ca74f67..eb96ff15c20a 100644
--- a/dev-lang/ispc/metadata.xml
+++ b/dev-lang/ispc/metadata.xml
@@ -8,4 +8,9 @@
        <upstream>
                <remote-id type="github">ispc/ispc</remote-id>
        </upstream>
+       <use>
+               <flag name="openmp">
+                       Build with OpenMP task model (otherwise, TBB task model 
is used).
+               </flag>
+       </use>
 </pkgmetadata>

Reply via email to