1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
8 inherit flag-o-matic fortran-2 toolchain-funcs versionator multibuild multilib-minimal
10 DESCRIPTION="Fast C library for the Discrete Fourier Transform"
11 HOMEPAGE="http://www.fftw.org/"
13 MY_P=${PN}-${PV/_p/-pl}
15 if [[ ${PV} = *9999 ]]; then
16 inherit autotools git-r3
17 EGIT_REPO_URI="https://github.com/FFTW/fftw3.git"
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"
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 )"
29 mpi? ( >=virtual/mpi-2.0-r4[${MULTILIB_USEDEP}] )"
31 test? ( dev-lang/perl )"
34 HTML_DOCS=( doc/html/. )
37 [[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
41 if [[ ${MERGE_TYPE} != binary ]] && use openmp; then
48 MULTIBUILD_VARIANTS=( single double longdouble )
51 ewarn "quad precision only available for gcc >= 4.6"
52 die "need quad precision capable gcc"
54 MULTIBUILD_VARIANTS+=( quad )
61 # fix info file for category directory
62 if [[ ${PV} = *9999 ]]; then
64 's/Texinfo documentation system/Libraries/' \
65 doc/fftw3."info" || die "failed to fix info file"
71 multilib_src_configure() {
72 # jlec reported USE=quad on abi_x86_32 has too few registers
74 if [[ ${MULTILIB_ABI_FLAG} == abi_x86_32 && ${MULTIBUILD_ID} == quad-* ]]; then
75 mkdir -p "${BUILD_DIR}/tests" || die
76 echo "all: ;" > "${BUILD_DIR}/Makefile" || die
77 echo "install: ;" >> "${BUILD_DIR}/Makefile" || die
78 echo "smallcheck: ;" > "${BUILD_DIR}/tests/Makefile" || die
84 $(use_enable static-libs static)
85 $(use_enable "cpu_flags_x86_fma$(usex cpu_flags_x86_fma3 3 4)" fma)
87 $(use_enable zbus mips-zbus-timer)
91 case "${MULTIBUILD_ID}" in
93 # altivec, sse, single-paired only work for single
97 $(use_enable cpu_flags_x86_avx avx)
98 $(use_enable cpu_flags_x86_avx2 avx2)
99 $(use_enable cpu_flags_x86_sse sse)
100 $(use_enable cpu_flags_x86_sse2 sse2)
108 $(use_enable cpu_flags_x86_avx avx)
109 $(use_enable cpu_flags_x86_avx2 avx2)
110 $(use_enable cpu_flags_x86_sse2 sse2)
123 # quad does not support mpi
125 --enable-quad-precision
130 die "${MULTIBUILD_ID%-*} precision not implemented in this ebuild"
134 ECONF_SOURCE="${S}" econf "${myconf[@]}" MPICC="$(tc-getCC) -lmpi"
138 multibuild_foreach_variant multilib-minimal_src_configure
142 multibuild_foreach_variant multilib-minimal_src_compile
145 multilib_src_test() {
146 emake -C tests smallcheck
150 # We want this to be a reasonably quick test, but that is still hard...
151 ewarn "This test series will take 30 minutes on a modern 2.5Ghz machine"
152 # Do not increase the number of threads, it will not help your performance
153 # local testbase="perl check.pl --nthreads=1 --estimate"
154 # ${testbase} -${p}d || die "Failure: $n"
156 multibuild_foreach_variant multilib-minimal_src_test
160 multibuild_foreach_variant multilib-minimal_src_install
166 dodoc -r doc/FAQ/fftw-faq.html/.
168 rm -r "${ED%/}"/usr/share/doc/${PF}/html || die
172 for x in "${ED%/}"/usr/lib*/pkgconfig/*.pc; do
174 for u in $(usev mpi) $(usev threads) $(usex openmp omp ""); do
175 sed -e "s|-lfftw3[flq]\?|&_${u} &|" "$x" > "${x%.pc}_${u}.pc" || die
179 # fftw uses pkg-config to record its private dependencies
180 find "${D}" -name '*.la' -delete || die