summaryrefslogtreecommitdiff
blob: 4a0eab346e4bde730c99a289138fae619d9dfaad (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
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sci-libs/lapack-reference/lapack-reference-3.1.0.ebuild,v 1.7 2007/07/14 00:15:25 nerdboy Exp $

inherit autotools eutils fortran multilib

MyPN="${PN/-reference/}"

DESCRIPTION="FORTRAN reference implementation of LAPACK Linear Algebra PACKage"
LICENSE="BSD"
HOMEPAGE="http://www.netlib.org/lapack/index.html"
SRC_URI="http://www.netlib.org/lapack/${MyPN}-lite-${PV}.tgz"

SLOT="0"
IUSE=""
KEYWORDS="amd64 ppc ppc64 sparc x86"

RDEPEND="virtual/blas
	app-admin/eselect-lapack"

DEPEND="${RDEPEND}"

PROVIDE="virtual/lapack"

FORTRAN="g77 gfortran ifc"

S="${WORKDIR}/${MyPN}-${PV}"

src_unpack() {
	unpack ${A}
	epatch "${FILESDIR}"/${P}-autotool.patch
	cd "${S}"
	eautoreconf

	# set up the testing routines
	cp make.inc.example make.inc || die "Failed to copy make.inc"
	sed -e "s:g77:${FORTRANC}:" \
		-e "s:-funroll-all-loops -O3:${FFLAGS}:" \
		-e "s:LOADOPTS =:LOADOPTS = ${LDFLAGS}:" \
		-e "s:../../blas\$(PLAT).a:/usr/$(get_libdir)/libblas.so:" \
		-e "s:lapack\$(PLAT).a:SRC/.libs/liblapack.a:" \
		-i make.inc || die "Failed to set up make.inc"
}

src_install() {
	TOP_PATH="${DESTTREE}"/$(get_libdir)/lapack
	# Library will be installed in RPATH:
	RPATH="${TOP_PATH}"/reference

	make DESTDIR="${D}" install || die "install failed"

	# Fix for switching
	dodir ${RPATH}
	mv ${D}/usr/$(get_libdir)/liblapack* ${D}/${RPATH}

	dodoc "${S}"/README

	eselect lapack add $(get_libdir) ${FILESDIR}/eselect-reference reference
}

src_test() {
	cd TESTING/MATGEN && emake || die "Failed to create tmglib.a"
	cd ../ && emake || die "lapack-reference tests failed."
}

pkg_postinst() {
	if [[ -z "$(eselect lapack show)" ]]; then
		eselect lapack set reference
	fi

	elog "Configuration now uses eselect rather than lapack-config."
}