summaryrefslogtreecommitdiff
path: root/dev-libs/ftl/ftl-1.0_p20260211.ebuild
blob: dacff4b8738f3f94e2cd72f7d629c3ed35325d35 (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
# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

FORTRAN_STANDARD="2003"
inherit flag-o-matic fortran-2 toolchain-funcs

COMMIT="f1f0c3845f7822cba61f07a285ceee37c4a1426b"
DESCRIPTION="The Fortran Template Library (FTL) is a general purpose library for Fortran 2003"
HOMEPAGE="https://github.com/SCM-NV/ftl"
SRC_URI="https://github.com/SCM-NV/${PN}/archive/${COMMIT}.tar.gz -> ${P}.tar.gz"
S="${WORKDIR}/${PN}-${COMMIT}"

LICENSE="LGPL-3"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="pcre test"
RESTRICT="!test? ( test )"
REQUIRED_USE="test? ( pcre )" # Some tests fail if 'pcre' is disabled

RDEPEND="pcre? ( dev-libs/libpcre:3 )"
DEPEND="${RDEPEND}"
BDEPEND="virtual/pkgconfig"

# Checking of supported fortran standard version is required here
pkg_setup() {
	fortran-2_pkg_setup
}

get_platform() {
	case $(tc-getFC) in
		*gfortran*) echo "gnu" ;;
		*ifort*) echo "intel" ;;
		*nagfor*) echo "nag" ;;
		*) die "Unsupported compiler: $(tc-getFC)" ;;
	esac
}

src_prepare() {
	default

	# Pass LDFLAGS to respect it
	sed -i '/SOLDFLAGS =/ s/$/ '"${LDFLAGS}"'/' makefile || die
}

src_configure() {
	filter-flags -fpch-preprocess
}

src_compile() {
	emake_args=(
		FC=$(tc-getFC)
		CXX=$(tc-getCXX)
		PLATFORM=$(get_platform)
		BUILD=custom
		USE_PCRE=$(usex pcre true false)
	)

	emake "${emake_args[@]}"
}

src_test() {
	emake_args=(
		FC=$(tc-getFC)
		CXX=$(tc-getCXX)
		PLATFORM=$(get_platform)
		BUILD=custom
		USE_PCRE=$(usex pcre true false)
	)

	emake "${emake_args[@]}" test
}

src_install() {
	# Set BUILD to custom as default type is debug
	emake BUILD=custom DESTDIR="${D}" PREFIX="${EPREFIX}"/usr LIBDIR=$(get_libdir) install
	einstalldocs
}