Skip to content

Instantly share code, notes, and snippets.

@JonasCz
Created December 19, 2018 15:02
Show Gist options
  • Save JonasCz/d8e1c3adf54df4d44fe7147fc266419f to your computer and use it in GitHub Desktop.
Save JonasCz/d8e1c3adf54df4d44fe7147fc266419f to your computer and use it in GitHub Desktop.
# Contributor: Vojtech Kral <vojtech_kral^hk>
pkgname='libopencl'
pkgver=2.0
pkgrel=3
_appsdk_ver='3.0.0'
pkgdesc='AMD OpenCL library and ICD loader'
arch=('i686' 'x86_64')
url="http://developer.amd.com/tools-and-sdks/opencl-zone/amd-accelerated-parallel-processing-app-sdk/"
license=("custom")
install='install'
makedepends=('wget')
provides=('libcl')
conflicts=('libcl' 'nvidia-utils')
_agr_url='http://developer.amd.com/amd-license-agreement-appsdk/'
# Architecture resolution
_arch="${CARCH/i6/x}"
_bits="${_arch/x86/32}"
_bits="${_bits/32_/}"
_file="AMD-APP-SDKInstaller-v3.0.130.136-GA-linux${_bits}.tar.bz2"
[ "$CARCH" = 'x86_64' ] && _hash='0aa436acd334b686820bd3caab9f09014608741b92e3996d3642d0b148ede0f7' \
|| _hash='181fb9815e735c90ca5713acc27a6f9ed7f85135d2f2a085bed7b4c7ed157b94'
_tarball="AMD-APP-SDK-${_appsdk_ver}-${CARCH}.tar.bz2"
_sfx="AMD-APP-SDK-v3.0.130.136-GA-linux${_bits}.sh"
_offset=9484
_inner='inner.tar.bz2'
_wget()
{
wget -c -t 3 --waitretry=3 -O - $@
}
prepare()
{
local fbase nonce1 post_id nonce2 postdata1 postdata2
echo 'To download AMD APP SDK you need to accept AMD APP SDK license agreement. (To view the license, visit AMD APP SDK website.)' # IANAL
read -p "Accept? [y/n] " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
msg 'Downloading AMD APP SDK...'
fbase=$(echo -n $_file | base64)
echo -n '[tarball] '
_wget http://cs.wisc.edu/~riccardo/assets/AMD-APP-SDKInstaller-v3.0.130.136-GA-linux64.tar.bz2 -O "${_tarball}"
msg "Validating ${_tarball} files with sha256sum ..."
echo "${_hash} ${_tarball}" | sha256sum -c || exit 1
msg "Extracting ${_tarball} ..."
bsdtar -jxOf "${_tarball}" \
| dd ibs="${_offset}" skip=1 of="${_inner}" 2> /dev/null
bsdtar -zxf "${_inner}"
else
exit 1
fi
}
package()
{
#Install libOpenCL
#I'm not very sure about so version, so I'm going to cover several cases...
install -d -m 755 "${pkgdir}/usr/lib"
install -m 755 "lib/${_arch}/libOpenCL.so" "${pkgdir}/usr/lib/libOpenCL.so"
ln -s 'libOpenCL.so' "${pkgdir}/usr/lib/libOpenCL.so.1"
ln -s 'libOpenCL.so' "${pkgdir}/usr/lib/libOpenCL.so.2"
ln -s 'libOpenCL.so' "${pkgdir}/usr/lib/libOpenCL.so.2.0"
ln -s 'libOpenCL.so' "${pkgdir}/usr/lib/libOpenCL.so.2.0.0"
#Install license
install -d -m 755 "${pkgdir}/usr/share/licenses/libopencl"
install -m 644 'APPSDK-EULA-linux.txt' "${pkgdir}/usr/share/licenses/libopencl"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment