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

EAPI=8

# ninja doesn't like "-lcblas" so using make.
CMAKE_MAKEFILE_GENERATOR="emake"
PYTHON_COMPAT=( python3_{7..10} )
inherit cmake python-any-r1

DESCRIPTION="Fast Library for Number Theory"
HOMEPAGE="http://www.flintlib.org/"

# flintlib.org tarballs have been broken in the past, Bill Hart suggests
# we get them from Github (which he has control over).
SRC_URI="https://github.com/wbhart/flint2/archive/refs/tags/v${PV}.tar.gz
	-> ${P}.tar.gz"

LICENSE="LGPL-2.1+"

# Based off the soname, e.g. /usr/lib64/libflint.so -> libflint.so.15
SLOT="0/16"

KEYWORDS="amd64 ~arm ~arm64 ~ppc ~riscv ~x86"
IUSE="doc ntl test"

RESTRICT="!test? ( test )"

BDEPEND="doc? (
	dev-python/sphinx
	app-text/texlive-core
	dev-texlive/texlive-latex
	dev-texlive/texlive-latexextra
	dev-tex/latexmk
	)
	${PYTHON_DEPS}"
DEPEND="dev-libs/gmp:=
	dev-libs/mpfr:=
	ntl? ( dev-libs/ntl:= )
	virtual/cblas"
RDEPEND="${DEPEND}"

S="${WORKDIR}/flint2-${PV}"

src_configure() {
	local mycmakeargs=(
		-DWITH_NTL="$(usex ntl)"
		-DBUILD_TESTING="$(usex test)"
		-DBUILD_DOCS="$(usex doc)"
		-DCBLAS_INCLUDE_DIRS="${EPREFIX}/usr/include"
		-DCBLAS_LIBRARIES="-lcblas"
	)

	cmake_src_configure

	if use doc ; then
		HTML_DOCS="${BUILD_DIR}/html/*"
		DOCS=(
			"${S}"/README
			"${S}"/AUTHORS
			"${S}"/NEWS
			"${BUILD_DIR}"/latex/Flint.pdf
		)
	fi
}

src_compile() {
	cmake_src_compile

	if use doc ; then
		cmake_build html
		cmake_build pdf
	fi
}