aboutsummaryrefslogtreecommitdiff
blob: 53a77dc1de387ef942dccac57e5c06e6d30c42bb (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
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI=3

inherit eutils fortran-2 multilib

DESCRIPTION="Calculates maximally localized Wannier functions (MLWFs)"
HOMEPAGE="http://www.wannier.org/"
SRC_URI="http://wannier.org/code/${P}.tar.gz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~x86 ~amd64-linux"
IUSE="doc examples perl test"

RDEPEND="
	virtual/blas
	virtual/lapack
	perl? ( dev-lang/perl )"
DEPEND="${RDEPEND}
		doc? ( virtual/latex-base
			|| (
				dev-texlive/texlive-latexextra
				app-text/tetex
				app-tex/ptex
			)
		)"

src_prepare() {
	# Patch taken from sci-physics/abinit-5.7.3 bundled version
	epatch \
		"${FILESDIR}"/${PN}-1.1-0001.patch \
		"${FILESDIR}"/${PN}-1.1-0002.patch
}

src_configure() {
	cat <<- EOF >> "${S}"/make.sys
		F90 = $(tc-getFC)
		FCOPTS = ${FCFLAGS:- ${FFLAGS:- -O2}}
		LDOPTS = ${LDFLAGS}
		LIBS = $(pkg-config --libs blas lapack)
	EOF
}

src_compile() {
	emake -j1 wannier || die "make wannier failed"
	emake -j1 lib || die "make lib failed"
	if use doc; then
		emake -j1 doc || die "make doc failed"
	fi
}

src_test() {
	einfo "Compare the 'Standard' and 'Current' outputs of this test."
	pushd tests
	emake test || die
	cat wantest.log
}

src_install() {
	dobin wannier90.x || die "Wannier executable cannot be installed"
	if use perl; then
		( cd utility; dobin kmesh.pl )
	fi
	dolib.a libwannier.a || die "libwannier.a cannot be installed"
	insinto /usr/$(get_libdir)/finclude
	doins src/*.mod || die
	if use examples; then
		mkdir -p "${D}"/usr/share/${PN}
		cp -r examples "${D}"/usr/share/${PN}/;
	fi
	if use doc; then
		(cd doc; dodoc *.pdf )
	fi
	dodoc README README.install CHANGE.log
}