sci-mathematics/rstudio: Thanks to tomboy-64 for fixing bug Bug 534152 - sci-mathemat...
[gentoo.git] / sys-cluster / hpl / hpl-2.0-r3.ebuild
1 # Copyright 1999-2013 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI=4
6
7 inherit eutils multilib
8
9 DESCRIPTION="A Portable Implementation of the High-Performance Linpack Benchmark for Distributed-Memory Computers"
10 HOMEPAGE="http://www.netlib.org/benchmark/hpl/"
11 SRC_URI="http://www.netlib.org/benchmark/hpl/hpl-${PV}.tar.gz"
12
13 SLOT="0"
14 LICENSE="HPL"
15 KEYWORDS="~x86 ~amd64"
16 IUSE="doc"
17
18 RDEPEND="
19         virtual/blas
20         virtual/lapack
21         virtual/mpi"
22 DEPEND="${DEPEND}
23         virtual/pkgconfig"
24
25 src_prepare() {
26         local a=""
27         local locallib="${EPREFIX}/usr/$(get_libdir)/lib"
28         local localblas="$(for i in $($(tc-getPKG_CONFIG) --libs-only-l blas lapack);do a="${a} ${i/-l/${locallib}}.so "; done; echo ${a})"
29
30         cp setup/Make.Linux_PII_FBLAS Make.gentoo_hpl_fblas_x86 || die
31         sed -i \
32                 -e "/^TOPdir/s,= .*,= ${S}," \
33                 -e '/^HPL_OPTS\>/s,=,= -DHPL_DETAILED_TIMING -DHPL_COPY_L,' \
34                 -e '/^ARCH\>/s,= .*,= gentoo_hpl_fblas_x86,' \
35                 -e '/^MPdir\>/s,= .*,=,' \
36                 -e '/^MPlib\>/s,= .*,=,' \
37                 -e "/^LAlib\>/s,= .*,= ${localblas}," \
38                 -e '/^LINKER\>/s,= .*,= mpicc,' \
39                 -e '/^CC\>/s,= .*,= mpicc,' \
40                 -e '/^CCFLAGS\>/s|= .*|= $(HPL_DEFS) ${CFLAGS}|' \
41                 -e "/^LINKFLAGS\>/s|= .*|= ${LDFLAGS}|" \
42                 Make.gentoo_hpl_fblas_x86 || die
43 }
44
45 src_compile() {
46         # parallel make failure bug #321539
47         HOME=${WORKDIR} emake -j1 arch=gentoo_hpl_fblas_x86
48 }
49
50 src_install() {
51         dobin bin/gentoo_hpl_fblas_x86/xhpl
52         dolib lib/gentoo_hpl_fblas_x86/libhpl.a
53         dodoc INSTALL BUGS COPYRIGHT HISTORY README TUNING \
54                 bin/gentoo_hpl_fblas_x86/HPL.dat
55         doman man/man3/*.3
56         if use doc; then
57                 dohtml -r www/*
58         fi
59 }
60
61 pkg_postinst() {
62         einfo "Remember to copy /usr/share/hpl/HPL.dat to your working directory"
63         einfo "before running xhpl.  Typically one may run hpl by executing:"
64         einfo "\"mpiexec -np 4 /usr/bin/xhpl\""
65         einfo "where -np specifies the number of processes."
66 }