blob: 59c2ae382e83ecbd9adc119a0fb95f4dff2684d1 (
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
|
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
EAPI=4
inherit eutils toolchain-funcs flag-o-matic
MYP=MUMPS_${PV}
DESCRIPTION="MUltifrontal Massively Parallel sparse direct matrix Solver"
HOMEPAGE="http://mumps.enseeiht.fr/"
SRC_URI="${HOMEPAGE}${MYP}.tar.gz"
LICENSE="public-domain"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="doc examples metis mpi +scotch static-libs"
RDEPEND="virtual/blas
virtual/metis[mpi?]
scotch? ( sci-libs/scotch[mpi?] )
mpi? ( virtual/scalapack )"
DEPEND="${RDEPEND}
dev-util/pkgconfig"
S="${WORKDIR}/${MYP}"
make_shared_lib() {
local libstatic=${1}
local soname=$(basename "${1%.a}").so.$(get_major_version)
shift
einfo "Making ${soname}"
${LINK:-$(tc-getCC)} ${LDFLAGS} \
-shared -Wl,-soname="${soname}" \
-Wl,--whole-archive "${libstatic}" -Wl,--no-whole-archive \
"$@" -o $(dirname "${libstatic}")/"${soname}" || die "${soname} failed"
}
src_prepare() {
sed -e "s:\(CC\s*=\).*:\1$(tc-getCC):" \
-e "s:\(FC\s*=\).*:\1$(tc-getFC):" \
-e "s:\(FL\s*=\).*:\1$(tc-getFC):" \
-e "s:\(AR\s*=\).*:\1$(tc-getAR) rv :" \
-e "s:\(RANLIB\s*=\).*:\1$(tc-getRANLIB):" \
-e "s:\(LIBBLAS\s*=\).*:\1$(pkg-config --libs blas):" \
-e "s:\(INCPAR\s*=\).*:\1:" \
-e 's:\(LIBPAR\s*=\).*:\1$(SCALAP):' \
-e "s:\(OPTF\s*=\).*:\1${FFLAGS}:" \
-e "s:\(OPTC\s*=\).*:\1${CFLAGS}:" \
-e "s:\(OPTL\s*=\).*:\1${LDFLAGS}:" \
Make.inc/Makefile.inc.generic > Makefile.inc || die
}
src_configure() {
LIBS="$(pkg-config --libs blas) -Llib -lpord"
local ord="-Dpord"
if use metis && use mpi; then
sed -i \
-e "s:#\s*\(LMETIS\s*=\).*:\1$(pkg-config --libs metis-mpi):" \
-e "s:#\s*\(IMETIS\s*=\).*:\1$(pkg-config --cflags metis-mpi):" \
Makefile.inc || die
LIBS="${LIBS} $(pkg-config --libs metis-mpi)"
ord="${ord} -Dparmetis"
elif use metis; then
sed -i \
-e "s:#\s*\(LMETIS\s*=\).*:\1$(pkg-config --libs metis):" \
-e "s:#\s*\(IMETIS\s*=\).*:\1$(pkg-config --cflags metis):" \
Makefile.inc || die
LIBS="${LIBS} $(pkg-config --libs metis)"
ord="${ord} -Dmetis"
fi
if use scotch && use mpi; then
sed -i \
-e "s:\(LSCOTCH\s*=\).*:\1-lptesmumps -lptscotch -lptscotcherr:" \
-e "s:\(ISCOTCH\s*=\).*:\1${ED}/usr/include/scotch:" \
Makefile.inc || die
LIBS="${LIBS} -lptesmumps -lptscotch -lptscotcherr"
ord="${ord} -Dptscotch"
elif use scotch; then
sed -i \
-e "s:\(LSCOTCH\s*=\).*:\1-lesmumps -lscotch -lscotcherr:" \
-e "s:\(ISCOTCH\s*=\).*:\1${ED}/usr/include/scotch:" \
Makefile.inc || die
LIBS="${LIBS} -lesmumps -lscotch -lscotcherr"
ord="${ord} -Dscotch"
fi
if use mpi; then
sed -i \
-e "s:\(CC\s*=\).*:\1mpicc:" \
-e "s:\(FC\s*=\).*:\1mpif90:" \
-e "s:\(FL\s*=\).*:\1mpif90:" \
-e "s:\(SCALAP\s*=\).*:\1$(pkg-config --libs scalapack):" \
Makefile.inc || die
export LINK=mpif90
LIBS="${LIBS} $(pkg-config --libs scalapack)"
fi
sed -i -e "s:\(ORDERINGSF\s*=\).*:\1 ${ord}:" Makefile.inc || die
}
src_compile() {
emake alllib OPTF="${FFLAGS} -fPIC" OPTC="${CFLAGS} -fPIC"
make_shared_lib lib/libmumps_common.a ${LIBS}
local i
for i in c d s z; do
make_shared_lib lib/lib${i}mumps.a -Llib -lmumps_common
done
if use static-libs; then
emake clean
emake alllib
fi
}
src_test() {
emake all
local dotest
use mpi && dotest="mpirun -np 2"
${dotest} ./ssimpletest < input_simpletest_real || die
${dotest} ./dsimpletest < input_simpletest_real || die
${dotest} ./csimpletest < input_simpletest_cmplx || die
${dotest} ./zsimpletest < input_simpletest_cmplx || die
einfo "The solution should be (1,2,3,4,5)"
${dotest} ./c_example || die
einfo "The solution should be (1,2)"
}
src_install() {
dolib.so lib/lib*.so
use static-libs && dolib.a lib/lib*.a
dodoc README ChangeLog VERSION
use doc && dodoc doc/*.pdf
if use examples; then
insinto /usr/share/doc/${PF}
doins -r examples
fi
}
|