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

EAPI=6

inherit flag-o-matic toolchain-funcs

DESCRIPTION="Object-oriented Scientific Computing Library"
HOMEPAGE="https://web.utk.edu/~asteine1/o2scl/"
SRC_URI="https://github.com/awsteiner/${PN}/releases/download/v${PV}/${P}.tar.gz"

LICENSE="GPL-3"
SLOT="0"
KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
IUSE="armadillo debug doc examples eigen fftw gsl hdf5 openmp readline static-libs"

RDEPEND="
	dev-libs/boost:=
	>=sci-libs/gsl-2:0=
	virtual/cblas:=
	eigen? ( dev-cpp/eigen:3 )
	armadillo? ( sci-libs/armadillo[lapack] )
	fftw? ( sci-libs/fftw:3.0= )
	hdf5? ( sci-libs/hdf5:0= )
	readline? ( sys-libs/readline:0= )
"
DEPEND="${RDEPEND}
	virtual/pkgconfig"

pkg_pretend() {
	[[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
}

pkg_setup() {
	if [[ ${MERGE_TYPE} != binary ]] && use openmp && ! tc-check-openmp; then
		ewarn "OpenMP is not available in your current selected compiler"
		die "need openmp capable compiler"
	fi
}

src_configure() {
	use debug || append-cppflags -DO2SCL_NO_RANGE_CHECK
	econf \
		--enable-acol \
		$(use_enable armadillo) \
		$(use_enable eigen) \
		$(use_enable fftw) \
		$(use_enable gsl gsl2) \
		$(use_enable hdf5 hdf) \
		$(use_enable hdf5 partlib) \
		$(use_enable hdf5 eoslib) \
		$(use_enable openmp) \
		$(use_enable static-libs static)
}

src_install() {
	default

	if ! use static-libs; then
		find "${ED}" -name '*.la' -delete || die
	fi

	rm -r "${ED}"/usr/doc || die
	if use doc; then
		dodoc -r doc/o2scl/html
		docompress -x /usr/share/doc/${PF}/html
	fi
	if use examples; then
		dodoc -r examples
		docompress -x /usr/share/doc/${PF}/examples
	fi
}