summaryrefslogtreecommitdiff
blob: f8154081823d4f15023fa09e90068266e2be5b2b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sci-libs/acml/acml-3.0.0.ebuild,v 1.3 2006/05/10 18:37:21 kugelfang Exp $

inherit eutils

DESCRIPTION="AMD Core Math Library (ACML) for x86 and amd64 CPUs"
HOMEPAGE="http://developer.amd.com/acml.aspx"

MY_PV=${PV//\./\-}
S=${WORKDIR}

SRC_URI="amd64? ( acml-${MY_PV}-gnu-64bit.tgz )
	x86? ( acml-${MY_PV}-gnu-32bit.tgz )"
RESTRICT="fetch nostrip"
IUSE="sse sse2"
LICENSE="ACML"
KEYWORDS="amd64 ~x86"
SLOT="0"
RDEPEND="virtual/libc
	>=app-admin/eselect-1.0_rc2"
PROVIDE="virtual/blas
	virtual/lapack"

src_unpack() {
	unpack ${A}
	if [ "${ARCH}" == "amd64" ] ; then
		export BITS="64"
	elif [ "${ARCH}" == "x86" ] ; then
		export BITS="32"
		if ! use sse2 ; then
			use sse \
				&& export SUFFIX="_nosse2" \
				|| export SUFFIX="_nosse"
		fi
	fi
	(DISTDIR="${S}" unpack contents-acml-${MY_PV}-gnu-${BITS}bit.tgz)

	mv Doc doc
}

src_compile() {
	return
}

src_install() {
	# Documentation
	cd ${S}/doc
	dodoc acml.*

	# Headers
	mkdir -p ${D}/usr/include/acml/
	cp ${S}/gnu${BITS}${SUFFIX}/include/* ${D}/usr/include/acml/ \
		|| die "Could not copy header file"
	cd ${D}/usr/include
	ln -s acml/acml.h acml.h

	# Libraries
	mkdir -p ${D}/usr/$(get_libdir)/
	cp ${S}/gnu${BITS}${SUFFIX}/lib/* ${D}/usr/$(get_libdir)/ \
		|| die "Could not copy library files"
	unset SUFFIX

	# Configfiles
	mkdir -p ${D}/usr/$(get_libdir)/{blas,lapack}
	for x in ${FILESDIR}/*.{blas,lapack}; do
		y="$(basename $x)"
		cp $x ${D}/usr/$(get_libdir)/${y/*\.}/${y/\.*}
	done
}

pkg_postinst() {
	einfo "To use ACML's BLAS features, you have to issue (as root):"
	einfo "\n\t/usr/bin/eselect blas set ACML"
	einfo "To use ACML's LAPACK features, you have to issue (as root):"
	einfo "\n\t/usr/bin/eselect lapack set ACML"
}