Gentoo Archives: gentoo-commits

From: Florian Schmaus <flow@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/proj/guru:master commit in: dev-util/fpm/
Date: Sat, 26 Nov 2022 10:54:40
Message-Id: 1669446771.0e12c2266a4dd55e9df23841d9f430d69e5a2a05.flow@gentoo
1 commit: 0e12c2266a4dd55e9df23841d9f430d69e5a2a05
2 Author: Sergey Torokhov <torokhov-s-a <AT> yandex <DOT> ru>
3 AuthorDate: Sat Nov 26 07:12:51 2022 +0000
4 Commit: Florian Schmaus <flow <AT> gentoo <DOT> org>
5 CommitDate: Sat Nov 26 07:12:51 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=0e12c226
7
8 dev-util/fpm: add USE=openmp to build targets in parallel where possible
9
10 Signed-off-by: Sergey Torokhov <torokhov-s-a <AT> yandex.ru>
11
12 dev-util/fpm/fpm-0.7.0.ebuild | 24 +++++++++++++++++++++---
13 dev-util/fpm/metadata.xml | 3 +++
14 2 files changed, 24 insertions(+), 3 deletions(-)
15
16 diff --git a/dev-util/fpm/fpm-0.7.0.ebuild b/dev-util/fpm/fpm-0.7.0.ebuild
17 index 2d1f62b6a..60e532ebc 100644
18 --- a/dev-util/fpm/fpm-0.7.0.ebuild
19 +++ b/dev-util/fpm/fpm-0.7.0.ebuild
20 @@ -19,7 +19,7 @@ SRC_URI="
21 LICENSE="MIT"
22 SLOT="0"
23 KEYWORDS="~amd64 ~x86"
24 -IUSE="doc"
25 +IUSE="openmp doc"
26 RESTRICT="test"
27
28 CDEPEND="
29 @@ -48,9 +48,27 @@ PATCHES="${FILESDIR}/${P}_fpm_toml.patch"
30
31 BSDIR="build/bootstrap" # Bootstrap directory path
32
33 +pkg_pretend() {
34 + [[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
35 +}
36 +
37 +set_omp_flag() {
38 + OMPFLAG=""
39 + if use openmp ; then
40 + case $(tc-getFC) in
41 + *gfortran* )
42 + OMPFLAG="-fopenmp" ;;
43 + * )
44 + die "Sorry, only GNU gfortran is currently supported in the ebuild" ;;
45 + esac
46 + fi
47 +}
48 +
49 pkg_setup() {
50 + [[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
51 fortran-2_pkg_setup
52 python-any-r1_pkg_setup
53 + set_omp_flag
54 }
55
56 src_prepare() {
57 @@ -70,7 +88,7 @@ src_compile() {
58 "$(tc-getFC)" -J "${BSDIR}" -o "${BSDIR}"/fpm "${BSDIR}/${P}.F90" || die
59
60 # Use the bootstrap binary to build the feature complete fpm version
61 - "${BSDIR}"/fpm build --compiler "$(tc-getFC)" --flag "${FCFLAGS} -I/usr/include/toml-f -I/usr/include/m_cli2" \
62 + "${BSDIR}"/fpm build --compiler "$(tc-getFC)" --flag "${FCFLAGS} ${OMPFLAG} -I/usr/include/toml-f -I/usr/include/m_cli2" \
63 --c-compiler "$(tc-getCC)" --c-flag "${CFLAGS}" \
64 --cxx-compiler "$(tc-getCXX)" --cxx-flag "${CXXFLAGS}" \
65 --archiver="$(tc-getAR)" --link-flag "${LDFLAGS}"
66 @@ -84,7 +102,7 @@ src_compile() {
67 src_install() {
68 # Set prefix and pass all used env flags to avoid recompiling with default values
69 "${BSDIR}"/fpm install --prefix "${ED}/usr" \
70 - --compiler "$(tc-getFC)" --flag "${FCFLAGS} -I/usr/include/toml-f -I/usr/include/m_cli2" \
71 + --compiler "$(tc-getFC)" --flag "${FCFLAGS} ${OMPFLAG} -I/usr/include/toml-f -I/usr/include/m_cli2" \
72 --c-compiler "$(tc-getCC)" --c-flag "${CFLAGS}" \
73 --cxx-compiler "$(tc-getCXX)" --cxx-flag "${CXXFLAGS}" \
74 --archiver="$(tc-getAR)" --link-flag "${LDFLAGS}"
75
76 diff --git a/dev-util/fpm/metadata.xml b/dev-util/fpm/metadata.xml
77 index f45acb901..fac9ec00a 100644
78 --- a/dev-util/fpm/metadata.xml
79 +++ b/dev-util/fpm/metadata.xml
80 @@ -5,6 +5,9 @@
81 <email>torokhov-s-a@××××××.ru</email>
82 <name>Sergey Torokhov</name>
83 </maintainer>
84 + <use>
85 + <flag name="openmp">OpenMP support to build targets in parallel where possible</flag>
86 + </use>
87 <upstream>
88 <remote-id type="github">fortran-lang/fpm</remote-id>
89 </upstream>