Skip to content

Instantly share code, notes, and snippets.

@maz-1
Last active August 19, 2021 07:33
Show Gist options
  • Save maz-1/d08c16f84c8a0237c38141bd49a8d55c to your computer and use it in GitHub Desktop.
Save maz-1/d08c16f84c8a0237c38141bd49a8d55c to your computer and use it in GitHub Desktop.
opencl-amd
# Maintainer: Carson Rueter <roachh at proton mail dot com>
# Co-Maintainer: George Sofianos
# Contributor: Christopher Snowhill <kode54 at gmail dot com>
# Contributor: ipha <ipha00 at gmail dot com>
# Contributor: johnnybash <georgpfahler at wachenzell dot org>
# Contributor: grmat <grmat at sub dot red>
# Contributor: maz-1 <ohmygod19993 at gmail dot com>
prefix='amdgpu-pro-'
postfix='-ubuntu-20.04'
major='21.30'
minor='1290604'
amdver='2.4.106'
shared="opt/amdgpu-pro/lib/x86_64-linux-gnu"
shared2="opt/amdgpu/lib/x86_64-linux-gnu"
shared_32="opt/amdgpu-pro/lib/i386-linux-gnu"
shared2_32="opt/amdgpu/lib/i386-linux-gnu"
tarname="${prefix}${major}-${minor}${postfix}"
pkgbase=opencl-amd-installer
pkgname=(
opencl-amd
lib32-opencl-amd
)
pkgname=opencl-amd
pkgdesc="OpenCL userspace driver as provided in the amdgpu-pro driver stack. This package is intended to work along with the free amdgpu stack."
pkgver=${major}.${minor}
pkgrel=1
arch=('x86_64')
url='http://www.amd.com'
license=('custom:AMD')
makedepends=('wget')
DLAGENTS='https::/usr/bin/wget --referer https://www.amd.com/en/support/kb/release-notes/rn-amdgpu-unified-linux-21-30 -N %u'
source=("https://drivers.amd.com/drivers/linux/$tarname.tar.xz")
sha256sums=('5840aac63a3658b3f790c59e57226062e7e4bc74f3c066a3e7bc9e3065e24382')
package_lib32-opencl-amd() {
pkgdesc="OpenCL 32bit userspace driver as provided in the amdgpu-pro driver stack. This package is intended to work along with the free amdgpu stack."
license=('custom:AMD')
provides=('lib32-opencl-driver')
depends=('lib32-libdrm' 'lib32-ocl-icd' 'lib32-gcc-libs' 'opencl-amd')
mkdir -p "${srcdir}/opencl32"
cd "${srcdir}/opencl32"
# orca
ar x "${srcdir}/$tarname/opencl-orca-amdgpu-pro-icd_${major}-${minor}_i386.deb"
tar xJf data.tar.xz
cd ${shared_32}
sed -i "s|libdrm_amdgpu|libdrm_amdgpo|g" libamdocl-orca32.so
mkdir -p "${srcdir}/libdrm32"
cd "${srcdir}/libdrm32"
ar x "${srcdir}/$tarname/libdrm-amdgpu-amdgpu1_${amdver}-${minor}_i386.deb"
tar xJf data.tar.xz
cd ${shared2_32}
rm "libdrm_amdgpu.so.1"
mv "libdrm_amdgpu.so.1.0.0" "libdrm_amdgpo.so.1.0.0"
ln -s "libdrm_amdgpo.so.1.0.0" "libdrm_amdgpo.so.1"
mv "${srcdir}/opencl32/etc" "${pkgdir}/"
mkdir -p ${pkgdir}/usr/lib32
# orca
mv "${srcdir}/opencl32/${shared_32}/libamdocl-orca32.so" "${pkgdir}/usr/lib32/"
mv "${srcdir}/libdrm32/${shared2_32}/libdrm_amdgpo.so.1.0.0" "${pkgdir}/usr/lib32/"
mv "${srcdir}/libdrm32/${shared2_32}/libdrm_amdgpo.so.1" "${pkgdir}/usr/lib32/"
rm -r "${srcdir}/opencl32"
rm -r "${srcdir}/libdrm32"
}
package_opencl-amd() {
pkgdesc="OpenCL userspace driver as provided in the amdgpu-pro driver stack. This package is intended to work along with the free amdgpu stack."
license=('custom:AMD')
depends=('libdrm' 'ocl-icd' 'gcc-libs' 'numactl')
optdepends=('clinfo')
provides=('opencl-driver')
conflicts=('rocm-opencl-runtime')
mkdir -p "${srcdir}/opencl"
cd "${srcdir}/opencl"
# roc*
ar x "${srcdir}/$tarname/opencl-rocr-amdgpu-pro_${major}-${minor}_amd64.deb"
tar xJf data.tar.xz
ar x "${srcdir}/$tarname/rocm-device-libs-amdgpu-pro_1.0.0-${minor}_amd64.deb"
tar xJf data.tar.xz
ar x "${srcdir}/$tarname/hsa-runtime-rocr-amdgpu_1.3.0-${minor}_amd64.deb"
tar xJf data.tar.xz
ar x "${srcdir}/$tarname/hsakmt-roct-amdgpu_1.0.9-${minor}_amd64.deb"
tar xJf data.tar.xz
ar x "${srcdir}/$tarname/hip-rocr-amdgpu-pro_${major}-${minor}_amd64.deb"
tar xJf data.tar.xz
# comgr
ar x "${srcdir}/$tarname/comgr-amdgpu-pro_2.1.0-${minor}_amd64.deb"
tar xJf data.tar.xz
# orca
ar x "${srcdir}/$tarname/opencl-orca-amdgpu-pro-icd_${major}-${minor}_amd64.deb"
tar xJf data.tar.xz
cd ${shared}
sed -i "s|libdrm_amdgpu|libdrm_amdgpo|g" libamdocl-orca64.so
mkdir -p "${srcdir}/libdrm"
cd "${srcdir}/libdrm"
ar x "${srcdir}/$tarname/libdrm-amdgpu-amdgpu1_${amdver}-${minor}_amd64.deb"
tar xJf data.tar.xz
cd ${shared2}
rm "libdrm_amdgpu.so.1"
mv "libdrm_amdgpu.so.1.0.0" "libdrm_amdgpo.so.1.0.0"
ln -s "libdrm_amdgpo.so.1.0.0" "libdrm_amdgpo.so.1"
mv "${srcdir}/opencl/etc" "${pkgdir}/"
mkdir -p ${pkgdir}/usr/lib
# roc*
mv "${srcdir}/opencl/${shared}/libamdocl64.so" "${pkgdir}/usr/lib/"
mv "${srcdir}/opencl/${shared}/libamd_comgr.so.2.1.0" "${pkgdir}/usr/lib"
mv "${srcdir}/opencl/${shared}/libamdhip64.so.4.2.21303-" "${pkgdir}/usr/lib"
mv "${srcdir}/opencl/${shared}/libamdhip64.so" "${pkgdir}/usr/lib"
mv "${srcdir}/opencl/${shared}/libamdhip64.so.4" "${pkgdir}/usr/lib"
mv "${srcdir}/opencl/${shared}/libhsa-runtime64.so.1.3.0" "${pkgdir}/usr/lib"
mv "${srcdir}/opencl/${shared}/libhsa-runtime64.so.1" "${pkgdir}/usr/lib"
mv "${srcdir}/opencl/${shared2}/libhsakmt.so.1.0.6" "${pkgdir}/usr/lib"
mv "${srcdir}/opencl/${shared2}/libhsakmt.so.1" "${pkgdir}/usr/lib"
# comgr
cd ${srcdir}/opencl/${shared}
ln -s "libamd_comgr.so.2.0.0" "libamd_comgr.so"
mv "${srcdir}/opencl/${shared}/libamd_comgr.so" "${pkgdir}/usr/lib/"
mv "${srcdir}/opencl/${shared}/libamd_comgr.so.2" "${pkgdir}/usr/lib/libamd_comgr.so"
# orca
mv "${srcdir}/opencl/${shared}/libamdocl-orca64.so" "${pkgdir}/usr/lib/"
mv "${srcdir}/libdrm/${shared2}/libdrm_amdgpo.so.1.0.0" "${pkgdir}/usr/lib/"
mv "${srcdir}/libdrm/${shared2}/libdrm_amdgpo.so.1" "${pkgdir}/usr/lib/"
mkdir -p "${pkgdir}/opt/amdgpu/share/libdrm"
cd "${pkgdir}/opt/amdgpu/share/libdrm"
ln -s /usr/share/libdrm/amdgpu.ids amdgpu.ids
mv "${srcdir}/opencl/opt/amdgpu-pro" "${pkgdir}/opt"
rm -r "${srcdir}/opencl"
rm -r "${srcdir}/libdrm"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment