summaryrefslogtreecommitdiff
blob: 39ad93accf73852b35ee8a55939be46c09d562f7 (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
# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

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

MY_P="${PN}${PV}"

DESCRIPTION="Display molecular density from GAMESS-UK, GAMESS-US, GAUSSIAN and Mopac/Ampac"
HOMEPAGE="https://www.theochem.ru.nl/molden/"
SRC_URI="ftp://ftp.science.ru.nl/pub/Molden/${MY_P}.tar.gz"
S="${WORKDIR}/${MY_P}"

LICENSE="MOLDEN"
SLOT="0"
KEYWORDS="amd64 ~x86"
IUSE="opengl"

DEPEND="
	x11-libs/libXmu
	opengl? (
		media-libs/freeglut
		virtual/opengl
		virtual/glu
	)
"
RDEPEND="${DEPEND}
	sci-chemistry/surf
"

PATCHES=(
	"${FILESDIR}/${P}-ldflags.patch"
)

src_prepare() {
	default
	sed 's:shell g77:shell $(FC):g' -i makefile || die
}

src_compile() {
	local args=()

	# Use -mieee on alpha, according to the Makefile
	use alpha && append-flags -mieee

	# GCC 10 workaround
	# bug #724556
	append-fflags $(test-flags-FC -fallow-argument-mismatch)

	args=(
		CC="$(tc-getCC) ${CFLAGS}"
		FC="$(tc-getFC)"
		LDR="$(tc-getFC)"
		FFLAGS="${FFLAGS}"
	)

	einfo "Building Molden..."
	emake -j1 molden ambfor/ambfor ambfor/ambmd "${args[@]}"
	if use opengl ; then
		einfo "Building Molden OpenGL helper..."
		emake -j1 "${args[@]}" gmolden
	fi
}

src_install() {
	dobin bin/molden bin/ambfor bin/ambmd
	if use opengl; then
		dobin bin/gmolden
		doicon -s 64 haux/gmolden.png
		make_desktop_entry gmolden MOLDEN gmolden
	fi

	dodoc HISTORY README REGISTER
	cd doc || die
	uncompress * && dodoc *
}