Skip to content

Commit

Permalink
ENH: add amd/opencl stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
npinto committed Jul 4, 2012
1 parent 4333a8c commit 5c44c52
Show file tree
Hide file tree
Showing 14 changed files with 1,455 additions and 0 deletions.
8 changes: 8 additions & 0 deletions dev-util/amdapp/Manifest
@@ -0,0 +1,8 @@
AUX 01-implicit-linking.patch 328 RMD160 75a074217200d79762bfb672afc1a4e0c3f30718 SHA1 16a3d09b80eeaf4062ec86a132429bcf6be87da2 SHA256 25781556b6441c26449e5577ea068eda74fb2dc520004897c64482cedb6fac0e
AUX 02-readlink-include.patch 264 RMD160 7f1e0487c62d9ca4bff896cc480a6700e3dd1bdf SHA1 9dd4970af54f6548d65f9bb34d5e4616159b040d SHA256 8418553d624d2cfd04a573311133f9d20d3bcce426025abfe2f68bef8cec4bc7
DIST AMD-APP-SDK-v2.6-lnx32.tgz 63804198 RMD160 54bc361157caa65884b423bbee38ce2992972aad SHA1 c8dad0e33ffd9a6a60a0a16d9c9d6fe56d89e535 SHA256 b50516cf4372c61199698bc204fa12feafea83b0c87bfdcd002639422ede7e0f
DIST AMD-APP-SDK-v2.6-lnx64.tgz 97519970 RMD160 4b6643ffae445fb4bb5cc817cb4fae886b86beb3 SHA1 b2ce0497306b65f4fe912d74142902ecdbbfbd07 SHA256 3042dafb0fbe3e61585b53f23f9d2d568888df01f39cbb12ee74118dca2845ba
EBUILD amdapp-2.6-r1.ebuild 6225 RMD160 5f9e960baf80ffdb2f641a7b797f61b9c434f160 SHA1 16d6286b7ec16e698170a556185e9f8856dd0823 SHA256 c3cb58595e4c0b82a3618b5397afdec9ce14a7a34104b796e43413bc9bd81115
EBUILD amdapp-2.6-r2.ebuild 6686 RMD160 9481b867580ef1752c762cf4b80ea4387051de50 SHA1 53afde0edb5fc290bdbeb82bfe8b9beb8264608d SHA256 94f3009b25eccc0480b7c9f7463253614f34a64bc8e26f5e8b1704903079052c
EBUILD amdapp-2.6-r3.ebuild 7053 RMD160 b47b4b29c2facdab58ecc685173da9038c06e3a1 SHA1 6fd1e4e6c3d0de66c047998a09023b03bb03332d SHA256 a963be88c4fff280952636dabf04d63496bba0b8d3235e9755727173f9266cef
EBUILD amdapp-2.6.ebuild 7499 RMD160 1955b8390482b175e3286ba58054665d732049dc SHA1 5f7f32c399d64467f701dcb92d3bc1bb5e26dd81 SHA256 addb1c589ebbf17716e4e82940d317c37d3e3730ce392f6f4af26d3168e709e0
197 changes: 197 additions & 0 deletions dev-util/amdapp/amdapp-2.6-r1.ebuild
@@ -0,0 +1,197 @@
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI=4

inherit eutils

DESCRIPTION="AMD Accelerated Parallel Processing (APP) SDK (formerly ATI Stream)"
HOMEPAGE="http://developer.amd.com/sdks/amdappsdk/pages/default.aspx"

_ARCHIVE_NAME="AMD-APP-SDK"
_ARCHIVE_DONWLOAD_BASE="${_ARCHIVE_NAME}-v${PV}-lnxARCHBASE.tgz"
_ARCHIVE_UNPACKED_BASE="${_ARCHIVE_NAME}-v${PV}-RC3-lnxARCHBASE.tgz"
_ARCHIVE_DONWLOAD_X86=${_ARCHIVE_DONWLOAD_BASE/ARCHBASE/32}
_ARCHIVE_UNPACKED_X86=${_ARCHIVE_UNPACKED_BASE/ARCHBASE/32}
_ARCHIVE_DONWLOAD_AMD64=${_ARCHIVE_DONWLOAD_BASE/ARCHBASE/64}
_ARCHIVE_UNPACKED_AMD64=${_ARCHIVE_UNPACKED_BASE/ARCHBASE/64}

SRC_URI="
x86? ( http://developer.amd.com/Downloads/${_ARCHIVE_DONWLOAD_X86} )
amd64? ( http://developer.amd.com/Downloads/${_ARCHIVE_DONWLOAD_AMD64} )
"
LICENSE="AMD GPL-1 as-is"
SLOT="0"
KEYWORDS="~x86 ~amd64"
IUSE="examples profiler doc +eselect"

# FIXME: Make sure dependency on ati-drivers is correct.
RDEPEND="app-admin/eselect-opengl
sys-devel/llvm
sys-devel/gcc
media-libs/mesa
media-libs/freeglut
|| ( dev-util/opencl-headers dev-util/nvidia-cuda-toolkit >=x11-drivers/ati-drivers-11.12[opencl] )
examples? ( media-libs/glew )
eselect? ( app-admin/eselect-opencl )"
DEPEND="${RDEPEND}
dev-lang/perl
!<dev-util/amdstream-2.6"

RESTRICT="mirror strip"
FEATURES="multilib-strict"

if [[ "${ARCH}" == "x86" ]]; then
S="${WORKDIR}/${_ARCHIVE_UNPACKED_X86/.tgz/}"
elif [[ "${ARCH}" == "amd64" ]]; then
S="${WORKDIR}/${_ARCHIVE_UNPACKED_AMD64/.tgz/}"
fi

#_installdir=/opt/amdstream
#_installdir=/usr/share/amdstream
#_installdir=/opt/AMDAPP
#_installdir=/opt/amd-app-sdk
_installdir=/usr/lib/amd

src_unpack() {
default_src_unpack
if use x86; then
unpack ./${_ARCHIVE_UNPACKED_X86}
elif use amd64; then
unpack ./${_ARCHIVE_UNPACKED_AMD64}
else
die "Architecture not supported or not detected correctly!"
fi

unpack ./icd-registration.tgz
}

src_prepare() {
# See https://aur.archlinux.org/packages.php?ID=21933
epatch "${FILESDIR}/01-implicit-linking.patch"
epatch "${FILESDIR}/02-readlink-include.patch"
}


src_compile() {
# FIXME: Make sure examples are all compiled and installed.
if use examples; then
emake -j1 || die "Make failed!"
fi
}

src_install() {

if use x86; then
_arch="x86"
_other_arch="x86_64"
elif use amd64; then
_arch="x86_64"
_other_arch="x86"
else
die "Architecture not supported or not detected correctly!"
fi

# Install clinfo
dobin bin/${_arch}/clinfo

dodir /usr/portage/licenses/
cat docs/opencl/LICENSES > ${D}/usr/portage/licenses/${P}
cat LICENSE-llvm.txt > ${D}/usr/portage/licenses/${P}-llvm
cat LICENSE-mingw.txt > ${D}/usr/portage/licenses/${P}-mingw

# Install include files
# CAL and OpenVideo can go in /usr/include
insinto /usr/include
doins -r include/CAL include/OpenVideo
# AMD APP includes OpenCL and OpenGL includes. Don't conflict with other packages.
if use eselect; then
insinto ${_installdir}/include
# else
# # FIXME: Is that valid?
# dosym /usr/lib/libOpenCL.so.1 /usr/lib/libOpenCL.so
# use multilib && dosym /usr/lib32/libOpenCL.so.1 /usr/lib32/libOpenCL.so
fi
doins -r include/CL
doins -r include/GL

# Include lib files
# libaticalc.so and libaticalrt.so
dolib.so lib/*.so
# Architecture dependant
# 32 bits
# FIXME: On pure x86, should /usr/lib32 be used or /usr/lib?
insinto /usr/lib32
insopts -m0755
doins lib/x86/{libamdocl32.so,libSlotMaximizerAg.so,libSlotMaximizerBe.so}
insinto ${_installdir}/lib32
doins lib/x86/{libGLEW.so,libglut.so}
# libOpenCL.so
insinto /usr/lib32/OpenCL/vendors/amd
doins lib/x86/libOpenCL.so.1
ln -s libOpenCL.so.1 ${D}/usr/lib32/OpenCL/vendors/amd/libOpenCL.so
# 64 bits
if use amd64; then
insinto /usr/lib64
doins lib/x86_64/{libamdocl64.so,libSlotMaximizerAg.so,libSlotMaximizerBe.so}
insinto ${_installdir}/lib64
doins lib/x86_64/{libGLEW.so,libglut.so}
# libOpenCL.so
insinto /usr/lib64/OpenCL/vendors/amd
doins lib/x86_64/libOpenCL.so.1
ln -s libOpenCL.so.1 ${D}/usr/lib64/OpenCL/vendors/amd/libOpenCL.so
fi

# Register ICD
# http://www.khronos.org/registry/cl/extensions/khr/cl_khr_icd.txt
insinto /etc/OpenCL/vendors/
doins ../etc/OpenCL/vendors/*

# Install examples
if use examples; then
insinto ${_installdir}/examples
doins -r samples
doins -r make
doins Makefile
fi

if use doc; then
for f in docs/opencl/*; do
dodoc $f
done
fi

# Create env file
echo "ATISTREAMSDKROOT=${_installdir}" > 99${PN}
doenvd 99${PN}

echo "${_installdir}/$(get_libdir)" > ${D}/etc/ld.so.conf.d/99amdapp.conf

# Install profiler
if use profiler; then
_PROF_P=`\ls tools`
_PROF_PV=${_PROF_P/*-/}
_PROF_PN=${_PROF_P/-*/}
cat tools/${_PROF_P}/License.txt > ${D}/usr/portage/licenses/${_PROF_P} || die "Can't copy CLPerfMarker's license."

dobin tools/${_PROF_P}/${_arch}/sprofile
dolib tools/${_PROF_P}/${_arch}/*.so

# CLPerfMarker
# FIXME: there is bin/x86/libCLPerfMarker32.so and x86_64/libCLPerfMarker.so...
dolib tools/${_PROF_P}/CLPerfMarker/bin/${_arch}/*.so
insinto /usr/include
doins tools/${_PROF_P}/CLPerfMarker/include/*

if use doc; then
docinto CLPerfMarker
dodoc tools/${_PROF_P}/CLPerfMarker/doc/*
# cp -r tools/${_PROF_P}/html ${D}/usr/share/doc/${P}/CLPerfMarker || die "Can't copy CLPerfMarker's doc folder."
# cp -r tools/${_PROF_P}/jqPlot ${D}/usr/share/doc/${P}/ || die "Can't copy CLPerfMarker's jqPlot folder."
# newdoc tools/${_PROF_P}/html CLPerfMarker
dodoc -r tools/${_PROF_P}/jqPlot
dodoc -r tools/${_PROF_P}/html
fi
fi
}

0 comments on commit 5c44c52

Please sign in to comment.