aboutsummaryrefslogtreecommitdiff
blob: e21cbaf16d04b40d535db1a9b8d49167fe24ffd1 (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-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

FORTRAN_STANDARD="2003"
PYTHON_COMPAT=( python3_{10..11} )

inherit cmake fortran-2 git-r3 python-any-r1

EGIT_REPO_URI="https://github.com/fortran-lang/stdlib.git"
SRC_URI=""

DESCRIPTION="A community driven standard library for (modern) Fortran"
HOMEPAGE="https://stdlib.fortran-lang.org/"

LICENSE="MIT"
SLOT="0"
IUSE="doc test"
RESTRICT="mirror !test? ( test )"

DEPEND="
	${PYTHON_DEPS}
	$(python_gen_any_dep '
		dev-util/fypp[${PYTHON_USEDEP}]
	')
	doc? (
		$(python_gen_any_dep '
			app-doc/ford[${PYTHON_USEDEP}]
		')
	)
	test? ( dev-util/fortran-test-drive )
"

pkg_setup() {
	fortran-2_pkg_setup
}

src_prepare() {
	default

	# Remove Fortran compiler version from paths
	sed -i -e "s:/\${CMAKE_Fortran_COMPILER_ID}-\${CMAKE_Fortran_COMPILER_VERSION}::" config/CMakeLists.txt || die

	cmake_src_prepare
}

src_configure() {
	local mycmakeargs+=(
		-DBUILD_SHARED_LIBS=on
		-DBUILD_TESTING=$(usex test)
	)
	cmake_src_configure
}

src_compile() {
	cmake_src_compile

	if use doc ; then
		einfo "Build API documentation:"
		${EPYTHON} ford API-doc-FORD-file.md || die
	fi
}

src_test() {
	LD_LIBRARY_PATH="${BUILD_DIR}/src:${BUILD_DIR}/src/tests/hash_functions" cmake_src_test
}

src_install() {
	cmake_src_install

	use doc && HTML_DOCS=( "${WORKDIR}/${P}"/API-doc/. )
	einstalldocs
}