aboutsummaryrefslogtreecommitdiff
blob: d7091abae22e5e481a0a5305ad64e5885aa8bbcb (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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

DISTUTILS_OPTIONAL=1
DISTUTILS_USE_PEP517=setuptools
FORTRAN_NEEDED="fortran"
PYTHON_COMPAT=( python3_10 )

inherit distutils-r1 cmake flag-o-matic fortran-2

DESCRIPTION="MUlticomponent Thermodynamic And Transport library for IONized gases"
HOMEPAGE="https://github.com/mutationpp/Mutationpp"
SRC_URI="https://github.com/mutationpp/${PN}/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz"

KEYWORDS="~amd64"
LICENSE="LGPL-3"
SLOT="0/${PV}"
IUSE="doc fortran python test"

RDEPEND="
	dev-cpp/eigen
	python? (
		${PYTHON_DEPS}
		dev-python/numpy[${PYTHON_USEDEP}]
	)
"
DEPEND="
	${RDEPEND}
	test? ( dev-cpp/catch:0 )
	python? (
		dev-python/pybind11[${PYTHON_USEDEP}]
		>=dev-python/scikit-build-0.11.1[${PYTHON_USEDEP}]
		dev-python/wheel[${PYTHON_USEDEP}]
	)
"
BDEPEND="
	dev-util/ninja
	dev-util/cmake
	doc? ( app-doc/doxygen )
	python? ( ${DISTUTILS_DEPS} )
"

REQUIRED_USE="${PYTHON_REQUIRED_USE}"
DOCS=( {README,CHANGELOG}.md docs )
PATCHES=(
	"${FILESDIR}/${P}-system-libs.patch"
	"${FILESDIR}/${P}-respect-flags.patch"
)

distutils_enable_tests pytest

src_prepare() {
	rm -r thirdparty || die
	cmake_src_prepare
	use python && python_prepare_all
}

src_configure() {
	append-cxxflags "-I${EPREFIX}/usr/include/catch2"
	local mycmakeargs=(
		-DENABLE_COVERAGE=OFF

		-DBUILD_DOCUMENTATION=$(usex doc)
		-DBUILD_FORTRAN_WRAPPER=$(usex fortran)
		-DBUILD_PYTHON_WRAPPER=$(usex python)
		-DENABLE_TESTING=$(usex test)
	)
	cmake_src_configure
}

src_compile() {
	cmake_src_compile
	use python && python_foreach_impl distutils-r1_python_compile
}

src_install() {
	cmake_src_install
	use python && python_foreach_impl distutils-r1_python_install
	insinto "/usr/share/${PN}"
	doins -r data
	echo MPP_DIRECTORY="/usr/share/${PN}" > "99${PN}"
	echo MPP_DATA_DIRECTORY="/usr/share/${PN}/data" >> "99${PN}"
	doenvd "99${PN}"
}

src_test() {
	export MPP_DIRECTORY="."
	export MPP_DATA_DIRECTORY="${MPP_DATA_DIRECTORY}/data"
	cmake_src_test
	use python && python_foreach_impl distutils-r1_python_test
}