From: ahesford <ahesford@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: Re: [PR PATCH] [Updated] New packages: ROCm core and OpenCL
Date: Thu, 30 Apr 2020 21:12:04 +0200 [thread overview]
Message-ID: <20200430191204.3Qh9-f5Rto47dEux4rc4GemqdlkfPKmN_nU1-R9PQQk@z> (raw)
In-Reply-To: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-21153@inbox.vuxu.org>
[-- Attachment #1: Type: text/plain, Size: 3893 bytes --]
There is an updated pull request by ahesford against master on the void-packages repository
https://github.com/ahesford/void-packages rocm
https://github.com/void-linux/void-packages/pull/21153
New packages: ROCm core and OpenCL
This PR includes several packages designed to bring the OpenCL portion of the AMD ROCm ecosystem to Void. It addresses Issue #19507. There are many other packages that AMD provides for GPGPU computing, but these can be added piecemeal as users demand.
The packages are currently only for `x86_64*`. While at least some of the packages will compile on other 64-bit architectures, I have no hardware to test. They are certainly not suitable for 32-bit architectures; some internal data structures rely on `uint64_t` values that are cast to pointers. At a
minimum, a thorough audit would be necessary to ensure that these casts are safe (e.g., that the values stored were only ever upcast from 32-bit pointers). More extensive work may be necessary to support 32-bit architectures, probably without significant benefit.
The packages successfully identify a Radeon RX 580 on an `x86_64` installation using both `clinfo` and `rocminfo` as provided. Furthermore, a version of `pyopencl` linked against these ROCm packages successfully runs a simple program that validates arithmetic on GPU-bound arrays.
There are caveats with this set of packages, almost all of which revolve around the incompatibilities between the Void-provided `ocl-icd` and the [Khronos OpenCL ICD loader](https://github.com/KhronosGroup/OpenCL-ID-Loader) required by (and built into) `rocm-opencl-runtime`.
1. All packages install into `/opt/rocm`. This keeps the environment closer to that officially sanctioned by AMD and helps avoid conflicts between other packages and those provided here. (For example, `clinfo` and the ICD loader itself.) Eventually, we may be able to move the files into `/usr`.
2. The Khronos OpenCL ICD loader built into `rocm-opencl-runtime` is an outdated, pre-release commit. If AMD can update its sources to use the release version of that loader (which has a backward-incompatible API change), we may be able to make ROCm compatible with `ocl-icd` or replace `ocl-icd` with the official Khronos loader.
3. In the meantime, to avoid `shlibs` conflicts, the OpenCL ICD loader is installed as `/opt/rocm/lib/libOpenCL-ROCm.so` (and an appropriately versioned shared library), which means that programs wishing to use the ROCm OpenCL must explicitly link against this library instead of the generic `libOpenCL.so`.
4. I do **not** recommend making any Void packages link against this specific library, because it will make those packages ROCm-only. For the time being, ROCm is intended for end-users to specifically link against. Linking Void packages against ROCm would requires the ICD loader used by ROCm be compatible with `ocl-icd`, or `ocl-icd` be replaced by the Khronos loader. However, because the Khronos loader changed its API for the release version, such a change is not yet appropriate.
Hopefully, if AMD updates its dependence on the Khronos ICD loader, we can resolve some of these caveats in the future and make ROCm a more natural Void component. For now, these packages are useful for those who need an AMD OpenCL solution and would rather custom-link software against the AMD ICD loader than hack the `amdgpu-pro` driver into an ICD compatible with `ocl-icd`.
Some patches were made to relocate some files in `/opt/rocm` and make everyting build on x86_64-musl`. Where appropriate, these patches will be pushed upstream to clean up the distribution and packaging.
Update: I pushed some new commits to update license information that triggerd an `xlint` failure. I've also disabled CI builds because they will time out on `rocm-llvm`.
A patch file from https://github.com/void-linux/void-packages/pull/21153.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-rocm-21153.patch --]
[-- Type: text/x-diff, Size: 35776 bytes --]
From 1226ae1e7c5eea64be3859bb36eee4fd8c6cccc6 Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Mon, 13 Apr 2020 13:08:09 -0400
Subject: [PATCH 01/10] New package: roct-thunk-interface-3.3.0
---
common/shlibs | 1 +
srcpkgs/roct-thunk-interface-devel | 1 +
.../patches/cmake-dev-libdir.patch | 10 ++++++
.../roct-thunk-interface/patches/musl.patch | 29 ++++++++++++++++
srcpkgs/roct-thunk-interface/template | 33 +++++++++++++++++++
5 files changed, 74 insertions(+)
create mode 120000 srcpkgs/roct-thunk-interface-devel
create mode 100644 srcpkgs/roct-thunk-interface/patches/cmake-dev-libdir.patch
create mode 100644 srcpkgs/roct-thunk-interface/patches/musl.patch
create mode 100644 srcpkgs/roct-thunk-interface/template
diff --git a/common/shlibs b/common/shlibs
index 6d39ce34c19..d89ae72ae3e 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -3862,3 +3862,4 @@ libtagparser.so.9 tagparser-9.1.2_1
libqtutilities.so.6 qtutilities-6.0.4_1
libkdsoap.so.1.9.0 KDSoap-1.9.0_1
libstoken.so.1 stoken-0.92_1
+libhsakmt.so.1 roct-thunk-interface-3.3.0_1
diff --git a/srcpkgs/roct-thunk-interface-devel b/srcpkgs/roct-thunk-interface-devel
new file mode 120000
index 00000000000..ac3f2cc684c
--- /dev/null
+++ b/srcpkgs/roct-thunk-interface-devel
@@ -0,0 +1 @@
+roct-thunk-interface
\ No newline at end of file
diff --git a/srcpkgs/roct-thunk-interface/patches/cmake-dev-libdir.patch b/srcpkgs/roct-thunk-interface/patches/cmake-dev-libdir.patch
new file mode 100644
index 00000000000..98c7f1e459c
--- /dev/null
+++ b/srcpkgs/roct-thunk-interface/patches/cmake-dev-libdir.patch
@@ -0,0 +1,10 @@
+--- CMakeLists.txt.old 2020-04-18 19:45:17.306081135 -0400
++++ CMakeLists.txt 2020-04-18 19:46:51.300753636 -0400
+@@ -146,6 +146,7 @@
+ COMMAND ${CMAKE_COMMAND}
+ -DSOURCE_DIR="${SOURCE_DIR}"
+ -DCMAKE_INSTALL_PREFIX="${CMAKE_INSTALL_PREFIX}"
++ -DCMAKE_INSTALL_LIBDIR="${CMAKE_INSTALL_LIBDIR}"
+ -DCPACK_RPM_PACKAGE_REQUIRES="hsakmt-roct"
+ -DCPACK_PACKAGING_INSTALL_PREFIX="${CPACK_PACKAGING_INSTALL_PREFIX}"
+ -DVERSION="${BUILD_VERSION_STRING}"
diff --git a/srcpkgs/roct-thunk-interface/patches/musl.patch b/srcpkgs/roct-thunk-interface/patches/musl.patch
new file mode 100644
index 00000000000..aeea9832411
--- /dev/null
+++ b/srcpkgs/roct-thunk-interface/patches/musl.patch
@@ -0,0 +1,29 @@
+diff -r -u old/src/libhsakmt.h new/src/libhsakmt.h
+--- src/libhsakmt.h 2020-03-04 15:00:47.000000000 -0500
++++ src/libhsakmt.h 2020-04-13 12:58:30.444865992 -0400
+@@ -54,6 +54,10 @@
+ #define CHECK_KFD_OPEN() \
+ do { if (kfd_open_count == 0 || hsakmt_forked) return HSAKMT_STATUS_KERNEL_IO_CHANNEL_NOT_OPENED; } while (0)
+
++/*On some platforms, a PAGE_SIZE macro eclipses the extern variable*/
++#ifdef PAGE_SIZE
++#undef PAGE_SIZE
++#endif
+ extern int PAGE_SIZE;
+ extern int PAGE_SHIFT;
+
+diff -r -u old/src/topology.c new/src/topology.c
+--- src/topology.c 2020-03-04 15:00:47.000000000 -0500
++++ src/topology.c 2020-04-13 13:01:31.209870701 -0400
+@@ -38,6 +38,11 @@
+ #include "libhsakmt.h"
+ #include "fmm.h"
+
++/*Needed on MUSL*/
++#ifndef MAXNAMLEN
++#define MAXNAMLEN PATH_MAX
++#endif
++
+ /* Number of memory banks added by thunk on top of topology
+ * This only includes static heaps like LDS, scratch and SVM,
+ * not for MMIO_REMAP heap. MMIO_REMAP memory bank is reported
diff --git a/srcpkgs/roct-thunk-interface/template b/srcpkgs/roct-thunk-interface/template
new file mode 100644
index 00000000000..55a1fc6074a
--- /dev/null
+++ b/srcpkgs/roct-thunk-interface/template
@@ -0,0 +1,33 @@
+# Template file for 'roct-thunk-interface'
+pkgname=roct-thunk-interface
+version=3.3.0
+revision=1
+archs="x86_64*"
+wrksrc="ROCT-Thunk-Interface-roc-${version}"
+build_style=cmake
+make_build_target="all build-dev"
+make_install_target="install install-dev"
+hostmakedepends="cmake pkg-config"
+makedepends="pciutils-devel libnuma-devel"
+short_desc="Radeon Open Compute Thunk Interface"
+maintainer="Andrew J. Hesford <ajh@sideband.org>"
+license="MIT"
+homepage="https://github.com/RadeonOpenCompute/ROCT-Thunk-Interface"
+distfiles="${homepage}/archive/roc-${version}.tar.gz"
+checksum=2cabe9d2cfa72031c05d11290837c476182e72d8dec2049298f691143fdd212b
+nocross=yes
+
+post_install() {
+ vlicense LICENSE.md
+}
+
+roct-thunk-interface-devel_package() {
+ depends="${sourcepkg}>=${version}_${revision}"
+ short_desc+=" - development files"
+ pkg_install() {
+ vmove usr/include
+ vmove "usr/lib/*.so"
+ vmove usr/share/pkgconfig
+ vmove usr/lib/cmake
+ }
+}
From d8bb69aca8ebcd167198d858c11e7b7fa326c389 Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Mon, 13 Apr 2020 15:27:27 -0400
Subject: [PATCH 02/10] New package: rocr-runtime-3.3.0
---
common/shlibs | 1 +
srcpkgs/rocr-runtime-devel | 1 +
srcpkgs/rocr-runtime/patches/cmake.patch | 27 +++++++++++++++++++++
srcpkgs/rocr-runtime/template | 30 ++++++++++++++++++++++++
4 files changed, 59 insertions(+)
create mode 120000 srcpkgs/rocr-runtime-devel
create mode 100644 srcpkgs/rocr-runtime/patches/cmake.patch
create mode 100644 srcpkgs/rocr-runtime/template
diff --git a/common/shlibs b/common/shlibs
index d89ae72ae3e..499f35752c2 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -3863,3 +3863,4 @@ libqtutilities.so.6 qtutilities-6.0.4_1
libkdsoap.so.1.9.0 KDSoap-1.9.0_1
libstoken.so.1 stoken-0.92_1
libhsakmt.so.1 roct-thunk-interface-3.3.0_1
+libhsa-runtime64.so.1 rocr-runtime-3.3.0_1
diff --git a/srcpkgs/rocr-runtime-devel b/srcpkgs/rocr-runtime-devel
new file mode 120000
index 00000000000..be838f22d81
--- /dev/null
+++ b/srcpkgs/rocr-runtime-devel
@@ -0,0 +1 @@
+rocr-runtime
\ No newline at end of file
diff --git a/srcpkgs/rocr-runtime/patches/cmake.patch b/srcpkgs/rocr-runtime/patches/cmake.patch
new file mode 100644
index 00000000000..93b74cd2297
--- /dev/null
+++ b/srcpkgs/rocr-runtime/patches/cmake.patch
@@ -0,0 +1,27 @@
+--- src/CMakeLists.txt.old 2020-04-18 20:01:48.549636995 -0400
++++ src/CMakeLists.txt 2020-04-18 20:04:00.177179781 -0400
+@@ -108,8 +108,8 @@
+ ## ROCr build internal versioning
+ add_definitions ( -DROCR_BUILD_ID=${PACKAGE_VERSION_STRING} )
+
+-## Set RUNPATH - ../../lib covers use of the legacy symlink in /hsa/lib/
+-set(CMAKE_INSTALL_RPATH "$ORIGIN;$ORIGIN/../../lib;$ORIGIN/../../lib64;$ORIGIN/../lib64")
++## Set RUNPATH
++set(CMAKE_INSTALL_RPATH "$ORIGIN;$ORIGIN/../lib")
+
+ ## ------------------------- Linux Compiler and Linker options -------------------------
+ set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -fexceptions -fno-rtti -fvisibility=hidden -Wno-error=sign-compare -Wno-sign-compare -Wno-write-strings -Wno-conversion-null -fno-math-errno -fno-threadsafe-statics -fmerge-all-constants -fms-extensions -Wno-error=comment -Wno-comment -Wno-error=pointer-arith -Wno-pointer-arith -Wno-error=unused-variable -Wno-error=unused-function" )
+@@ -185,11 +185,8 @@
+ add_custom_target ( hsa_lib_link2 ALL WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${CMAKE_COMMAND} -E create_symlink ../hsa/lib/${CORE_RUNTIME_LIBRARY}.so.${SO_MAJOR} ${CORE_RUNTIME_LIBRARY}-link.so.${SO_MAJOR} )
+
+ ## Set install information
+-install ( TARGETS ${CORE_RUNTIME_TARGET} LIBRARY DESTINATION hsa/lib )
+-install ( DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/inc/ DESTINATION hsa/include/hsa )
+-install ( FILES ${CMAKE_CURRENT_BINARY_DIR}/hsa_include_link DESTINATION include PERMISSIONS OWNER_WRITE OWNER_READ RENAME hsa )
+-install ( FILES ${CMAKE_CURRENT_BINARY_DIR}/${CORE_RUNTIME_LIBRARY}-link.so DESTINATION lib PERMISSIONS OWNER_WRITE OWNER_READ RENAME ${CORE_RUNTIME_LIBRARY}.so )
+-install ( FILES ${CMAKE_CURRENT_BINARY_DIR}/${CORE_RUNTIME_LIBRARY}-link.so.${SO_MAJOR} DESTINATION lib PERMISSIONS OWNER_WRITE OWNER_READ RENAME ${CORE_RUNTIME_LIBRARY}.so.${SO_MAJOR} )
++install ( TARGETS ${CORE_RUNTIME_TARGET} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} )
++install ( DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/inc/ DESTINATION include/hsa )
+
+ ## Packaging directives
+ set ( CPACK_GENERATOR "DEB;RPM" CACHE STRING "Package types to build")
diff --git a/srcpkgs/rocr-runtime/template b/srcpkgs/rocr-runtime/template
new file mode 100644
index 00000000000..5ee22140f1f
--- /dev/null
+++ b/srcpkgs/rocr-runtime/template
@@ -0,0 +1,30 @@
+# Template file for 'rocr-runtime'
+pkgname=rocr-runtime
+version=3.3.0
+revision=1
+archs="x86_64*"
+wrksrc="ROCR-Runtime-rocm-${version}"
+build_wrksrc="src"
+build_style=cmake
+hostmakedepends="cmake pkg-config"
+makedepends="roct-thunk-interface-devel elfutils-devel"
+short_desc="Radeon Open Compute HSA Runtime"
+maintainer="Andrew J. Hesford <ajh@sideband.org>"
+license="NCSA"
+homepage="https://github.com/RadeonOpenCompute/ROCR-Runtime"
+distfiles="${homepage}/archive/rocm-${version}.tar.gz"
+checksum=fa2d2d1f8a61d8a6952d377cf288d78c61776c3c2a666f163cafc3aa19ab0b61
+nocross=yes
+
+post_install() {
+ vlicense ../LICENSE.txt
+}
+
+rocr-runtime-devel_package() {
+ depends="${sourcepkg}>=${version}_${revision}"
+ short_desc+=" - development files"
+ pkg_install() {
+ vmove usr/include
+ vmove "usr/lib/*.so"
+ }
+}
From 5991aaa587df9bdce5c93daf534974432a336acf Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Mon, 13 Apr 2020 18:07:34 -0400
Subject: [PATCH 03/10] New package: rocm-llvm-3.3.0
---
srcpkgs/rocm-llvm/template | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
create mode 100644 srcpkgs/rocm-llvm/template
diff --git a/srcpkgs/rocm-llvm/template b/srcpkgs/rocm-llvm/template
new file mode 100644
index 00000000000..d6e75cd050c
--- /dev/null
+++ b/srcpkgs/rocm-llvm/template
@@ -0,0 +1,26 @@
+# Template file for 'rocm-llvm'
+pkgname=rocm-llvm
+version=3.3.0
+revision=1
+archs="x86_64*"
+wrksrc="llvm-project-rocm-ocl-${version}"
+build_wrksrc=llvm
+build_style=cmake
+configure_args="-DCMAKE_INSTALL_PREFIX:PATH=/usr/lib/rocm-llvm
+ -DLLVM_ENABLE_PROJECTS='llvm;clang;lld' -DLLVM_TARGETS_TO_BUILD='AMDGPU'
+ -DLLVM_BUILD_DOCS=NO -DLLVM_ENABLE_OCAMLDOC=OFF
+ -DLLVM_ENABLE_SPHINX=NO -DLLVM_ENABLE_DOXYGEN=OFF
+ -DLLVM_INSTALL_UTILS=ON -DLLVM_VERSION_SUFFIX=roc -DOCAMLFIND=NO"
+hostmakedepends="cmake pkg-config python3"
+short_desc="Radeon Open Compute LLVM toolchain"
+maintainer="Andrew J. Hesford <ajh@sideband.org>"
+license="Apache-2.0, NCSA, custom:LLVM-Exceptions"
+homepage="https://github.com/RadeonOpenCompute/llvm-project"
+distfiles="${homepage}/archive/rocm-ocl-${version}.tar.gz"
+checksum=a2bef7042e8e2f2cd8548cb246b88322e1c77188839983dcac8312d56f544dc8
+python_version=3
+nocross=yes
+
+post_install() {
+ vlicense LICENSE.TXT
+}
From 19c7a333ec5877c0e1e57ab9d1438bc0b31520a3 Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Tue, 14 Apr 2020 10:25:31 -0400
Subject: [PATCH 04/10] New package: rocm-device-libs-3.3.0
---
srcpkgs/rocm-device-libs/template | 37 +++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
create mode 100644 srcpkgs/rocm-device-libs/template
diff --git a/srcpkgs/rocm-device-libs/template b/srcpkgs/rocm-device-libs/template
new file mode 100644
index 00000000000..fcb4eb0d53e
--- /dev/null
+++ b/srcpkgs/rocm-device-libs/template
@@ -0,0 +1,37 @@
+# Template file for 'rocm-device-libs'
+pkgname=rocm-device-libs
+version=3.3.0
+revision=1
+archs="x86_64*"
+wrksrc="ROCm-Device-Libs-rocm-ocl-${version}"
+build_style=cmake
+configure_args="-DLLVM_DIR:PATH=/usr/lib/rocm-llvm
+ -DCMAKE_INSTALL_LIBDIR:PATH=lib/rocm-device-libs"
+hostmakedepends="cmake rocm-llvm"
+short_desc="Radeon Open Compute device libraries"
+maintainer="Andrew J. Hesford <ajh@sideband.org>"
+license="NCSA"
+homepage="https://github.com/RadeonOpenCompute/ROCm-Device-Libs"
+distfiles="${homepage}/archive/rocm-ocl-${version}.tar.gz"
+checksum=706b08230790e08ca6a7a2fb7687d6131fd39a562148340e00fa37a6c06769c5
+nocross=yes
+
+pre_configure() {
+ # Put bytecodes in a lib/ subdirectory
+ vsed -i Packages.cmake -e 's@/lib/@/${CMAKE_INSTALL_LIBDIR}/@'
+ vsed -i OCL.cmake -e 's@DESTINATION lib$@DESTINATION ${CMAKE_INSTALL_LIBDIR}@'
+
+ # Build the prepare-builtins executable with native compiler
+ mkdir -p utils/build
+ cd utils/build
+ _prepare_builtins="$PWD/prepare-builtins/prepare-builtins"
+ cmake ${configure_args} ..
+ make ${makejobs}
+
+ # Add path to prepare-builtins for cmake
+ configure_args+=" -DPREPARE_BUILTINS='${_prepare_builtins}'"
+}
+
+post_install() {
+ vlicense LICENSE
+}
From 691d78f81e8346791c5556569cfa00b5b5d133ac Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Mon, 13 Apr 2020 18:30:00 -0400
Subject: [PATCH 05/10] New package: rocm-comgr-3.3.0
---
common/shlibs | 1 +
srcpkgs/rocm-comgr-devel | 1 +
srcpkgs/rocm-comgr/template | 32 ++++++++++++++++++++++++++++++++
3 files changed, 34 insertions(+)
create mode 120000 srcpkgs/rocm-comgr-devel
create mode 100644 srcpkgs/rocm-comgr/template
diff --git a/common/shlibs b/common/shlibs
index 499f35752c2..a53de3cf9e0 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -3864,3 +3864,4 @@ libkdsoap.so.1.9.0 KDSoap-1.9.0_1
libstoken.so.1 stoken-0.92_1
libhsakmt.so.1 roct-thunk-interface-3.3.0_1
libhsa-runtime64.so.1 rocr-runtime-3.3.0_1
+libamd_comgr.so.1 rocm-comgr-3.3.0_1
diff --git a/srcpkgs/rocm-comgr-devel b/srcpkgs/rocm-comgr-devel
new file mode 120000
index 00000000000..3f5ce255e07
--- /dev/null
+++ b/srcpkgs/rocm-comgr-devel
@@ -0,0 +1 @@
+rocm-comgr
\ No newline at end of file
diff --git a/srcpkgs/rocm-comgr/template b/srcpkgs/rocm-comgr/template
new file mode 100644
index 00000000000..c228bcd4d1f
--- /dev/null
+++ b/srcpkgs/rocm-comgr/template
@@ -0,0 +1,32 @@
+# Template file for 'rocm-comgr'
+pkgname=rocm-comgr
+version=3.3.0
+revision=1
+archs="x86_64*"
+wrksrc="ROCm-CompilerSupport-rocm-${version}"
+build_wrksrc="lib/comgr"
+build_style=cmake
+configure_args="-DClang_DIR:PATH=/usr/lib/rocm-llvm/lib/cmake/clang"
+hostmakedepends="cmake pkg-config rocm-llvm"
+makedepends="rocm-device-libs"
+short_desc="Radeon Open Compute Code Object Manager"
+maintainer="Andrew J. Hesford <ajh@sideband.org>"
+license="BSD-3-Clause"
+homepage="https://github.com/RadeonOpenCompute/ROCm-CompilerSupport"
+distfiles="${homepage}/archive/rocm-${version}.tar.gz"
+checksum=01e2524e0f28ecd6f46c9720f279207de935d826b0172158792aa3ec86af9ca7
+nocross=yes
+
+post_install() {
+ vlicense LICENSE.txt
+}
+
+rocm-comgr-devel_package() {
+ depends="${sourcepkg}>=${version}_${revision}"
+ short_desc+=" - development files"
+ pkg_install() {
+ vmove usr/include
+ vmove "usr/lib/*.so"
+ vmove usr/lib/cmake
+ }
+}
From 34506fec471194f2746c0fca2b1a8f8de3c02f1c Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Fri, 17 Apr 2020 12:11:25 -0400
Subject: [PATCH 06/10] New package: rocminfo-3.3.0
---
srcpkgs/rocminfo/template | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
create mode 100644 srcpkgs/rocminfo/template
diff --git a/srcpkgs/rocminfo/template b/srcpkgs/rocminfo/template
new file mode 100644
index 00000000000..57d0640dd69
--- /dev/null
+++ b/srcpkgs/rocminfo/template
@@ -0,0 +1,22 @@
+# Template file for 'rocminfo'
+pkgname=rocminfo
+version=3.3.0
+revision=1
+archs="x86_64*"
+wrksrc="rocminfo-rocm-${version}"
+build_style=cmake
+configure_args="-DROCM_DIR=/usr"
+hostmakedepends="cmake pkg-config"
+makedepends="rocr-runtime-devel"
+short_desc="Radeon Open Compute system information reporter"
+maintainer="Andrew J. Hesford <ajh@sideband.org>"
+license="NCSA"
+homepage="https://github.com/RadeonOpenCompute/rocminfo"
+distfiles="${homepage}/archive/rocm-${version}.tar.gz"
+checksum=e666f662c9e465aaabbbd0b109d87e017243cdf1a0898fabf5a90947bb3dbcd7
+nocross=yes
+python_version=3
+
+post_install() {
+ vlicense License.txt
+}
From 673ee21a6905ad3ca6877af58e936900c8d13bf1 Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Sun, 19 Apr 2020 15:01:40 -0400
Subject: [PATCH 07/10] New package: rocm-bandwidth-test-3.3.0
---
srcpkgs/rocm-bandwidth-test/template | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
create mode 100644 srcpkgs/rocm-bandwidth-test/template
diff --git a/srcpkgs/rocm-bandwidth-test/template b/srcpkgs/rocm-bandwidth-test/template
new file mode 100644
index 00000000000..5c5058b693d
--- /dev/null
+++ b/srcpkgs/rocm-bandwidth-test/template
@@ -0,0 +1,20 @@
+# Template file for 'rocm-bandwidth-test'
+pkgname=rocm-bandwidth-test
+version=3.3.0
+revision=1
+archs="x86_64*"
+wrksrc="rocm_bandwidth_test-rocm-${version}"
+build_style=cmake
+hostmakedepends="cmake"
+makedepends="rocr-runtime-devel roct-thunk-interface-devel"
+short_desc="Radeon Open Compute bandwidth test"
+maintainer="Andrew J. Hesford <ajh@sideband.org>"
+license="NCSA"
+homepage="https://github.com/RadeonOpenCompute/rocm_bandwidth_test"
+distfiles="${homepage}/archive/rocm-${version}.tar.gz"
+checksum=f5f914073018619dc91662d5bf630903dfa4db9136d603591917fdfb3c9164ce
+nocross=yes
+
+post_install() {
+ vlicense LICENSE.txt
+}
From 8880063d1e46a22e487bc193b63a08a7e7fc3d6d Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Tue, 14 Apr 2020 10:25:54 -0400
Subject: [PATCH 08/10] New package: rocm-opencl-runtime-3.3.0
---
common/shlibs | 2 +
srcpkgs/rocm-opencl-runtime-clinfo | 1 +
srcpkgs/rocm-opencl-runtime-devel | 1 +
.../files/libelf-musl.patch | 21 +++
.../files/runtime-musl.patch | 11 ++
.../rocm-opencl-runtime/patches/cmake.patch | 126 ++++++++++++++++++
srcpkgs/rocm-opencl-runtime/template | 83 ++++++++++++
7 files changed, 245 insertions(+)
create mode 120000 srcpkgs/rocm-opencl-runtime-clinfo
create mode 120000 srcpkgs/rocm-opencl-runtime-devel
create mode 100644 srcpkgs/rocm-opencl-runtime/files/libelf-musl.patch
create mode 100644 srcpkgs/rocm-opencl-runtime/files/runtime-musl.patch
create mode 100644 srcpkgs/rocm-opencl-runtime/patches/cmake.patch
create mode 100644 srcpkgs/rocm-opencl-runtime/template
diff --git a/common/shlibs b/common/shlibs
index a53de3cf9e0..8cbc885e016 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -3865,3 +3865,5 @@ libstoken.so.1 stoken-0.92_1
libhsakmt.so.1 roct-thunk-interface-3.3.0_1
libhsa-runtime64.so.1 rocr-runtime-3.3.0_1
libamd_comgr.so.1 rocm-comgr-3.3.0_1
+libOpenCL-ROCm.so.1 rocm-opencl-runtime-3.3.0_1
+libamdocl64.so rocm-opencl-runtime-3.3.0_1
diff --git a/srcpkgs/rocm-opencl-runtime-clinfo b/srcpkgs/rocm-opencl-runtime-clinfo
new file mode 120000
index 00000000000..b2cda7e229d
--- /dev/null
+++ b/srcpkgs/rocm-opencl-runtime-clinfo
@@ -0,0 +1 @@
+rocm-opencl-runtime
\ No newline at end of file
diff --git a/srcpkgs/rocm-opencl-runtime-devel b/srcpkgs/rocm-opencl-runtime-devel
new file mode 120000
index 00000000000..b2cda7e229d
--- /dev/null
+++ b/srcpkgs/rocm-opencl-runtime-devel
@@ -0,0 +1 @@
+rocm-opencl-runtime
\ No newline at end of file
diff --git a/srcpkgs/rocm-opencl-runtime/files/libelf-musl.patch b/srcpkgs/rocm-opencl-runtime/files/libelf-musl.patch
new file mode 100644
index 00000000000..29469a9a351
--- /dev/null
+++ b/srcpkgs/rocm-opencl-runtime/files/libelf-musl.patch
@@ -0,0 +1,21 @@
+--- compiler/lib/loaders/elf/utils/libelf/_libelf.h 2020-04-28 15:50:53.243438174 -0400
++++ compiler/lib/loaders/elf/utils/libelf/_libelf.h 2020-04-28 15:51:54.293435415 -0400
+@@ -35,6 +35,7 @@
+ #include "_libelf_config.h"
+
+ #include "_elftc.h"
++#include <sys/cdefs.h>
+
+ /*
+ * Library-private data structures.
+--- compiler/lib/loaders/elf/utils/libelf/libelf.h 2020-04-28 15:50:53.244438174 -0400
++++ compiler/lib/loaders/elf/utils/libelf/libelf.h 2020-04-28 15:52:12.375434593 -0400
+@@ -36,6 +36,8 @@
+ #define EM_HSAIL 0xAF5A
+ #endif
+
++#include <sys/cdefs.h>
++
+ /* Library private data structures */
+ typedef struct _Elf Elf;
+ typedef struct _Elf_Scn Elf_Scn;
diff --git a/srcpkgs/rocm-opencl-runtime/files/runtime-musl.patch b/srcpkgs/rocm-opencl-runtime/files/runtime-musl.patch
new file mode 100644
index 00000000000..ea18e90e09c
--- /dev/null
+++ b/srcpkgs/rocm-opencl-runtime/files/runtime-musl.patch
@@ -0,0 +1,11 @@
+--- runtime/os/os_posix.cpp.orig 2020-04-19 09:13:51.701982901 -0400
++++ runtime/os/os_posix.cpp 2020-04-19 09:14:04.156947422 -0400
+@@ -44,6 +44,8 @@
+ #include <algorithm>
+ #include <mutex>
+
++#include <libgen.h> // for basename
++
+
+ namespace amd {
+
diff --git a/srcpkgs/rocm-opencl-runtime/patches/cmake.patch b/srcpkgs/rocm-opencl-runtime/patches/cmake.patch
new file mode 100644
index 00000000000..2c96b99d45a
--- /dev/null
+++ b/srcpkgs/rocm-opencl-runtime/patches/cmake.patch
@@ -0,0 +1,126 @@
+--- OpenCL-ICD-Loader-6c03f8b58fafd9dd693eaac826749a5cfad515f8/CMakeLists.txt 2019-09-10 11:53:28.000000000 -0400
++++ OpenCL-ICD-Loader-6c03f8b58fafd9dd693eaac826749a5cfad515f8/CMakeLists.txt 2020-04-16 20:16:13.481180757 -0400
+@@ -73,11 +73,11 @@
+
+ set (OPENCL_ICD_LOADER_HEADERS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/inc CACHE PATH "Path to OpenCL Headers")
+
+-add_library (OpenCL ${OPENCL_ICD_LOADER_SOURCES})
+-set_target_properties (OpenCL PROPERTIES VERSION "1.2" SOVERSION "1")
++add_library (OpenCL-ROCm ${OPENCL_ICD_LOADER_SOURCES})
++set_target_properties (OpenCL-ROCm PROPERTIES VERSION "1.2" SOVERSION "1")
+
+ if (WIN32)
+- target_link_libraries (OpenCL cfgmgr32.lib)
++ target_link_libraries (OpenCL-ROCm cfgmgr32.lib)
+
+ option (OPENCL_ICD_LOADER_REQUIRE_WDK "Build with D3DKMT support, which requires the Windows WDK." ON)
+ if (OPENCL_ICD_LOADER_REQUIRE_WDK)
+@@ -92,10 +92,10 @@
+ get_filename_component(WDK_DIRECTORY ${LATEST_D3DKMT_HEADER} DIRECTORY)
+ get_filename_component(WDK_DIRECTORY ${WDK_DIRECTORY} DIRECTORY)
+ message(STATUS "Found the Windows WDK in: ${WDK_DIRECTORY}")
+- target_compile_definitions(OpenCL PRIVATE OPENCL_ICD_LOADER_REQUIRE_WDK)
+- target_include_directories(OpenCL PRIVATE ${WDK_DIRECTORY}/um)
+- target_include_directories(OpenCL PRIVATE ${WDK_DIRECTORY}/km)
+- target_include_directories(OpenCL PRIVATE ${WDK_DIRECTORY}/shared)
++ target_compile_definitions(OpenCL-ROCm PRIVATE OPENCL_ICD_LOADER_REQUIRE_WDK)
++ target_include_directories(OpenCL-ROCm PRIVATE ${WDK_DIRECTORY}/um)
++ target_include_directories(OpenCL-ROCm PRIVATE ${WDK_DIRECTORY}/km)
++ target_include_directories(OpenCL-ROCm PRIVATE ${WDK_DIRECTORY}/shared)
+ else()
+ message(FATAL_ERROR "The Windows WDK was not found. Consider disabling OPENCL_ICD_LOADER_REQUIRE_WDK. Aborting.")
+ endif()
+@@ -113,25 +113,25 @@
+ endif()
+ else()
+ if (APPLE)
+- target_link_libraries (OpenCL ${CMAKE_THREAD_LIBS_INIT})
++ target_link_libraries (OpenCL-ROCm ${CMAKE_THREAD_LIBS_INIT})
+ else ()
+- set_target_properties (OpenCL PROPERTIES LINK_FLAGS "-Wl,--version-script -Wl,${CMAKE_CURRENT_SOURCE_DIR}/loader/linux/icd_exports.map")
+- target_link_libraries (OpenCL ${CMAKE_THREAD_LIBS_INIT})
++ set_target_properties (OpenCL-ROCm PROPERTIES LINK_FLAGS "-Wl,--version-script -Wl,${CMAKE_CURRENT_SOURCE_DIR}/loader/linux/icd_exports.map")
++ target_link_libraries (OpenCL-ROCm ${CMAKE_THREAD_LIBS_INIT})
+ endif ()
+ endif ()
+
+ include_directories (${OPENCL_ICD_LOADER_HEADERS_DIR})
+ add_definitions (-DCL_TARGET_OPENCL_VERSION=220)
+
+-target_include_directories (OpenCL PRIVATE ${CMAKE_CURRENT_BINARY_DIR} loader)
+-target_link_libraries (OpenCL ${CMAKE_DL_LIBS})
++target_include_directories (OpenCL-ROCm PRIVATE ${CMAKE_CURRENT_BINARY_DIR} loader)
++target_link_libraries (OpenCL-ROCm ${CMAKE_DL_LIBS})
+
+ include (CTest)
+ if (BUILD_TESTING)
+ add_subdirectory (test)
+ endif()
+
+-install (TARGETS OpenCL
++install (TARGETS OpenCL-ROCm
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+--- OpenCL-ICD-Loader-6c03f8b58fafd9dd693eaac826749a5cfad515f8/test/loader_test/CMakeLists.txt 2019-09-10 11:53:28.000000000 -0400
++++ OpenCL-ICD-Loader-6c03f8b58fafd9dd693eaac826749a5cfad515f8/test/loader_test/CMakeLists.txt 2020-04-16 20:16:56.647026589 -0400
+@@ -12,4 +12,4 @@
+ test_clgl.c
+ test_image_objects.c )
+
+-target_link_libraries (icd_loader_test OpenCL IcdLog)
++target_link_libraries (icd_loader_test OpenCL-ROCm IcdLog)
+--- ROCm-OpenCL-Runtime-roc-3.3.0/CMakeLists.txt 2020-04-28 07:29:51.864446603 -0400
++++ ROCm-OpenCL-Runtime-roc-3.3.0/CMakeLists.txt 2020-04-28 07:32:45.245793180 -0400
+@@ -101,30 +101,30 @@
+ rocm_setup_version( VERSION "2.0.0" )
+
+ # MAIN package
+-install(PROGRAMS $<TARGET_FILE:clinfo>
+- DESTINATION bin/x86_64
++install(PROGRAMS $<TARGET_FILE:rocm-clinfo>
++ DESTINATION bin
+ COMPONENT MAIN)
+ install(PROGRAMS $<TARGET_FILE:amdocl64>
+- DESTINATION lib/x86_64
++ DESTINATION lib
+ COMPONENT MAIN)
+-install(PROGRAMS $<TARGET_FILE:OpenCL>
+- DESTINATION lib/x86_64
++install(PROGRAMS $<TARGET_FILE:OpenCL-ROCm>
++ DESTINATION lib
+ COMPONENT MAIN)
+-install(PROGRAMS $<TARGET_SONAME_FILE:OpenCL>
+- DESTINATION lib/x86_64
++install(PROGRAMS $<TARGET_SONAME_FILE:OpenCL-ROCm>
++ DESTINATION lib
+ COMPONENT MAIN)
+
+ # DEV package
+ install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/api/opencl/khronos/headers/opencl2.2/CL"
+- DESTINATION include
++ DESTINATION include/rocm
+ COMPONENT DEV
+ USE_SOURCE_PERMISSIONS
+ PATTERN cl_d3d10.h EXCLUDE
+ PATTERN cl_d3d11.h EXCLUDE
+ PATTERN cl_dx9_media_sharing.h EXCLUDE
+ PATTERN cl_egl.h EXCLUDE)
+-install(PROGRAMS $<TARGET_LINKER_FILE:OpenCL>
+- DESTINATION lib/x86_64
++install(PROGRAMS $<TARGET_LINKER_FILE:OpenCL-ROCm>
++ DESTINATION lib
+ COMPONENT DEV)
+
+ # Generic CPACK variables
+--- ROCm-OpenCL-Runtime-roc-3.3.0/tools/clinfo/CMakeLists.txt 2020-04-28 07:29:51.882446535 -0400
++++ ROCm-OpenCL-Runtime-roc-3.3.0/tools/clinfo/CMakeLists.txt 2020-04-28 07:30:05.627394732 -0400
+@@ -6,6 +6,6 @@
+
+ add_definitions(-DHAVE_CL2_HPP)
+
+-add_executable(clinfo clinfo.cpp)
++add_executable(rocm-clinfo clinfo.cpp)
+
+-target_link_libraries(clinfo OpenCL)
++target_link_libraries(rocm-clinfo OpenCL-ROCm)
diff --git a/srcpkgs/rocm-opencl-runtime/template b/srcpkgs/rocm-opencl-runtime/template
new file mode 100644
index 00000000000..dcad3951717
--- /dev/null
+++ b/srcpkgs/rocm-opencl-runtime/template
@@ -0,0 +1,83 @@
+# Template file for 'rocm-opencl-runtime'
+pkgname=rocm-opencl-runtime
+version=3.3.0
+revision=1
+_ocl_icd_name="OpenCL-ICD-Loader"
+_ocl_icd_ver="6c03f8b58fafd9dd693eaac826749a5cfad515f8"
+archs="x86_64*"
+create_wrksrc=yes
+build_wrksrc="ROCm-OpenCL-Runtime-roc-${version}"
+build_style=cmake
+configure_args="-DUSE_COMGR_LIBRARY=yes"
+hostmakedepends="cmake pkg-config"
+makedepends="libglvnd-devel rocm-comgr-devel
+ roct-thunk-interface-devel rocr-runtime-devel"
+depends="rocm-comgr"
+short_desc="Radeon Open Compute OpenCL runtime"
+maintainer="Andrew J. Hesford <ajh@sideband.org>"
+license="MIT"
+homepage="https://github.com/RadeonOpenCompute/ROCm-OpenCL-Runtime"
+_rocroot="https://github.com/RadeonOpenCompute"
+distfiles="${_rocroot}/ROCm-OpenCL-Runtime/archive/roc-${version}.tar.gz
+ ${_rocroot}/rocm-cmake/archive/rocm-${version}.tar.gz
+ https://github.com/KhronosGroup/${_ocl_icd_name}/archive/${_ocl_icd_ver}.tar.gz"
+checksum="ac6999f1a491ab066286c2bd6adf50f08f831286f56e267879f9f7eced22f98e
+ 76ed3ee8e56cf3246011cf7723c2abda539e1136e7e7f6909bfa45d268b8644f
+ c94d5bb6dc980c4d41d73e2b81663a19aabe494e923e2d0eec72a4c95b318438"
+nocross=yes
+
+if [ "$XBPS_LIBC" = "musl" ]; then
+ makedepends+=" musl-legacy-compat"
+fi
+
+post_patch() {
+ if [ "$XBPS_LIBC" = "musl" ]; then
+ # Remove dependence on glibc
+ patch -Np0 < ${FILESDIR}/libelf-musl.patch
+ patch -Np0 < ${FILESDIR}/runtime-musl.patch
+ vsed -e '/glibc_functions.cpp/d' -i api/opencl/amdocl/CMakeLists.txt
+ fi
+}
+
+pre_configure() {
+ # ROCm requires a very specific Khronos ICD loader version in the tree
+ # Keep the ICD loader config in /etc/rocm/vendors to avoid conflicts
+ _ocl_icd_dir="${_ocl_icd_name}-${_ocl_icd_ver}"
+ ln -sf "${wrksrc}/${_ocl_icd_dir}" api/opencl/khronos/icd
+ vsed -i "${wrksrc}/${_ocl_icd_dir}/loader/icd_platform.h" \
+ -e 's@/etc/OpenCL/vendors/@/etc/rocm/vendors/@g'
+
+ # CMake modules probably not useful anywhere but for this build
+ ln -sf "${wrksrc}/rocm-cmake-rocm-${version}/share/rocm/cmake"/*.cmake cmake
+
+ # Fix the dlopen macro to point to versioned libamd_comgr shared object
+ vsed -i 'runtime/device/comgrctx.cpp' \
+ -e 's/\blibamd_comgr\(32\)\?.so\b/&.1/g'
+}
+
+post_install() {
+ vlicense License
+
+ # Create descriptor to allow the ICD loader to find the driver
+ vmkdir etc/rocm/vendors
+ echo "libamdocl64.so" > "${DESTDIR}/etc/rocm/vendors/rocm-amdocl64.icd"
+ vmkdir etc/OpenCL/vendors
+ ln -s ../../rocm/vendors/rocm-amdocl64.icd ${DESTDIR}/etc/OpenCL/vendors
+}
+
+rocm-opencl-runtime-devel_package() {
+ depends="${sourcepkg}>=${version}_${revision}"
+ short_desc+=" - development files"
+ pkg_install() {
+ vmove usr/lib/libOpenCL-ROCm.so
+ vmove usr/include
+ }
+}
+
+rocm-opencl-runtime-clinfo_package() {
+ depends="${sourcepkg}>=${version}_${revision}"
+ short_desc+=" - clinfo"
+ pkg_install() {
+ vmove usr/bin/rocm-clinfo
+ }
+}
From ec828063ede3a3c5403a04a60a0c9797c7153865 Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Thu, 30 Apr 2020 13:11:12 -0400
Subject: [PATCH 09/10] New package: rocm-hsa-ext-3.3.0
---
common/shlibs | 2 ++
srcpkgs/rocm-hsa-ext-devel | 1 +
srcpkgs/rocm-hsa-ext/template | 41 +++++++++++++++++++++++++++++++++++
3 files changed, 44 insertions(+)
create mode 120000 srcpkgs/rocm-hsa-ext-devel
create mode 100644 srcpkgs/rocm-hsa-ext/template
diff --git a/common/shlibs b/common/shlibs
index 8cbc885e016..730e6d0d394 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -3867,3 +3867,5 @@ libhsa-runtime64.so.1 rocr-runtime-3.3.0_1
libamd_comgr.so.1 rocm-comgr-3.3.0_1
libOpenCL-ROCm.so.1 rocm-opencl-runtime-3.3.0_1
libamdocl64.so rocm-opencl-runtime-3.3.0_1
+libhsa-ext-image64.so.1 rocm-hsa-ext-3.3.0_1
+libhsa-runtime-tools64.so.1 rocm-hsa-ext-3.3.0_1
diff --git a/srcpkgs/rocm-hsa-ext-devel b/srcpkgs/rocm-hsa-ext-devel
new file mode 120000
index 00000000000..d201e9f2fae
--- /dev/null
+++ b/srcpkgs/rocm-hsa-ext-devel
@@ -0,0 +1 @@
+rocm-hsa-ext
\ No newline at end of file
diff --git a/srcpkgs/rocm-hsa-ext/template b/srcpkgs/rocm-hsa-ext/template
new file mode 100644
index 00000000000..a8ca5220cab
--- /dev/null
+++ b/srcpkgs/rocm-hsa-ext/template
@@ -0,0 +1,41 @@
+# Template file for 'rocm-hsa-ext'
+pkgname=rocm-hsa-ext
+version=3.3.0
+revision=1
+archs="x86_64"
+hostmakedepends="tar"
+short_desc="Radeon Open Compute HSA runtime extensions"
+maintainer="Andrew J. Hesford <ajh@sideband.org>"
+license="NCSA"
+homepage="https://github.com/RadeonOpenCompute"
+_hsa_deb="hsa-ext-rocr-dev_1.1.30300.0-rocm-rel-3.3-19-23fc088b_amd64.deb"
+distfiles="https://repo.radeon.com/rocm/apt/debian/pool/main/h/hsa-ext-rocr-dev/$_hsa_deb"
+checksum=6b44e286b395d946b865ec1f3cc546356396785ac1fde591d07af02d0aa7c25d
+
+do_extract() {
+ ar x "${XBPS_SRCDISTDIR}/${pkgname}-${version}/${_hsa_deb}"
+ tar xvf data.tar.gz
+}
+
+do_install() {
+ _rocm_includes="opt/rocm-${version}/hsa/include"
+
+ vmkdir usr
+ vcopy opt/rocm-${version}/hsa/lib usr
+ vcopy "$_rocm_includes" usr
+
+ # Extract license from one of the header files
+ awk 'BEGIN{HEADER=0} /\/\//{HEADER=1; print $0;} /^[^/]/{if(HEADER==1) exit;}' \
+ < "${_rocm_includes}/hsa/amd_hsa_tools_interfaces.h" \
+ | sed 's@^///*\( \|$\)@@' > LICENSE
+ vlicense LICENSE
+}
+
+rocm-hsa-ext-devel_package() {
+ depends="${sourcepkg}>=${version}_${revision}"
+ short_desc+=" - development files"
+ pkg_install() {
+ vmove usr/include
+ vmove "usr/lib/*.so"
+ }
+}
From e1190061e1d8e68b47bc29fc379af57c9bf38b8f Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Tue, 28 Apr 2020 13:33:46 -0400
Subject: [PATCH 10/10] hashcat: add build option to link against ROCm [ci
skip]
---
srcpkgs/hashcat/files/rocm.patch | 15 +++++++++++++++
srcpkgs/hashcat/patches/tmpdir.patch | 21 +++++++++++++++++++++
srcpkgs/hashcat/template | 17 ++++++++++++++---
3 files changed, 50 insertions(+), 3 deletions(-)
create mode 100644 srcpkgs/hashcat/files/rocm.patch
create mode 100644 srcpkgs/hashcat/patches/tmpdir.patch
diff --git a/srcpkgs/hashcat/files/rocm.patch b/srcpkgs/hashcat/files/rocm.patch
new file mode 100644
index 00000000000..f1e899d30ee
--- /dev/null
+++ b/srcpkgs/hashcat/files/rocm.patch
@@ -0,0 +1,15 @@
+diff -ur a/src/opencl.c b/src/opencl.c
+--- a/src/opencl.c 2018-12-02 05:58:48.000000000 -0500
++++ b/src/opencl.c 2020-04-28 13:24:12.602415333 -0400
+@@ -492,9 +492,9 @@
+
+ if (ocl->lib == NULL) ocl->lib = hc_dlopen ("cygOpenCL-1.dll", RTLD_NOW);
+ #else
+- ocl->lib = hc_dlopen ("libOpenCL.so", RTLD_NOW);
++ ocl->lib = hc_dlopen ("libOpenCL-ROCm.so.1", RTLD_NOW);
+
+- if (ocl->lib == NULL) ocl->lib = hc_dlopen ("libOpenCL.so.1", RTLD_NOW);
++ if (ocl->lib == NULL) ocl->lib = hc_dlopen ("libOpenCL-ROCm.so", RTLD_NOW);
+ #endif
+
+ if (ocl->lib == NULL)
diff --git a/srcpkgs/hashcat/patches/tmpdir.patch b/srcpkgs/hashcat/patches/tmpdir.patch
new file mode 100644
index 00000000000..0558a001c9c
--- /dev/null
+++ b/srcpkgs/hashcat/patches/tmpdir.patch
@@ -0,0 +1,21 @@
+Addresses https://github.com/hashcat/hashcat/issues/2379
+diff -ur a/src/folder.c b/src/folder.c
+--- src/folder.c 2018-12-02 05:58:48.000000000 -0500
++++ src/folder.c 2020-04-28 13:22:27.340522751 -0400
+@@ -457,16 +457,6 @@
+
+ hcfree (cpath);
+
+- //if (getenv ("TMP") == NULL)
+- if (1)
+- {
+- char *tmp;
+-
+- hc_asprintf (&tmp, "TMP=%s", cpath_real);
+-
+- putenv (tmp);
+- }
+-
+ #if defined (_WIN)
+
+ naive_replace (cpath_real, '\\', '/');
diff --git a/srcpkgs/hashcat/template b/srcpkgs/hashcat/template
index e982f99cebf..7d3a8cb5a6b 100644
--- a/srcpkgs/hashcat/template
+++ b/srcpkgs/hashcat/template
@@ -1,15 +1,16 @@
# Template file for 'hashcat'
pkgname=hashcat
version=5.1.0
-revision=2
+revision=3
build_style=gnu-makefile
make_build_args="PREFIX=/usr
USE_SYSTEM_OPENCL=1 USE_SYSTEM_XXHASH=1
- DEPS_OPENCL_PATH=${XBPS_CROSS_BASE}/usr/include
+ DEPS_OPENCL_PATH=${XBPS_CROSS_BASE}/usr/include$(vopt_if rocm /rocm)
DEPS_XXHASH_PATH=${XBPS_CROSS_BASE}/usr/include"
make_use_env=yes
make_install_args="$make_build_args"
-makedepends="gmp-devel opencl2-headers xxHash-devel"
+makedepends="gmp-devel xxHash-devel
+ $(vopt_if rocm rocm-opencl-runtime-devel opencl2-headers)"
checkdepends="perl"
short_desc="Advanced CPU-based password recovery utility"
maintainer="Duncaen <duncaen@voidlinux.org>"
@@ -19,6 +20,9 @@ changelog="https://raw.githubusercontent.com/hashcat/hashcat/master/docs/changes
distfiles="https://hashcat.net/files/hashcat-${version}.tar.gz"
checksum=283beaa68e1eab41de080a58bb92349c8e47a2bb1b93d10f36ea30f418f1e338
+build_options="rocm"
+desc_option_rocm="Use ROCm OpenCL runtime"
+
if [ "$XBPS_TARGET_ENDIAN" = "be" ]; then
broken="Not supported on big endian"
fi
@@ -26,6 +30,13 @@ fi
post_extract() {
sed '/^CC/d' -i src/Makefile
}
+
+post_patch() {
+ if [ "$build_option_rocm" ]; then
+ patch -Np1 < ${FILESDIR}/rocm.patch
+ fi
+}
+
post_install() {
rm -f ${DESTDIR}/usr/share/docs/hashcat/license.txt
vlicense docs/license.txt
next prev parent reply other threads:[~2020-04-30 19:12 UTC|newest]
Thread overview: 61+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-19 13:34 [PR PATCH] " ahesford
2020-04-19 15:24 ` [PR PATCH] [Updated] " ahesford
2020-04-19 15:57 ` ahesford
2020-04-19 19:02 ` ahesford
2020-04-20 2:02 ` ahesford
2020-04-28 14:00 ` ahesford
2020-04-28 15:14 ` ahesford
2020-04-28 17:34 ` ahesford
2020-04-28 17:34 ` ahesford
2020-04-28 17:38 ` ahesford
2020-04-28 18:09 ` ahesford
2020-04-28 18:44 ` [PR PATCH] [Updated] " ahesford
2020-04-28 19:59 ` ahesford
2020-04-30 19:05 ` ahesford
2020-04-30 19:12 ` ahesford [this message]
2020-04-30 19:22 ` ahesford
2020-04-30 19:32 ` ahesford
2020-04-30 19:35 ` ahesford
2020-04-30 19:38 ` ahesford
2020-05-01 4:57 ` lemmi
2020-05-01 5:10 ` ahesford
2020-05-01 5:12 ` ahesford
2020-05-01 14:04 ` [PR PATCH] [Updated] " ahesford
2020-05-01 19:36 ` ahesford
2020-05-02 1:34 ` ahesford
2020-05-02 3:29 ` ahesford
2020-05-05 14:24 ` ahesford
2020-05-05 14:26 ` ahesford
2020-05-07 14:18 ` ahesford
2020-05-07 16:01 ` ahesford
2020-05-08 14:40 ` ahesford
2020-05-11 18:02 ` ericonr
2020-05-11 18:07 ` ahesford
2020-05-11 18:07 ` ahesford
2020-05-11 18:52 ` [PR PATCH] [Updated] " ahesford
2020-05-11 20:03 ` ahesford
2020-05-14 18:04 ` FiCacador
2020-05-14 18:04 ` FiCacador
2020-05-14 19:13 ` ahesford
2020-05-14 19:14 ` ahesford
2020-05-14 22:51 ` FiCacador
2020-05-15 0:07 ` ahesford
2020-05-15 1:30 ` fosslinux
2020-05-15 3:31 ` FiCacador
2020-05-15 3:32 ` FiCacador
2020-05-15 6:54 ` fosslinux
2020-08-04 17:13 ` [PR PATCH] [Updated] " ahesford
2020-08-04 17:13 ` ahesford
2020-08-04 17:16 ` [PR PATCH] [Closed]: " ahesford
2020-08-04 17:16 ` [PR PATCH] [Updated] " ahesford
2020-08-04 17:19 ` ahesford
2020-08-04 17:24 ` [PR PATCH] [Updated] " ahesford
2020-08-18 18:36 ` aurieh
2020-08-18 18:38 ` aurieh
2020-08-18 18:39 ` aurieh
2020-08-18 19:46 ` ahesford
2020-08-20 18:50 ` [PR PATCH] [Updated] " ahesford
2020-12-21 7:32 ` fosslinux
2020-12-21 11:58 ` ahesford
2021-02-15 5:19 ` ahesford
2021-02-15 5:19 ` [PR PATCH] [Closed]: " ahesford
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=20200430191204.3Qh9-f5Rto47dEux4rc4GemqdlkfPKmN_nU1-R9PQQk@z \
--to=ahesford@users.noreply.github.com \
--cc=ml@inbox.vuxu.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;
as well as URLs for NNTP newsgroup(s).