Skip to content

Instantly share code, notes, and snippets.

@fuchsi
Created November 14, 2013 08:16
Show Gist options
  • Save fuchsi/7463236 to your computer and use it in GitHub Desktop.
Save fuchsi/7463236 to your computer and use it in GitHub Desktop.
dev-util/ati-stream-sdk-bin/ati-stream-sdk-bin-2.9.ebuild Quick and dirty hack to install the latest AMD APP SDK
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
EAPI="2"
DESCRIPTION="Enable compiling code and loading it on ATI/AMD GPU"
HOMEPAGE="http://developer.amd.com/tools-and-sdks/heterogeneous-computing/amd-accelerated-parallel-processing-app-sdk/"
SDK_URI="http://developer.amd.com/tools-and-sdks/heterogeneous-computing/amd-accelerated-parallel-processing-app-sdk/downloads/"
SRC_URI="AMD-APP-SDK-v2.9-RC-lnx64.tgz"
LICENSE="AMD GPL-1 as-is"
SLOT="0"
KEYWORDS="amd64 x86"
IUSE="livecd examples"
RESTRICT="fetch strip"
RDEPEND="!livecd? ( >=x11-drivers/ati-drivers-13.11_beta )
app-admin/eselect-opencl
examples? ( media-libs/glew )"
QA_EXECSTACK="
opt/ati-stream-sdk/lib/x86/libamdocl32.so
opt/ati-stream-sdk/lib/x86_64/libamdocl64.so
"
check_tarballs_available() {
local uri=$1; shift
local dl= unavailable=
for dl in "${@}"; do
[[ ! -f "${DISTDIR}/${dl}" ]] && unavailable+=" ${dl}"
done
if [[ -n "${unavailable}" ]]; then
if [[ -z ${_check_tarballs_available_once} ]]; then
einfo
einfo "AMD requires you to download the needed files manually."
einfo
_check_tarballs_available_once=1
fi
einfo "Download the following files:"
for dl in ${unavailable}; do
einfo " ${dl}"
done
einfo "at '${uri}'"
einfo
einfo "After you downloaded the APP SDK you need to extract the"
einfo "${dl} file from the downloaded file and move it into ${DISTDIR}"
einfo
fi
}
pkg_nofetch() {
local distfiles=( $(eval "echo \${$(echo AT_${ARCH/-/_})}") )
check_tarballs_available "${SDK_URI}" "${distfiles[@]}"
}
src_install() {
local DEST=/opt/ati-stream-sdk
insinto ${DEST}
cd AMD-APP-SDK-v${PV}-RC-lnx64 || die
if use amd64; then
if use multilib; then
dosym ../..${DEST}/lib/x86/libamdocl32.so /usr/lib32/
dosym ../..${DEST}/lib/x86/libamdocl32.so /usr/lib32/libatiocl32.so
else
rm -rf bin/x86 lib/x86
fi
dosym ../..${DEST}/lib/x86_64/libamdocl64.so /usr/lib64/
dosym ../..${DEST}/lib/x86_64/libamdocl64.so /usr/lib64/libatiocl64.so
else
dosym ../..${DEST}/lib/x86/libamdocl32.so /usr/lib/
dosym ../..${DEST}/lib/x86/libamdocl32.so /usr/lib/libatiocl32.so
rm -rf bin/x86_64 lib/x86_64
fi
# Install executables
insopts -m0755
doins -r bin
# Install libraries
doins -r lib
# Install includes
# only selected header; not glew
insinto ${DEST}/include
insopts -m0644
doins -r include/*
# Install examples & docs
if use examples; then
insinto ${DEST}
doins -r samples
doins -r make
fi
# install OpenCL installable client driver
# What should we do with the absolute symlink?
dodir /etc/OpenCL/vendors
if use amd64; then
echo "libamdocl64.so" > ${D}/etc/OpenCL/vendors/atiocl64.icd
fi
echo "libamdocl32.so" > ${D}/etc/OpenCL/vendors/atiocl32.icd
# Create env file
echo "ATISTREAMSDKROOT=${DEST}" > 99${PN}
doenvd 99${PN}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment