commit:     071eeea797884907023ef46b09653c0a7a0eca68
Author:     Matthew White <mehw.is.me <AT> inventati <DOT> org>
AuthorDate: Sun Mar 31 10:14:43 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Jul  8 11:38:56 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=071eeea7

dev-libs/pocl: bump version to 5.0

Closes: https://bugs.gentoo.org/922912
Package-Manager: portage-3.0.63
Signed-off-by: Matthew White <mehw.is.me <AT> inventati.org>
Closes: https://github.com/gentoo/gentoo/pull/36014
Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-libs/pocl/Manifest                             |   1 +
 .../files/pocl-5.0-missing-definitions-fix.patch   |  41 ++++++++
 dev-libs/pocl/pocl-5.0.ebuild                      | 115 +++++++++++++++++++++
 3 files changed, 157 insertions(+)

diff --git a/dev-libs/pocl/Manifest b/dev-libs/pocl/Manifest
index b2eb19f5fd11..336dcf9d0f22 100644
--- a/dev-libs/pocl/Manifest
+++ b/dev-libs/pocl/Manifest
@@ -1 +1,2 @@
 DIST pocl-4.0.tar.gz 2140919 BLAKE2B 
1e9dd4de4824dd4a9e2b0d053d1786062c135d3bf7ca99dc884657b89c651fca6c0f3dedb568439802a58b0bfabc10939ca344b0110ae5fdb31be06f596d2a48
 SHA512 
3835a9e8fc8562d50a91a11b807cf87a096891f5c27675127b66412eacff2e541b6143b49b4155f43a09f4e53faa062ec20f3b20badeca206ece9f45ad50f26a
+DIST pocl-5.0.tar.gz 2361502 BLAKE2B 
eca07953ff56e7e4ca10f71db12819547bc8ff28da26e569c3544edd802f9ded0a8bd0d9cb260069cfe3788f9bc6c84d6ae96c1148c4e92fe6268a95a60ee5b6
 SHA512 
c2d6c80cbcba7af1c31dfa794c2aa7be6d1ce2cc9900fbf6e0a1536747440602cdc0f1a84f81f85737818a7ea60b490558ef328b3b156e52c63db3fe4ce490b0

diff --git a/dev-libs/pocl/files/pocl-5.0-missing-definitions-fix.patch 
b/dev-libs/pocl/files/pocl-5.0-missing-definitions-fix.patch
new file mode 100644
index 000000000000..251bdad65bd6
--- /dev/null
+++ b/dev-libs/pocl/files/pocl-5.0-missing-definitions-fix.patch
@@ -0,0 +1,41 @@
+Fixes missing definitions.
+
+FAILED: 
lib/CL/devices/almaif/CMakeFiles/pocl-devices-almaif.dir/MMAPDevice.cc.o
+/usr/bin/x86_64-pc-linux-gnu-g++ -DCL_HPP_TARGET_OPENCL_VERSION=300 
-DCL_TARGET_OPENCL_VERSION=300 -DCL_USE_DEPRECATED_OPENCL_1_0_APIS 
-DCL_USE_DEPRECATED_OPENCL_1_1_APIS -DCL_USE_DEPRECATED_OPENCL_1_2_APIS 
-DCL_USE_DEPRECATED_OPENCL_2_0_APIS -DCL_USE_DEPRECATED_OPENCL_2_1_APIS 
-DCL_USE_DEPRECATED_OPENCL_2_2_APIS -Dpocl_devices_almaif_EXPORTS 
-I/var/tmp/portage/dev-libs/pocl-5.0/work/pocl-5.0_build 
-I/var/tmp/portage/dev-libs/pocl-5.0/work/pocl-5.0/include 
-I/var/tmp/portage/dev-libs/pocl-5.0/work/pocl-5.0/include/hpp 
-I/var/tmp/portage/dev-libs/pocl-5.0/work/pocl-5.0/lib/CL/devices 
-I/var/tmp/portage/dev-libs/pocl-5.0/work/pocl-5.0/lib/CL/.  -O2 -pipe 
-march=x86-64 -mtune=generic -std=c++11 -fPIC -Wno-ignored-attributes 
-fvisibility=hidden -fvisibility-inlines-hidden -MD -MT 
lib/CL/devices/almaif/CMakeFiles/pocl-devices-almaif.dir/MMAPDevice.cc.o -MF 
lib/CL/devices/almaif/CMakeFiles/pocl-devices-almaif.dir/MMAPDevice.cc.o.d -o 
lib/CL/devices/almaif/CMakeFiles/pocl-devices-almaif.di
 r/MMAPDevice.cc.o -c 
/var/tmp/portage/dev-libs/pocl-5.0/work/pocl-5.0/lib/CL/devices/almaif/MMAPDevice.cc
+In file included from 
/var/tmp/portage/dev-libs/pocl-5.0/work/pocl-5.0/lib/CL/devices/almaif/MMAPDevice.hh:28,
+                 from 
/var/tmp/portage/dev-libs/pocl-5.0/work/pocl-5.0/lib/CL/devices/almaif/MMAPDevice.cc:24:
+/var/tmp/portage/dev-libs/pocl-5.0/work/pocl-5.0/lib/CL/devices/almaif/AlmaIFDevice.hh:45:36:
 error: ‘cl_kernel’ has not been declared
+   45 |                                    cl_kernel Kernel, _cl_command_node 
*Command);
+      |                                    ^~~~~~~~~
+/var/tmp/portage/dev-libs/pocl-5.0/work/pocl-5.0/lib/CL/devices/almaif/AlmaIFDevice.hh:45:54:
 error: ‘_cl_command_node’ has not been declared
+   45 |                                    cl_kernel Kernel, _cl_command_node 
*Command);
+      |                                                      ^~~~~~~~~~~~~~~~
+/var/tmp/portage/dev-libs/pocl-5.0/work/pocl-5.0/lib/CL/devices/almaif/AlmaIFDevice.hh:67:34:
 error: ‘pocl_mem_identifier’ has not been declared
+   67 |   virtual void writeDataToDevice(pocl_mem_identifier *DstMemId,
+      |                                  ^~~~~~~~~~~~~~~~~~~
+/var/tmp/portage/dev-libs/pocl-5.0/work/pocl-5.0/lib/CL/devices/almaif/AlmaIFDevice.hh:71:35:
 error: ‘pocl_mem_identifier’ has not been declared
+   71 |                                   pocl_mem_identifier *SrcMemId, 
size_t Size,
+      |                                   ^~~~~~~~~~~~~~~~~~~
+/var/tmp/portage/dev-libs/pocl-5.0/work/pocl-5.0/lib/CL/devices/almaif/AlmaIFDevice.hh:79:11:
 error: ‘cl_int’ does not name a type; did you mean ‘u_int’?
+   79 |   virtual cl_int allocateBuffer(pocl_mem_identifier *P, size_t Size);
+      |           ^~~~~~
+      |           u_int
+/var/tmp/portage/dev-libs/pocl-5.0/work/pocl-5.0/lib/CL/devices/almaif/AlmaIFDevice.hh:81:27:
 error: ‘pocl_mem_identifier’ has not been declared
+   81 |   virtual void freeBuffer(pocl_mem_identifier *P);
+      |                           ^~~~~~~~~~~~~~~~~~~
+/var/tmp/portage/dev-libs/pocl-5.0/work/pocl-5.0/lib/CL/devices/almaif/AlmaIFDevice.hh:83:38:
 error: ‘pocl_mem_identifier’ has not been declared
+   83 |   virtual size_t pointerDeviceOffset(pocl_mem_identifier *P);
+      |                                      ^~~~~~~~~~~~~~~~~~~
+
+diff -Nuar a/lib/CL/devices/almaif/AlmaIFDevice.hh 
b/lib/CL/devices/almaif/AlmaIFDevice.hh
+--- a/lib/CL/devices/almaif/AlmaIFDevice.hh    2023-12-19 13:24:31.000000000 
+0000
++++ b/lib/CL/devices/almaif/AlmaIFDevice.hh    2024-01-13 03:42:12.045091773 
+0000
+@@ -34,6 +34,8 @@
+ #include <stdlib.h>
+ #include <string>
+ 
++#include "pocl_cl.h"
++
+ struct almaif_kernel_data_s;
+ 
+ class AlmaIFDevice {

diff --git a/dev-libs/pocl/pocl-5.0.ebuild b/dev-libs/pocl/pocl-5.0.ebuild
new file mode 100644
index 000000000000..16d02903db69
--- /dev/null
+++ b/dev-libs/pocl/pocl-5.0.ebuild
@@ -0,0 +1,115 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+LLVM_MAX_SLOT=17
+inherit cmake llvm
+
+DESCRIPTION="Portable Computing Language (an implementation of OpenCL)"
+HOMEPAGE="http://portablecl.org https://github.com/pocl/pocl";
+SRC_URI="https://github.com/pocl/pocl/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc64"
+# TODO: hsa tce
+IUSE="accel +conformance cuda debug examples float-conversion hardening +hwloc 
memmanager test"
+# Tests not yet passing, fragile in Portage environment(?)
+RESTRICT="!test? ( test ) test"
+
+# TODO: add dependencies for cuda
+# Note: No := on LLVM because it pulls in Clang
+# see llvm.eclass for why
+CLANG_DEPS="
+       !cuda? ( <sys-devel/clang-$((${LLVM_MAX_SLOT} + 1)):= )
+       cuda? ( <sys-devel/clang-$((${LLVM_MAX_SLOT} + 
1)):=[llvm_targets_NVPTX] )
+"
+RDEPEND="
+       dev-libs/libltdl
+       <sys-devel/llvm-$((${LLVM_MAX_SLOT} + 1)):*
+       virtual/opencl
+
+       ${CLANG_DEPS}
+       debug? ( dev-util/lttng-ust:= )
+       hwloc? ( sys-apps/hwloc:=[cuda?] )
+"
+DEPEND="${RDEPEND}"
+BDEPEND="
+       ${CLANG_DEPS}
+       virtual/pkgconfig
+"
+
+PATCHES=( "${FILESDIR}/${P}-missing-definitions-fix.patch" )
+
+llvm_check_deps() {
+       local usedep=$(usev cuda "[llvm_targets_NVPTX]")
+
+       # Clang is used at both build time (executed) and runtime
+       has_version -r "sys-devel/llvm:${LLVM_SLOT}${usedep}" && \
+               has_version -r "sys-devel/clang:${LLVM_SLOT}${usedep}" && \
+               has_version -b "sys-devel/clang:${LLVM_SLOT}${usedep}"
+}
+
+src_configure() {
+       local host_cpu_variants="generic"
+
+       if use amd64 ; then
+               # Use pocl's curated list of CPU variants which should contain 
a good match for any given amd64 CPU
+               host_cpu_variants="distro"
+       elif use ppc64 ; then
+               # A selection of architectures in which new Altivec / VSX 
features were added
+               # This attempts to recreate the amd64 "distro" option for ppc64
+               # See discussion in bug #831859
+               host_cpu_variants="pwr10;pwr9;pwr8;pwr7;pwr6;g5;a2;generic"
+       fi
+
+       local mycmakeargs=(
+               -DENABLE_HSA=OFF
+
+               -DENABLE_ICD=ON
+               -DPOCL_ICD_ABSOLUTE_PATH=ON
+               
-DPOCL_INSTALL_PUBLIC_LIBDIR="${EPREFIX}/usr/$(get_libdir)/OpenCL/vendors/pocl"
+
+               # only appends -flto
+               -DENABLE_IPO=OFF
+
+               -DENABLE_POCL_BUILDING=ON
+               -DKERNELLIB_HOST_CPU_VARIANTS="${host_cpu_variants}"
+
+               -DSTATIC_LLVM=OFF
+               -DWITH_LLVM_CONFIG=$(get_llvm_prefix -d 
"${LLVM_MAX_SLOT}")/bin/llvm-config
+
+               -DENABLE_ALMAIF_DEVICE=$(usex accel)
+               -DENABLE_CONFORMANCE=$(usex conformance)
+               -DENABLE_CUDA=$(usex cuda)
+               -DENABLE_HWLOC=$(usex hwloc)
+               -DENABLE_POCL_FLOAT_CONVERSION=$(usex float-conversion)
+               -DHARDENING_ENABLE=$(usex hardening)
+               -DPOCL_DEBUG_MESSAGES=$(usex debug)
+               -DUSE_POCL_MEMMANAGER=$(usex memmanager)
+               -DENABLE_TESTS=$(usex test)
+       )
+
+       cmake_src_configure
+}
+
+src_test() {
+       export POCL_BUILDING=1
+       export POCL_DEVICES=basic
+       export CTEST_OUTPUT_ON_FAILURE=1
+       export TEST_VERBOSE=1
+
+       # Referenced https://github.com/pocl/pocl/blob/master/.drone.yml
+       # But couldn't seem to get tests working yet
+       cmake_src_test
+}
+
+src_install() {
+       cmake_src_install
+
+       if use examples; then
+               dodoc -r examples
+               docompress -x /usr/share/doc/${P}/examples
+       fi
+}

Reply via email to