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

EAPI=8

MYP=BertiniSource_v${PV}

inherit toolchain-funcs flag-o-matic

DESCRIPTION="Software for Numerical Algebraic Geometry"
HOMEPAGE="http://bertini.nd.edu"
SRC_URI="https://bertini.nd.edu/${MYP}.tar.gz
	doc? ( https://bertini.nd.edu/BertiniUsersManual.pdf )"
S="${WORKDIR}"/${MYP/./}

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

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

DOCS=( AUTHORS ChangeLog NEWS README )

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)/" src/Makefile || die

	if ! use optimization ; then
		sed -i -e "s/\$(OPT)/ ${CFLAGS} ${CXXFLAGS} ${LDFLAGS}/" src/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}/" src/Makefile || die
	fi
}

src_configure() {
	econf --prefix=/usr --includedir=/usr/include/${PN}

	use doc && DOCS+=( "${DISTDIR}"/BertiniUsersManual.pdf )
}

src_install() {
	emake DESTDIR="${D}" install

	find "${ED}" -name "*.la" -delete || die

	einstalldocs
}