summaryrefslogtreecommitdiff
path: root/libs/rocm-opencl/MAKEPKG
diff options
context:
space:
mode:
Diffstat (limited to 'libs/rocm-opencl/MAKEPKG')
-rw-r--r--libs/rocm-opencl/MAKEPKG72
1 files changed, 72 insertions, 0 deletions
diff --git a/libs/rocm-opencl/MAKEPKG b/libs/rocm-opencl/MAKEPKG
new file mode 100644
index 0000000..8cd541c
--- /dev/null
+++ b/libs/rocm-opencl/MAKEPKG
@@ -0,0 +1,72 @@
+#!/bin/mkpkg
+# description: ROCm OpenCL runtime (CLR/opencl)
+# url: https://github.com/ROCm/rocm-systems/tree/develop/projects/clr
+
+name=rocm-opencl
+_name=therock
+version=10.0
+release=2
+depends=(rocm-rocr-runtime rocm-llvm ocl-icd)
+makedeps=(cmake ninja python3)
+source=(
+ https://github.com/ROCm/rocm-systems/releases/download/$_name-$version/clr.tar.gz
+ fix-os-posix-basename.awk
+)
+sha256sums=(
+ "07caed9d726232008a2120da24f4e4bbc4998accbeadd309181fce04a9da9f99"
+ "0af885dac36e4f2314f226eb7b618dbf468919c3d2d13915c9cc2635c09753d5"
+)
+
+patch() {
+ # musl: POSIX basename fix
+ awk -f "$SRC/fix-os-posix-basename.awk" \
+ clr/rocclr/os/os_posix.cpp > os_posix.cpp.tmp
+ mv os_posix.cpp.tmp clr/rocclr/os/os_posix.cpp
+
+ # musl: remove initial-exec TLS model — breaks dlopen on musl
+ sed -i 's/__attribute__((tls_model("initial-exec")))//g' \
+ clr/rocclr/thread/thread.cpp \
+ clr/rocclr/thread/thread.hpp \
+ clr/rocclr/platform/activity.cpp \
+ clr/rocclr/platform/activity.hpp
+}
+
+build() {
+ export ROCM_LIBPATCH_VERSION=0
+
+ cmake -S clr -B build -G Ninja -Wno-dev \
+ -DCMAKE_BUILD_TYPE=Release \
+ -DCMAKE_INSTALL_PREFIX=/usr \
+ -DCMAKE_INSTALL_LIBDIR=lib \
+ -DCMAKE_INSTALL_SYSCONFDIR=/etc \
+ -DCMAKE_C_COMPILER=/usr/lib/rocm/llvm/bin/clang \
+ -DCMAKE_CXX_COMPILER=/usr/lib/rocm/llvm/bin/clang++ \
+ -DCMAKE_PREFIX_PATH="/usr;/usr/lib/rocm/llvm" \
+ -DCLR_BUILD_HIP=OFF \
+ -DCLR_BUILD_OCL=ON \
+ -DROCM_PATH=/usr \
+ -DBUILD_TESTS=OFF
+
+ ninja -C build
+ DESTDIR=$PKG ninja -C build install
+
+ # musl ignores ld.so.conf; the ICD below uses an absolute path
+ rm -rf $PKG/etc/ld.so.conf.d
+
+ # CLR bundles old Khronos 2.2 headers (group-writable); use opencl-headers
+ rm -rf $PKG/usr/include/CL
+ rmdir $PKG/usr/include
+
+ # register the ICD (ocl-icd dlopens this absolute path)
+ install -dm755 $PKG/etc/OpenCL/vendors
+ printf '%s\n' /usr/lib/opencl/libamdocl64.so \
+ > $PKG/etc/OpenCL/vendors/amdocl64.icd
+}
+
+signify() {
+ untrusted comment: public key
+ RWTZ9IduCSQ/mL8337TEUinPwT92xFEUpD92hkS7IxcOnzTt9QdpohT3
+}
+
+# vim: filetype=sh
+