aboutsummaryrefslogtreecommitdiff
blob: 3e4c56274b55e8f6f8dd3270298e6c8310c60140 (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
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI="7"

inherit flag-o-matic fortran-2 toolchain-funcs

DESCRIPTION="Jacobi-Davidson type method for the generalized standard eigenvalue problem."
HOMEPAGE="https://www.win.tue.nl/~hochsten/jd/"
SRC_URI="https://www.win.tue.nl/~hochsten/jd/${PN}.tar.gz -> ${P}.tar.gz"

LICENSE="GPL-3"
SLOT="0"
KEYWORDS="~amd64"

IUSE="doc"

# vvirtual/lapack does not pull in [deprecated] so we have to deal with this mess like this until it does
DEPEND="
	virtual/blas
	virtual/lapack
	|| ( sci-libs/openblas sci-libs/lapack[deprecated] )
"
RDEPEND="${DEPEND}"
BDEPEND="doc? ( dev-texlive/texlive-latex )"

S="${WORKDIR}/${PN}"

src_prepare() {
	libs="$($(tc-getPKG_CONFIG) --libs blas)"
	libs+=" $($(tc-getPKG_CONFIG) --libs lapack)"

	export libs

	sed -i 's/f77/${F77}/g' jdtest/Makefile || die
	sed -i '/FFLAGS/d' jdtest/Makefile || die
	sed -i 's/-u -O/-u ${FFLAGS}/g' jdtest/Makefile || die

	sed -i "s/-llapack -lblas/${libs}/" jdtest/Makefile || die

	default
}

src_compile() {
	if use doc; then
		pdflatex manual.tex || die
	fi

	cd "jdlib" || die

	echo "$(fc-getFC)" *.f "${FFLAGS} -shared -fPIC -Wl,-soname,libjdqz.so.0 -lm ${libs} ${LDFLAGS} -o libjdqz.so.0" > make.sh || die

	bash make.sh || die
	ln -s libjdqz.so.0 libjdqz.so || die
}

src_test() {
	cd "jdtest" || die
	emake
	cd ".." || die
	LD_LIBRARY_PATH="./jdlib" ./jdtest/example || die
}

src_install() {
	dolib.so jdlib/libjdqz.so
	dolib.so jdlib/libjdqz.so.0

	use doc && dodoc manual.pdf
}