commit:     4eae8cc9da09814d2b5a5d5c3f773bff6a48d75f
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Sep 22 22:26:31 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Sep 22 22:31:40 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4eae8cc9

dev-libs/pocl: initial import

Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-libs/pocl/Manifest                             |   1 +
 .../pocl/files/vendor_opencl_libs_location.patch   |  20 ++++
 dev-libs/pocl/metadata.xml                         |  21 +++++
 dev-libs/pocl/pocl-1.7.ebuild                      | 103 +++++++++++++++++++++
 4 files changed, 145 insertions(+)

diff --git a/dev-libs/pocl/Manifest b/dev-libs/pocl/Manifest
new file mode 100644
index 00000000000..4ac613d41bb
--- /dev/null
+++ b/dev-libs/pocl/Manifest
@@ -0,0 +1 @@
+DIST pocl-1.7.tar.gz 1577676 BLAKE2B 
50d4f50236b1c81f319b5559ca2b1df529209f07899acf51c487820d97cc6766c5130a55afca910517c7db63d8041ac8306062880c3a821cbc1bf9108bf13d65
 SHA512 
23bb82b25a222186c001b2ed413f26253e1e0e16518e98c95173f51491e15d107e6ab1b334ffd490b41199743267d9ad64882a22fea327e17ec9604f9847fc38

diff --git a/dev-libs/pocl/files/vendor_opencl_libs_location.patch 
b/dev-libs/pocl/files/vendor_opencl_libs_location.patch
new file mode 100644
index 00000000000..548589ca41b
--- /dev/null
+++ b/dev-libs/pocl/files/vendor_opencl_libs_location.patch
@@ -0,0 +1,20 @@
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -125,7 +125,7 @@
+ endif()
+ 
+ # for libpocl.so
+-set(POCL_INSTALL_PUBLIC_LIBDIR 
"${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" CACHE PATH "POCL public 
libdir")
++set(POCL_INSTALL_PUBLIC_LIBDIR 
"${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/OpenCL/vendors/pocl" CACHE 
PATH "POCL public libdir")
+ 
+ # for llvmopencl.so
+ set(POCL_INSTALL_PRIVATE_LIBDIR 
"${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/pocl" CACHE PATH "POCL private 
libdir")
+@@ -134,7 +134,7 @@
+ if(UNIX AND NOT CMAKE_CROSSCOMPILING AND 
CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
+   set(POCL_INSTALL_ICD_VENDORDIR "/etc/OpenCL/vendors" CACHE PATH "POCL ICD 
file destination")
+ else()
+-  set(POCL_INSTALL_ICD_VENDORDIR "${CMAKE_INSTALL_PREFIX}/etc/OpenCL/vendors" 
CACHE PATH "POCL ICD file destination")
++  set(POCL_INSTALL_ICD_VENDORDIR "${SYSCONFDIR}/etc/OpenCL/vendors" CACHE 
PATH "POCL ICD file destination")
+ endif()
+ 
+ # for kernel-<target>.bc

diff --git a/dev-libs/pocl/metadata.xml b/dev-libs/pocl/metadata.xml
new file mode 100644
index 00000000000..1e1a7087abb
--- /dev/null
+++ b/dev-libs/pocl/metadata.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<pkgmetadata>
+       <maintainer type="person">
+               <email>s...@gentoo.org</email>
+               <name>Sam James</name>
+       </maintainer>
+       <use>
+               <flag name="accel">Enable the generic hardware accelerator 
device driver</flag>
+               <flag name="cl20">Enable reporting OpenCL 2.0 for the CPU 
device</flag>
+               <flag name="conformance">Ensures that certain build options 
which would result in non-conformant pocl build stay disabled. Note that this 
does not quarantee a fully conformant build of pocl.</flag>
+               <flag name="cuda">Enable the CUDA backend for NVIDIA GPUs</flag>
+               <flag name="float-conversion">When enabled, OpenCL printf() 
call's f/e/g formatters are handled by pocl. When disabled, these are handled 
by system C library.</flag>
+               <flag name="hardening">Enable hardening against various 
attacks. May worsen performance</flag>
+               <!--<flag name="hsa">Enable the HSA base profile runtime device 
driver</flag>-->
+               <flag name="hwloc">Enable hwloc support</flag>
+               <flag name="memmanager">Enables custom memory manager. Except 
for special circumstances, this should be disabled</flag>
+       </use>
+       <upstream>
+               <remote-id type="github">pocl/pocl</remote-id>
+       </upstream>
+</pkgmetadata>

diff --git a/dev-libs/pocl/pocl-1.7.ebuild b/dev-libs/pocl/pocl-1.7.ebuild
new file mode 100644
index 00000000000..74100b13bb3
--- /dev/null
+++ b/dev-libs/pocl/pocl-1.7.ebuild
@@ -0,0 +1,103 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="7"
+
+DOCS_AUTODOC=0
+DOCS_BUILDER="sphinx"
+DOCS_DIR="doc/sphinx/source"
+PYTHON_COMPAT=( python3_{8..10} pypy3 )
+
+inherit cmake llvm python-any-r1 docs
+
+LLVM_MAX_SLOT=12
+
+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"
+IUSE="accel cl20 +conformance cuda debug examples float-conversion hardening 
+hwloc memmanager test" #hsa tce
+
+RESTRICT="!test? ( test ) mirror"
+
+#TODO: add dependencies for cuda
+RDEPEND="
+       dev-libs/libltdl
+       sys-devel/llvm:${LLVM_MAX_SLOT}
+       virtual/opencl
+
+       !cuda? ( sys-devel/clang:${LLVM_MAX_SLOT} )
+       cuda? ( sys-devel/clang:${LLVM_MAX_SLOT}[llvm_targets_NVPTX] )
+       debug? ( dev-util/lttng-ust )
+       hwloc? ( sys-apps/hwloc[cuda?] )
+"
+DEPEND="${RDEPEND}"
+BDEPEND="virtual/pkgconfig
+       doc? (
+               $(python_gen_any_dep 
'<dev-python/markupsafe-2.0[${PYTHON_USEDEP}]')
+       )"
+
+PATCHES=( "${FILESDIR}/vendor_opencl_libs_location.patch" )
+
+python_check_deps() {
+       has_version -b "<dev-python/markupsafe-2.0[${PYTHON_USEDEP}]"
+}
+
+pkg_setup() {
+       use doc && python-any-r1_pkg_setup
+}
+
+src_configure() {
+       llvm_pkg_setup
+       local mycmakeargs=(
+               -DBUILD_SHARED_LIBS=ON
+               -DENABLE_HSA=OFF
+               -DENABLE_ICD=ON
+               -DENABLE_POCL_BUILDING=ON
+               -DKERNELLIB_HOST_CPU_VARIANTS=native
+               -DPOCL_ICD_ABSOLUTE_PATH=ON
+               -DSTATIC_LLVM=OFF
+
+               -DENABLE_ACCEL_DEVICE=$(usex accel)
+               -DENABLE_CONFORMANCE=$(usex conformance)
+               -DENABLE_CUDA=$(usex cuda)
+               -DENABLE_HOST_CPU_DEVICE_CL20=$(usex cl20)
+               -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)
+               -DWITH_LLVM_CONFIG=$(get_llvm_prefix 
"${LLVM_MAX_SLOT}")/bin/llvm-config
+       )
+       cmake_src_configure
+}
+
+src_compile() {
+       cmake_src_compile
+       docs_compile
+}
+
+src_test() {
+       export POCL_BUILDING=1
+       export CTEST_OUTPUT_ON_FAILURE=1
+       cmake_src_test
+}
+
+src_install() {
+       cmake_src_install
+       dodoc CREDITS README CHANGES
+       if use doc; then
+               dodoc -r _build/html
+               docompress -x "/usr/share/doc/${P}/html"
+       fi
+       if use examples; then
+               dodoc -r examples
+               docompress -x "/usr/share/doc/${P}/examples"
+       fi
+}

Reply via email to