aboutsummaryrefslogblamecommitdiffstats
path: root/dev-util/amd-app-sdk/amd-app-sdk-2.4.ebuild
blob: e25af82f88e8ed5fd20fedd684154d05ece7f462 (plain) (tree)














































































































































                                                                                                              
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI="2"
inherit eutils flag-o-matic

DESCRIPTION="Enable compiling code and loading it on ATI/AMD GPU"
HOMEPAGE="http://developer.amd.com/GPU/ATISTREAMSDK/Pages/default.aspx"
SRC_URI="http://developer.amd.com/Downloads/AMD-APP-SDK-v${PV}-lnx64.tgz"

LICENSE="AMD GPL-1 as-is"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="examples doc"
RESTRICT="strip fetch"
RDEPEND="examples? ( media-libs/glew )"

MY_PN="AMD-APP-SDK"
MY_PV="${PV}"
MY_P="${MY_PN}-v${MY_PV}-lnx64"

QA_EXECSTACK="
	usr/lib32/libatiocl32.so
	usr/lib64/libatiocl64.so
	usr/lib/libatiocl32.so
	usr/lib/libatiocl64.so
"

src_compile() {
    if use examples; then
        cd ${MY_P} || die
        MAKEOPTS="${MAKEOPTS} -j1" emake || die "emake failed"
    fi
}

src_install() {
	local DEST=/opt/${PF}

	cd ${MY_P} || die

	# install libraries and executables into standart tree
	dodir ${DEST}/bin
	if use multilib; then
		# executables (32 and 64 bit versions)
		newbin bin/x86_64/clinfo clinfo64
		newbin bin/x86/clinfo clinfo32
		dosym cinfo64 /usr/bin/clinfo
		dodir ${DEST}/bin/x86
		dosym /usr/bin/clinfo32 ${DEST}/bin/x86/clinfo
		dodir ${DEST}/bin/x86_64
		dosym /usr/bin/clinfo64 ${DEST}/bin/x86_64/clinfo
		# libraries
		dolib.so lib/x86_64/libOpenCL.so lib/x86_64/libOpenCL.so.1 lib/x86_64/libatiocl64.so
		insinto /usr/lib32
		insopts -m0755
		doins lib/x86/libOpenCL.so lib/x86/libOpenCL.so.1 lib/x86/libatiocl32.so
		dosym /usr/lib32/libOpenCL.so ${DEST}/lib/x86/libOpenCL.so
		dosym /usr/lib32/libOpenCL.so.1 ${DEST}/lib/x86/libOpenCL.so.1
		dosym /usr/lib32/libamdocl32.so ${DEST}/lib/x86/libamdocl32.so
		dosym /usr/lib64/libOpenCL.so ${DEST}/lib/x86_64/libOpenCL.so
		dosym /usr/lib64/libOpenCL.so.1 ${DEST}/lib/x86_64/libOpenCL.so.1
		dosym /usr/lib64/libamdocl64.so ${DEST}/lib/x86_64/libamdocl64.so
	else
		# 32 bit or 64 bit versions are installed only
		if use amd64; then
			dobin bin/x86_64/clinfo
			dolib.so lib/x86_64/libOpenCL.so lib/x86_64/libOpenCL.so.1 lib/x86_64/libamdocl64.so
			dodir ${DEST}/bin/x86_64
			dosym /usr/bin/clinfo ${DEST}/bin/x86_64/clinfo
			dosym /usr/lib/libOpenCL.so ${DEST}/lib/x86_64/libOpenCL.so
			dosym /usr/lib/libOpenCL.so.1 ${DEST}/lib/x86_64/libOpenCL.so.1
			dosym /usr/lib/libamdocl64.so ${DEST}/lib/x86_64/libamdocl64.so
		else
			dobin bin/x86/clinfo
			dolib.so lib/x86/libOpenCL.so lib/x86/libOpenCL.so.1 lib/x86/libamdocl32.so
			dodir ${DEST}/bin/x86
			dosym /usr/bin/clinfo ${DEST}/bin/x86/clinfo
			dosym /usr/lib/libOpenCL.so ${DEST}/lib/x86/libOpenCL.so
			dosym /usr/lib/libOpenCL.so.1 ${DEST}/lib/x86/libOpenCL.so.1
			dosym /usr/lib/libamdocl32.so ${DEST}/lib/x86/libamdocl32.so
		fi
	fi

	# Install libraries
	insinto ${DEST}/lib
	insopts -m0755

	if ! use amd64 || use multilib; then
		insinto ${DEST}/lib/x86
		doins lib/x86/libGLEW.so
		doins lib/x86/libglut.so
	fi
	if use amd64; then
	insinto ${DEST}/lib/x86_64
		doins lib/x86_64/libGLEW.so
		doins lib/x86_64/libglut.so
	fi

	# Install includes
	# only selected header; not  glew
	insinto /usr/include
	insopts -m0644
	doins -r include/CAL
	doins -r include/CL
	insinto ${DEST}/include
	dosym /usr/include/CL ${DEST}/include/CL
	doins -r include/GL

	# Install examples & docs
	if use examples; then
		insinto "/usr/share/doc/${PF}/examples"
		doins -r samples
		doins -r make
		dosym ${DEST}/include /usr/share/doc/${PF}/examples/include
		dosym ${DEST}/lib /usr/share/doc/${PF}/examples/lib
	fi

	if use doc; then
		dodoc docs/opencl/*.pdf
		dodoc docs/opencl/LICENSES
		dodoc docs/opencl/StreamDoc.url
	fi

	# Create icd files; we COULD use the tar file from
	# ATI's homepage, yet this seems so unnessecary as
	# those files are VERY simple.
	insinto /etc/OpenCL/vendors
	echo "libamdocl64.so" > amdocl64.icd
	echo "libamdocl32.so" > amdocl32.icd

	if use amd64; then
		doins amdocl64.icd
	fi
	doins amdocl32.icd

	# Create env file
	echo "AMDAPPSDKROOT=${DEST}" > 99${PN}
	doenvd 99${PN}

	# issue info about gpu computing
	elog "REMEMBER: You need to install a recent version of ati-drivers to use your GPU for calculations."
}