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

EAPI=7

inherit toolchain-funcs flag-o-matic

MYP="BertiniSource_v${PV}"
DESCRIPTION="Software for Numerical Algebraic Geometry"
HOMEPAGE="http://bertini.nd.edu"
SRC_URI="http://www3.nd.edu/~sommese/bertini/${MYP}.tar.gz"
S="${WORKDIR}/${MYP}/src"

LICENSE="bertini"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="doc examples +optimization"

BDEPEND="
	app-alternatives/yacc
	app-alternatives/lex
"
RDEPEND="
	dev-libs/gmp
	dev-libs/mpfr
"
DEPEND="${RDEPEND}"

src_prepare() {
	default

	# bug #723328
	append-cflags -fcommon

	# Ensure this is before the CFLAGS sed
	# or breakage occurs if 'gcc' is in your CFLAGS
	sed -i -e "s/gcc/$(tc-getCC)/" Makefile || die

	if ! use optimization; then
		sed -i -e "s/\$(OPT)/ ${CFLAGS} ${CXXFLAGS} ${LDFLAGS}/" Makefile || die
	else
		# If people want the optimisation offered by upstream,
		# let's ensure they don't accidentally override it.
		filter-flags -O?
		sed -i -e "s/\$(OPT)/ \$(OPT) ${CFLAGS} ${LDFLAGS}/" Makefile || die
	fi
}

src_install() {
	dobin bertini

	if use doc; then
		dodoc "${WORKDIR}/${MYP}/BertiniUsersManual.pdf"
	fi

	if use examples; then
		docinto examples
		dodoc -r "${WORKDIR}/${MYP}/examples"
		elog "Examples have been installed into /usr/share/${MYP}"
	fi
}