public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-libs/pocl/files/, dev-libs/pocl/
Date: Wed, 20 Jul 2022 05:10:46 +0000 (UTC)	[thread overview]
Message-ID: <1658293746.a8eaf7528b14c0bf00989be80ecddf94f4ac2bc6.sam@gentoo> (raw)

commit:     a8eaf7528b14c0bf00989be80ecddf94f4ac2bc6
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Jul 20 05:04:46 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Jul 20 05:09:06 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a8eaf752

dev-libs/pocl: add 3.0

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

 dev-libs/pocl/Manifest                 |   1 +
 dev-libs/pocl/files/pocl-3.0-icd.patch | 127 ++++++++++++++++++++++++++++++++
 dev-libs/pocl/metadata.xml             |   1 +
 dev-libs/pocl/pocl-3.0.ebuild          | 131 +++++++++++++++++++++++++++++++++
 4 files changed, 260 insertions(+)

diff --git a/dev-libs/pocl/Manifest b/dev-libs/pocl/Manifest
index eacf11d34468..e1f69ae33d0f 100644
--- a/dev-libs/pocl/Manifest
+++ b/dev-libs/pocl/Manifest
@@ -1 +1,2 @@
 DIST pocl-1.8.tar.gz 1614545 BLAKE2B b0ccc08d1f899719f5def731c61727440035a879ebeebae89dd406423eba6c12b866f34cd47dd0e0f944b7f0c4569c57c44a9a62bf02552de5c4c3b8c9fb3b48 SHA512 bcbb3fa3d2234d4c5b0c17863eba0bc4c8f13f863cc58cfd1de49e21fa7bf0aec82b81aec143c81885e3a39274c8ae783b2f03b9a12846e024204d6ed0e59a9d
+DIST pocl-3.0.tar.gz 1722809 BLAKE2B 095d3d1dca3fa7ebdf61e6e34bf444755dd6842c4f16e0f80895337e96508056465d332309d38ee4db6d6b0031e1dfce350485750e59bfe0dea5951eba5fd3e4 SHA512 dc02bdf259792edb5cb3c80cde5c5261e1e21219b4b31420a3b537abbca1bc478ce0ca0dfc622727088b67d580217d47566309de7c6114a24553de4496a209ea

diff --git a/dev-libs/pocl/files/pocl-3.0-icd.patch b/dev-libs/pocl/files/pocl-3.0-icd.patch
new file mode 100644
index 000000000000..f64e633e2f53
--- /dev/null
+++ b/dev-libs/pocl/files/pocl-3.0-icd.patch
@@ -0,0 +1,127 @@
+From 408fe60850977ab9c68d174a42ae4a5f3455cab1 Mon Sep 17 00:00:00 2001
+From: Sam James <sam@gentoo.org>
+Date: Wed, 20 Jul 2022 04:59:11 +0000
+Subject: [PATCH] CMake: fix build without ocl-icd
+
+If not using ocl-icd (in this case, I was using dev-libs/opencl-icd-loader),
+OCL_ICD_INCLUDE_DIRS and friends won't be defined and CMake bails out
+with an error:
+```
+-- Configuring done
+CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
+Please set them or make sure they are set and tested correctly in the CMake files:
+/var/tmp/portage/dev-libs/pocl-3.0/work/pocl-3.0/lib/CL/OCL_ICD_INCLUDE_DIRS
+   used as include directory in directory /var/tmp/portage/dev-libs/pocl-3.0/work/pocl-3.0/lib/CL
+   used as include directory in directory /var/tmp/portage/dev-libs/pocl-3.0/work/pocl-3.0/lib/CL
+/var/tmp/portage/dev-libs/pocl-3.0/work/pocl-3.0/lib/CL/devices/OCL_ICD_INCLUDE_DIRS
+   used as include directory in directory /var/tmp/portage/dev-libs/pocl-3.0/work/pocl-3.0/lib/CL/devices
+/var/tmp/portage/dev-libs/pocl-3.0/work/pocl-3.0/lib/CL/devices/basic/OCL_ICD_INCLUDE_DIRS
+   used as include directory in directory /var/tmp/portage/dev-libs/pocl-3.0/work/pocl-3.0/lib/CL/devices/basic
+/var/tmp/portage/dev-libs/pocl-3.0/work/pocl-3.0/lib/CL/devices/pthread/OCL_ICD_INCLUDE_DIRS
+   used as include directory in directory /var/tmp/portage/dev-libs/pocl-3.0/work/pocl-3.0/lib/CL/devices/pthread
+/var/tmp/portage/dev-libs/pocl-3.0/work/pocl-3.0/lib/CL/devices/topology/OCL_ICD_INCLUDE_DIRS
+   used as include directory in directory /var/tmp/portage/dev-libs/pocl-3.0/work/pocl-3.0/lib/CL/devices/topology
+/var/tmp/portage/dev-libs/pocl-3.0/work/pocl-3.0/lib/llvmopencl/OCL_ICD_INCLUDE_DIRS
+   used as include directory in directory /var/tmp/portage/dev-libs/pocl-3.0/work/pocl-3.0/lib/llvmopencl
+```
+
+This broke in 3ecda3b294d70e4f915ad141d669f4bc1298f606.
+
+To fix, just check if the value is truthy before using (this is enough
+for checking if it's NOTFOUND).
+--- a/lib/CL/CMakeLists.txt
++++ b/lib/CL/CMakeLists.txt
+@@ -179,7 +179,9 @@ endif()
+ add_library("pocl_cache" OBJECT "pocl_cache.c")
+ harden("pocl_cache")
+ 
+-target_include_directories("pocl_cache" SYSTEM PUBLIC ${OCL_ICD_INCLUDE_DIRS})
++if(${OCL_ICD_INCLUDE_DIRS})
++  target_include_directories("pocl_cache" SYSTEM PUBLIC ${OCL_ICD_INCLUDE_DIRS})
++endif()
+ 
+ 
+ if (ENABLE_LLVM)
+@@ -190,7 +192,9 @@ if (ENABLE_LLVM)
+   add_library("lib_cl_llvm" OBJECT ${LLVM_API_SOURCES})
+   harden("lib_cl_llvm")
+ 
+-  target_include_directories("lib_cl_llvm" SYSTEM PUBLIC ${OCL_ICD_INCLUDE_DIRS})
++  if(${OCL_ICD_INCLUDE_DIRS})
++    target_include_directories("lib_cl_llvm" SYSTEM PUBLIC ${OCL_ICD_INCLUDE_DIRS})
++  endif()
+ 
+   list(APPEND LIBPOCL_OBJS "$<TARGET_OBJECTS:llvmpasses>")
+   list(APPEND LIBPOCL_OBJS "$<TARGET_OBJECTS:lib_cl_llvm>")
+@@ -200,7 +204,9 @@ if (ENABLE_LLVM)
+ endif()
+ 
+ if(ENABLE_ICD)
+-  add_compile_options(${OCL_ICD_CFLAGS})
++  if(${OCL_ICD_CFLAGS})
++    add_compile_options(${OCL_ICD_CFLAGS})
++  endif()
+ endif()
+ 
+ if(HAVE_LTTNG_UST)
+--- a/lib/CL/devices/CMakeLists.txt
++++ b/lib/CL/devices/CMakeLists.txt
+@@ -28,7 +28,9 @@ if(ENABLE_LOADABLE_DRIVERS)
+   function(add_pocl_device_library name)
+     add_library(${name} SHARED ${ARGN})
+     harden("${name}")
+-    target_include_directories(${name} SYSTEM PUBLIC ${OCL_ICD_INCLUDE_DIRS})
++    if(${OCL_ICD_INCLUDE_DIRS})
++      target_include_directories(${name} SYSTEM PUBLIC ${OCL_ICD_INCLUDE_DIRS})
++    endif()
+     target_link_libraries(${name} PUBLIC ${POCL_PUBLIC_LINK_LIST} PRIVATE ${POCL_LIBRARY_NAME} ${POCL_PRIVATE_LINK_LIST})
+     set_target_properties(${name} PROPERTIES PREFIX "lib" SUFFIX ".so")
+     install(TARGETS ${name} LIBRARY DESTINATION "${POCL_INSTALL_PRIVATE_LIBDIR}" COMPONENT "lib")
+@@ -38,7 +40,9 @@ else()
+ 
+   function(add_pocl_device_library name)
+     add_library(${name} OBJECT ${ARGN})
+-    target_include_directories(${name} SYSTEM PUBLIC ${OCL_ICD_INCLUDE_DIRS})
++    if(${OCL_ICD_INCLUDE_DIRS})
++      target_include_directories(${name} SYSTEM PUBLIC ${OCL_ICD_INCLUDE_DIRS})
++    endif()
+   endfunction()
+ 
+ endif()
+@@ -143,7 +147,9 @@ if(MSVC)
+   set_source_files_properties( ${POCL_DEVICES_SOURCES} PROPERTIES LANGUAGE CXX )
+ endif(MSVC)
+ add_library("pocl-devices" OBJECT ${POCL_DEVICES_SOURCES})
+-target_include_directories("pocl-devices" SYSTEM PUBLIC ${OCL_ICD_INCLUDE_DIRS})
++if(${OCL_ICD_INCLUDE_DIRS})
++  target_include_directories("pocl-devices" SYSTEM PUBLIC ${OCL_ICD_INCLUDE_DIRS})
++endif()
+ set(POCL_DEVICES_OBJS "${POCL_DEVICES_OBJS}"
+     "$<TARGET_OBJECTS:pocl-devices>")
+ harden("pocl-devices")
+--- a/lib/CL/devices/topology/CMakeLists.txt
++++ b/lib/CL/devices/topology/CMakeLists.txt
+@@ -30,7 +30,9 @@ endif(MSVC)
+ add_library("pocl-devices-topology" OBJECT pocl_topology.c pocl_topology.h)
+ harden("pocl-devices-topology")
+ 
+-target_include_directories("pocl-devices-topology" SYSTEM PUBLIC ${OCL_ICD_INCLUDE_DIRS})
++if(${OCL_ICD_INCLUDE_DIRS})
++  target_include_directories("pocl-devices-topology" SYSTEM PUBLIC ${OCL_ICD_INCLUDE_DIRS})
++endif()
+ 
+ if(Hwloc_FOUND)
+         target_include_directories("pocl-devices-topology" SYSTEM PUBLIC ${Hwloc_INCLUDE_DIRS})
+--- a/lib/llvmopencl/CMakeLists.txt
++++ b/lib/llvmopencl/CMakeLists.txt
+@@ -101,7 +101,9 @@ endif(MSVC)
+ add_library("llvmpasses" OBJECT ${LLVMPASSES_SOURCES})
+ harden("llvmpasses")
+ 
+-target_include_directories("llvmpasses" SYSTEM PUBLIC ${OCL_ICD_INCLUDE_DIRS})
++if(${OCL_ICD_INCLUDE_DIRS})
++  target_include_directories("llvmpasses" SYSTEM PUBLIC ${OCL_ICD_INCLUDE_DIRS})
++endif()
+ 
+ option(ENABLE_LIBLLVMOPENCL "Build separate libllvmopencl.so for use with 'opt'" OFF)
+ if(ENABLE_LIBLLVMOPENCL)

diff --git a/dev-libs/pocl/metadata.xml b/dev-libs/pocl/metadata.xml
index 1e1a7087abb5..9e73154528e9 100644
--- a/dev-libs/pocl/metadata.xml
+++ b/dev-libs/pocl/metadata.xml
@@ -14,6 +14,7 @@
 		<!--<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>
+		<flag name="lto">Adds support for link time optimization</flag>
 	</use>
 	<upstream>
 		<remote-id type="github">pocl/pocl</remote-id>

diff --git a/dev-libs/pocl/pocl-3.0.ebuild b/dev-libs/pocl/pocl-3.0.ebuild
new file mode 100644
index 000000000000..4845b2e15a71
--- /dev/null
+++ b/dev-libs/pocl/pocl-3.0.ebuild
@@ -0,0 +1,131 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DOCS_AUTODOC=0
+DOCS_BUILDER="sphinx"
+DOCS_DIR="doc/sphinx/source"
+PYTHON_COMPAT=( python3_{8..10} pypy3 )
+LLVM_MAX_SLOT=14
+
+inherit cmake llvm python-any-r1 docs
+
+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"
+# TODO: hsa tce
+IUSE="accel +conformance cuda debug examples float-conversion hardening +hwloc memmanager lto 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
+	doc? (
+		$(python_gen_any_dep '<dev-python/markupsafe-2.0[${PYTHON_USEDEP}]')
+	)"
+
+PATCHES=(
+	"${FILESDIR}"/${P}-icd.patch
+	"${FILESDIR}"/${P}-fix-version.patch
+)
+
+python_check_deps() {
+	has_version -b "<dev-python/markupsafe-2.0[${PYTHON_USEDEP}]"
+}
+
+llvm_check_deps() {
+	local usedep=$(usex 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}"
+}
+
+pkg_setup() {
+	use doc && python-any-r1_pkg_setup
+
+	llvm_pkg_setup
+}
+
+src_configure() {
+	local mycmakeargs=(
+		-DENABLE_HSA=OFF
+
+		-DENABLE_ICD=ON
+		-DPOCL_ICD_ABSOLUTE_PATH=ON
+		-DPOCL_INSTALL_PUBLIC_LIBDIR="${EPREFIX}/usr/$(get_libdir)/OpenCL/vendors/pocl"
+
+		-DENABLE_IPO=$(usex lto)
+
+		-DENABLE_POCL_BUILDING=ON
+		-DKERNELLIB_HOST_CPU_VARIANTS=distro
+
+		-DSTATIC_LLVM=OFF
+		-DWITH_LLVM_CONFIG=$(get_llvm_prefix -d "${LLVM_MAX_SLOT}")/bin/llvm-config
+
+		-DENABLE_ACCEL_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_compile() {
+	cmake_src_compile
+	docs_compile
+}
+
+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
+
+	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	other threads:[~2022-07-20  5:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-20  5:10 Sam James [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-09-11 18:13 [gentoo-commits] repo/gentoo:master commit in: dev-libs/pocl/files/, dev-libs/pocl/ Sam James
2022-12-05  4:37 Sam James
2023-01-20  1:23 Sam James
2023-05-20  7:15 Michał Górny

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1658293746.a8eaf7528b14c0bf00989be80ecddf94f4ac2bc6.sam@gentoo \
    --to=sam@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox