Skip to content

Commit 67a3fff

Browse files
committed
sci-libs/fftw: fix build with mpich
Closes: https://bugs.gentoo.org/699650 Package-Manager: Portage-2.3.89, Repoman-2.3.20 Signed-off-by: Christoph Junghans <[email protected]>
1 parent 05682a6 commit 67a3fff

File tree

2 files changed

+196
-20
lines changed

2 files changed

+196
-20
lines changed

sci-libs/fftw/fftw-3.3.8-r1.ebuild

+182
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
# Copyright 1999-2020 Gentoo Authors
2+
# Distributed under the terms of the GNU General Public License v2
3+
4+
EAPI=6
5+
6+
FORTRAN_NEEDED=fortran
7+
8+
inherit flag-o-matic fortran-2 multibuild multilib-minimal toolchain-funcs
9+
10+
DESCRIPTION="Fast C library for the Discrete Fourier Transform"
11+
HOMEPAGE="http://www.fftw.org/"
12+
13+
MY_P=${PN}-${PV/_p/-pl}
14+
15+
if [[ ${PV} = *9999 ]]; then
16+
inherit autotools git-r3
17+
EGIT_REPO_URI="https://github.com/FFTW/fftw3.git"
18+
else
19+
SRC_URI="http://www.fftw.org/${PN}-${PV/_p/-pl}.tar.gz"
20+
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
21+
fi
22+
23+
LICENSE="GPL-2+"
24+
SLOT="3.0/3"
25+
IUSE="altivec cpu_flags_x86_avx cpu_flags_x86_avx2 cpu_flags_x86_fma3 cpu_flags_x86_fma4 cpu_flags_x86_sse cpu_flags_x86_sse2 doc fortran mpi neon openmp quad static-libs test threads zbus"
26+
RESTRICT="!test? ( test )"
27+
28+
RDEPEND="
29+
mpi? ( >=virtual/mpi-2.0-r4[${MULTILIB_USEDEP}] )"
30+
DEPEND="${RDEPEND}
31+
quad? ( sys-devel/gcc[fortran] )
32+
test? ( dev-lang/perl )"
33+
34+
S=${WORKDIR}/${MY_P}
35+
HTML_DOCS=( doc/html/. )
36+
37+
pkg_pretend() {
38+
[[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
39+
}
40+
41+
pkg_setup() {
42+
if [[ ${MERGE_TYPE} != binary ]] && use openmp; then
43+
tc-check-openmp
44+
FORTRAN_NEED_OPENMP=1
45+
fi
46+
47+
fortran-2_pkg_setup
48+
49+
MULTIBUILD_VARIANTS=( single double longdouble )
50+
if use quad; then
51+
if ! tc-is-gcc; then
52+
ewarn "quad precision only available for gcc >= 4.6"
53+
die "need quad precision capable gcc"
54+
fi
55+
MULTIBUILD_VARIANTS+=( quad )
56+
fi
57+
}
58+
59+
src_prepare() {
60+
default
61+
62+
# fix info file for category directory
63+
if [[ ${PV} = *9999 ]]; then
64+
sed -i -e
65+
's/Texinfo documentation system/Libraries/' \
66+
doc/fftw3."info" || die "failed to fix info file"
67+
68+
eautoreconf
69+
fi
70+
}
71+
72+
multilib_src_configure() {
73+
# jlec reported USE=quad on abi_x86_32 has too few registers
74+
# stub Makefiles
75+
if [[ ${MULTILIB_ABI_FLAG} == abi_x86_32 && ${MULTIBUILD_ID} == quad-* ]]; then
76+
mkdir -p "${BUILD_DIR}/tests" || die
77+
echo "all: ;" > "${BUILD_DIR}/Makefile" || die
78+
echo "install: ;" >> "${BUILD_DIR}/Makefile" || die
79+
echo "smallcheck: ;" > "${BUILD_DIR}/tests/Makefile" || die
80+
return 0
81+
fi
82+
83+
local myconf=(
84+
--enable-shared
85+
$(use_enable static-libs static)
86+
$(use_enable "cpu_flags_x86_fma$(usex cpu_flags_x86_fma3 3 4)" fma)
87+
$(use_enable fortran)
88+
$(use_enable zbus mips-zbus-timer)
89+
$(use_enable threads)
90+
$(use_enable openmp)
91+
)
92+
case "${MULTIBUILD_ID}" in
93+
single-*)
94+
# altivec, sse, single-paired only work for single
95+
myconf+=(
96+
--enable-single
97+
$(use_enable altivec)
98+
$(use_enable cpu_flags_x86_avx avx)
99+
$(use_enable cpu_flags_x86_avx2 avx2)
100+
$(use_enable cpu_flags_x86_sse sse)
101+
$(use_enable cpu_flags_x86_sse2 sse2)
102+
$(use_enable neon)
103+
$(use_enable mpi)
104+
)
105+
;;
106+
107+
double-*)
108+
myconf+=(
109+
$(use_enable cpu_flags_x86_avx avx)
110+
$(use_enable cpu_flags_x86_avx2 avx2)
111+
$(use_enable cpu_flags_x86_sse2 sse2)
112+
$(use_enable mpi)
113+
)
114+
;;
115+
116+
longdouble-*)
117+
myconf+=(
118+
--enable-long-double
119+
$(use_enable mpi)
120+
)
121+
;;
122+
123+
quad-*)
124+
# quad does not support mpi
125+
myconf+=(
126+
--enable-quad-precision
127+
)
128+
;;
129+
130+
*)
131+
die "${MULTIBUILD_ID%-*} precision not implemented in this ebuild"
132+
;;
133+
esac
134+
135+
ECONF_SOURCE="${S}" econf "${myconf[@]}" MPICC="$(tc-getCC)"
136+
}
137+
138+
src_configure() {
139+
multibuild_foreach_variant multilib-minimal_src_configure
140+
}
141+
142+
src_compile() {
143+
multibuild_foreach_variant multilib-minimal_src_compile
144+
}
145+
146+
multilib_src_test() {
147+
emake -C tests smallcheck
148+
}
149+
150+
src_test() {
151+
# We want this to be a reasonably quick test, but that is still hard...
152+
ewarn "This test series will take 30 minutes on a modern 2.5Ghz machine"
153+
# Do not increase the number of threads, it will not help your performance
154+
# local testbase="perl check.pl --nthreads=1 --estimate"
155+
# ${testbase} -${p}d || die "Failure: $n"
156+
157+
multibuild_foreach_variant multilib-minimal_src_test
158+
}
159+
160+
src_install() {
161+
multibuild_foreach_variant multilib-minimal_src_install
162+
dodoc CONVENTIONS
163+
164+
if use doc; then
165+
dodoc doc/*.pdf
166+
docinto faq
167+
dodoc -r doc/FAQ/fftw-faq.html/.
168+
else
169+
rm -r "${ED%/}"/usr/share/doc/${PF}/html || die
170+
fi
171+
172+
local x
173+
for x in "${ED%/}"/usr/lib*/pkgconfig/*.pc; do
174+
local u
175+
for u in $(usev mpi) $(usev threads) $(usex openmp omp ""); do
176+
sed -e "s|-lfftw3[flq]\?|&_${u} &|" "$x" > "${x%.pc}_${u}.pc" || die
177+
done
178+
done
179+
180+
# fftw uses pkg-config to record its private dependencies
181+
find "${D}" -name '*.la' -delete || die
182+
}

sci-libs/fftw/fftw-9999.ebuild

+14-20
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ EAPI=6
55

66
FORTRAN_NEEDED=fortran
77

8-
inherit flag-o-matic fortran-2 toolchain-funcs versionator multibuild multilib-minimal
8+
inherit flag-o-matic fortran-2 multibuild multilib-minimal toolchain-funcs
99

1010
DESCRIPTION="Fast C library for the Discrete Fourier Transform"
1111
HOMEPAGE="http://www.fftw.org/"
@@ -17,25 +17,22 @@ if [[ ${PV} = *9999 ]]; then
1717
EGIT_REPO_URI="https://github.com/FFTW/fftw3.git"
1818
else
1919
SRC_URI="http://www.fftw.org/${PN}-${PV/_p/-pl}.tar.gz"
20-
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
20+
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
2121
fi
2222

2323
LICENSE="GPL-2+"
2424
SLOT="3.0/3"
25-
IUSE="cpu_flags_ppc_altivec cpu_flags_x86_avx cpu_flags_x86_avx2 cpu_flags_x86_fma3 cpu_flags_x86_fma4 cpu_flags_x86_sse cpu_flags_x86_sse2 doc fortran mpi neon openmp quad static-libs test threads zbus"
25+
IUSE="altivec cpu_flags_x86_avx cpu_flags_x86_avx2 cpu_flags_x86_fma3 cpu_flags_x86_fma4 cpu_flags_x86_sse cpu_flags_x86_sse2 doc fortran mpi neon openmp quad static-libs test threads zbus"
2626
RESTRICT="!test? ( test )"
2727

2828
RDEPEND="
2929
mpi? ( >=virtual/mpi-2.0-r4[${MULTILIB_USEDEP}] )"
3030
DEPEND="${RDEPEND}
31+
quad? ( sys-devel/gcc[fortran] )
3132
test? ( dev-lang/perl )"
32-
if [[ ${PV} = *9999 ]]; then
33-
DEPEND="${DEPEND}
34-
dev-ml/ocamlbuild
35-
doc? ( media-gfx/transfig )"
36-
fi
3733

3834
S=${WORKDIR}/${MY_P}
35+
HTML_DOCS=( doc/html/. )
3936

4037
pkg_pretend() {
4138
[[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
@@ -64,6 +61,10 @@ src_prepare() {
6461

6562
# fix info file for category directory
6663
if [[ ${PV} = *9999 ]]; then
64+
sed -i -e
65+
's/Texinfo documentation system/Libraries/' \
66+
doc/fftw3."info" || die "failed to fix info file"
67+
6768
eautoreconf
6869
fi
6970
}
@@ -81,7 +82,6 @@ multilib_src_configure() {
8182

8283
local myconf=(
8384
--enable-shared
84-
$([[ ${PV} = *9999 ]] && echo "--enable-maintainer-mode")
8585
$(use_enable static-libs static)
8686
$(use_enable "cpu_flags_x86_fma$(usex cpu_flags_x86_fma3 3 4)" fma)
8787
$(use_enable fortran)
@@ -94,7 +94,7 @@ multilib_src_configure() {
9494
# altivec, sse, single-paired only work for single
9595
myconf+=(
9696
--enable-single
97-
$(use_enable cpu_flags_ppc_altivec altivec)
97+
$(use_enable altivec)
9898
$(use_enable cpu_flags_x86_avx avx)
9999
$(use_enable cpu_flags_x86_avx2 avx2)
100100
$(use_enable cpu_flags_x86_sse sse)
@@ -132,22 +132,15 @@ multilib_src_configure() {
132132
;;
133133
esac
134134

135-
local MY_S="${S}"
136-
#out-of-source build is broken for 9999 due to maintainer mode
137-
if [[ ${PV} = *9999 ]]; then
138-
cp -al "${S}"/* "${BUILD_DIR}"/
139-
MY_S="${BUILD_DIR}"
140-
fi
141-
142-
ECONF_SOURCE="${MY_S}" econf "${myconf[@]}" MPICC="$(tc-getCC) -lmpi"
135+
ECONF_SOURCE="${S}" econf "${myconf[@]}" MPICC="$(tc-getCC)"
143136
}
144137

145138
src_configure() {
146139
multibuild_foreach_variant multilib-minimal_src_configure
147140
}
148141

149142
src_compile() {
150-
multibuild_foreach_variant multilib-minimal_src_compile all $([[ ${PV} = *9999 ]] && usev doc)
143+
multibuild_foreach_variant multilib-minimal_src_compile
151144
}
152145

153146
multilib_src_test() {
@@ -165,14 +158,15 @@ src_test() {
165158
}
166159

167160
src_install() {
168-
use doc && HTML_DOCS=( doc/html/. )
169161
multibuild_foreach_variant multilib-minimal_src_install
170162
dodoc CONVENTIONS
171163

172164
if use doc; then
173165
dodoc doc/*.pdf
174166
docinto faq
175167
dodoc -r doc/FAQ/fftw-faq.html/.
168+
else
169+
rm -r "${ED%/}"/usr/share/doc/${PF}/html || die
176170
fi
177171

178172
local x

0 commit comments

Comments
 (0)