1 |
commit: 4eae8cc9da09814d2b5a5d5c3f773bff6a48d75f |
2 |
Author: Sam James <sam <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Sep 22 22:26:31 2021 +0000 |
4 |
Commit: Sam James <sam <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Sep 22 22:31:40 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4eae8cc9 |
7 |
|
8 |
dev-libs/pocl: initial import |
9 |
|
10 |
Signed-off-by: Sam James <sam <AT> gentoo.org> |
11 |
|
12 |
dev-libs/pocl/Manifest | 1 + |
13 |
.../pocl/files/vendor_opencl_libs_location.patch | 20 ++++ |
14 |
dev-libs/pocl/metadata.xml | 21 +++++ |
15 |
dev-libs/pocl/pocl-1.7.ebuild | 103 +++++++++++++++++++++ |
16 |
4 files changed, 145 insertions(+) |
17 |
|
18 |
diff --git a/dev-libs/pocl/Manifest b/dev-libs/pocl/Manifest |
19 |
new file mode 100644 |
20 |
index 00000000000..4ac613d41bb |
21 |
--- /dev/null |
22 |
+++ b/dev-libs/pocl/Manifest |
23 |
@@ -0,0 +1 @@ |
24 |
+DIST pocl-1.7.tar.gz 1577676 BLAKE2B 50d4f50236b1c81f319b5559ca2b1df529209f07899acf51c487820d97cc6766c5130a55afca910517c7db63d8041ac8306062880c3a821cbc1bf9108bf13d65 SHA512 23bb82b25a222186c001b2ed413f26253e1e0e16518e98c95173f51491e15d107e6ab1b334ffd490b41199743267d9ad64882a22fea327e17ec9604f9847fc38 |
25 |
|
26 |
diff --git a/dev-libs/pocl/files/vendor_opencl_libs_location.patch b/dev-libs/pocl/files/vendor_opencl_libs_location.patch |
27 |
new file mode 100644 |
28 |
index 00000000000..548589ca41b |
29 |
--- /dev/null |
30 |
+++ b/dev-libs/pocl/files/vendor_opencl_libs_location.patch |
31 |
@@ -0,0 +1,20 @@ |
32 |
+--- a/CMakeLists.txt |
33 |
++++ b/CMakeLists.txt |
34 |
+@@ -125,7 +125,7 @@ |
35 |
+ endif() |
36 |
+ |
37 |
+ # for libpocl.so |
38 |
+-set(POCL_INSTALL_PUBLIC_LIBDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" CACHE PATH "POCL public libdir") |
39 |
++set(POCL_INSTALL_PUBLIC_LIBDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/OpenCL/vendors/pocl" CACHE PATH "POCL public libdir") |
40 |
+ |
41 |
+ # for llvmopencl.so |
42 |
+ set(POCL_INSTALL_PRIVATE_LIBDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/pocl" CACHE PATH "POCL private libdir") |
43 |
+@@ -134,7 +134,7 @@ |
44 |
+ if(UNIX AND NOT CMAKE_CROSSCOMPILING AND CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) |
45 |
+ set(POCL_INSTALL_ICD_VENDORDIR "/etc/OpenCL/vendors" CACHE PATH "POCL ICD file destination") |
46 |
+ else() |
47 |
+- set(POCL_INSTALL_ICD_VENDORDIR "${CMAKE_INSTALL_PREFIX}/etc/OpenCL/vendors" CACHE PATH "POCL ICD file destination") |
48 |
++ set(POCL_INSTALL_ICD_VENDORDIR "${SYSCONFDIR}/etc/OpenCL/vendors" CACHE PATH "POCL ICD file destination") |
49 |
+ endif() |
50 |
+ |
51 |
+ # for kernel-<target>.bc |
52 |
|
53 |
diff --git a/dev-libs/pocl/metadata.xml b/dev-libs/pocl/metadata.xml |
54 |
new file mode 100644 |
55 |
index 00000000000..1e1a7087abb |
56 |
--- /dev/null |
57 |
+++ b/dev-libs/pocl/metadata.xml |
58 |
@@ -0,0 +1,21 @@ |
59 |
+<?xml version="1.0" encoding="UTF-8"?> |
60 |
+<pkgmetadata> |
61 |
+ <maintainer type="person"> |
62 |
+ <email>sam@g.o</email> |
63 |
+ <name>Sam James</name> |
64 |
+ </maintainer> |
65 |
+ <use> |
66 |
+ <flag name="accel">Enable the generic hardware accelerator device driver</flag> |
67 |
+ <flag name="cl20">Enable reporting OpenCL 2.0 for the CPU device</flag> |
68 |
+ <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> |
69 |
+ <flag name="cuda">Enable the CUDA backend for NVIDIA GPUs</flag> |
70 |
+ <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> |
71 |
+ <flag name="hardening">Enable hardening against various attacks. May worsen performance</flag> |
72 |
+ <!--<flag name="hsa">Enable the HSA base profile runtime device driver</flag>--> |
73 |
+ <flag name="hwloc">Enable hwloc support</flag> |
74 |
+ <flag name="memmanager">Enables custom memory manager. Except for special circumstances, this should be disabled</flag> |
75 |
+ </use> |
76 |
+ <upstream> |
77 |
+ <remote-id type="github">pocl/pocl</remote-id> |
78 |
+ </upstream> |
79 |
+</pkgmetadata> |
80 |
|
81 |
diff --git a/dev-libs/pocl/pocl-1.7.ebuild b/dev-libs/pocl/pocl-1.7.ebuild |
82 |
new file mode 100644 |
83 |
index 00000000000..74100b13bb3 |
84 |
--- /dev/null |
85 |
+++ b/dev-libs/pocl/pocl-1.7.ebuild |
86 |
@@ -0,0 +1,103 @@ |
87 |
+# Copyright 1999-2021 Gentoo Authors |
88 |
+# Distributed under the terms of the GNU General Public License v2 |
89 |
+ |
90 |
+EAPI="7" |
91 |
+ |
92 |
+DOCS_AUTODOC=0 |
93 |
+DOCS_BUILDER="sphinx" |
94 |
+DOCS_DIR="doc/sphinx/source" |
95 |
+PYTHON_COMPAT=( python3_{8..10} pypy3 ) |
96 |
+ |
97 |
+inherit cmake llvm python-any-r1 docs |
98 |
+ |
99 |
+LLVM_MAX_SLOT=12 |
100 |
+ |
101 |
+DESCRIPTION="Portable Computing Language (an implementation of OpenCL)" |
102 |
+HOMEPAGE=" |
103 |
+ http://portablecl.org |
104 |
+ https://github.com/pocl/pocl |
105 |
+" |
106 |
+SRC_URI="https://github.com/pocl/pocl/archive/v${PV}.tar.gz -> ${P}.tar.gz" |
107 |
+ |
108 |
+LICENSE="GPL-2" |
109 |
+SLOT="0" |
110 |
+KEYWORDS="~amd64" |
111 |
+IUSE="accel cl20 +conformance cuda debug examples float-conversion hardening +hwloc memmanager test" #hsa tce |
112 |
+ |
113 |
+RESTRICT="!test? ( test ) mirror" |
114 |
+ |
115 |
+#TODO: add dependencies for cuda |
116 |
+RDEPEND=" |
117 |
+ dev-libs/libltdl |
118 |
+ sys-devel/llvm:${LLVM_MAX_SLOT} |
119 |
+ virtual/opencl |
120 |
+ |
121 |
+ !cuda? ( sys-devel/clang:${LLVM_MAX_SLOT} ) |
122 |
+ cuda? ( sys-devel/clang:${LLVM_MAX_SLOT}[llvm_targets_NVPTX] ) |
123 |
+ debug? ( dev-util/lttng-ust ) |
124 |
+ hwloc? ( sys-apps/hwloc[cuda?] ) |
125 |
+" |
126 |
+DEPEND="${RDEPEND}" |
127 |
+BDEPEND="virtual/pkgconfig |
128 |
+ doc? ( |
129 |
+ $(python_gen_any_dep '<dev-python/markupsafe-2.0[${PYTHON_USEDEP}]') |
130 |
+ )" |
131 |
+ |
132 |
+PATCHES=( "${FILESDIR}/vendor_opencl_libs_location.patch" ) |
133 |
+ |
134 |
+python_check_deps() { |
135 |
+ has_version -b "<dev-python/markupsafe-2.0[${PYTHON_USEDEP}]" |
136 |
+} |
137 |
+ |
138 |
+pkg_setup() { |
139 |
+ use doc && python-any-r1_pkg_setup |
140 |
+} |
141 |
+ |
142 |
+src_configure() { |
143 |
+ llvm_pkg_setup |
144 |
+ local mycmakeargs=( |
145 |
+ -DBUILD_SHARED_LIBS=ON |
146 |
+ -DENABLE_HSA=OFF |
147 |
+ -DENABLE_ICD=ON |
148 |
+ -DENABLE_POCL_BUILDING=ON |
149 |
+ -DKERNELLIB_HOST_CPU_VARIANTS=native |
150 |
+ -DPOCL_ICD_ABSOLUTE_PATH=ON |
151 |
+ -DSTATIC_LLVM=OFF |
152 |
+ |
153 |
+ -DENABLE_ACCEL_DEVICE=$(usex accel) |
154 |
+ -DENABLE_CONFORMANCE=$(usex conformance) |
155 |
+ -DENABLE_CUDA=$(usex cuda) |
156 |
+ -DENABLE_HOST_CPU_DEVICE_CL20=$(usex cl20) |
157 |
+ -DENABLE_HWLOC=$(usex hwloc) |
158 |
+ -DENABLE_POCL_FLOAT_CONVERSION=$(usex float-conversion) |
159 |
+ -DHARDENING_ENABLE=$(usex hardening) |
160 |
+ -DPOCL_DEBUG_MESSAGES=$(usex debug) |
161 |
+ -DUSE_POCL_MEMMANAGER=$(usex memmanager) |
162 |
+ -DWITH_LLVM_CONFIG=$(get_llvm_prefix "${LLVM_MAX_SLOT}")/bin/llvm-config |
163 |
+ ) |
164 |
+ cmake_src_configure |
165 |
+} |
166 |
+ |
167 |
+src_compile() { |
168 |
+ cmake_src_compile |
169 |
+ docs_compile |
170 |
+} |
171 |
+ |
172 |
+src_test() { |
173 |
+ export POCL_BUILDING=1 |
174 |
+ export CTEST_OUTPUT_ON_FAILURE=1 |
175 |
+ cmake_src_test |
176 |
+} |
177 |
+ |
178 |
+src_install() { |
179 |
+ cmake_src_install |
180 |
+ dodoc CREDITS README CHANGES |
181 |
+ if use doc; then |
182 |
+ dodoc -r _build/html |
183 |
+ docompress -x "/usr/share/doc/${P}/html" |
184 |
+ fi |
185 |
+ if use examples; then |
186 |
+ dodoc -r examples |
187 |
+ docompress -x "/usr/share/doc/${P}/examples" |
188 |
+ fi |
189 |
+} |