1 # Copyright 1999-2016 Gentoo Foundation
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 if [[ ${PV} = *9999 ]]; then
14 inherit autotools git-r3
15 EGIT_REPO_URI="https://github.com/FFTW/fftw3.git"
17 SRC_URI="http://www.fftw.org/${P}.tar.gz"
18 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
23 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"
28 test? ( dev-lang/perl )"
31 if [[ ${MERGE_TYPE} != binary ]] && use openmp; then
32 if ! tc-has-openmp; then
33 ewarn "OpenMP is not available in your current selected compiler"
36 ewarn "OpenMP support in sys-devel/clang is provided by sys-libs/libomp,"
37 ewarn "which you will need to build ${CATEGORY}/${PN} with USE=\"openmp\""
40 die "need openmp capable compiler"
47 MULTIBUILD_VARIANTS=( single double longdouble )
49 if tc-is-gcc && ! version_is_at_least 4.6 $(gcc-version); then
50 ewarn "quad precision only available for gcc >= 4.6"
51 die "need quad precision capable gcc"
53 MULTIBUILD_VARIANTS+=( quad )
60 # fix info file for category directory
61 if [[ ${PV} = *9999 ]]; then
63 's/Texinfo documentation system/Libraries/' \
64 doc/fftw3."info" || die "failed to fix info file"
70 multilib_src_configure() {
71 # there is no abi_x86_32 port of virtual/mpi right now, bug 519700
72 local enable_mpi=$(multilib_native_use_enable mpi)
74 # jlec reported USE=quad on abi_x86_32 has too few registers
76 if [[ ${MULTILIB_ABI_FLAG} == abi_x86_32 && ${MULTIBUILD_ID} == quad-* ]]; then
77 mkdir -p "${BUILD_DIR}/tests" || die
78 echo "all: ;" > "${BUILD_DIR}/Makefile" || die
79 echo "install: ;" >> "${BUILD_DIR}/Makefile" || die
80 echo "smallcheck: ;" > "${BUILD_DIR}/tests/Makefile" || die
86 $(use_enable static-libs static)
87 $(use_enable "cpu_flags_x86_fma$(usex cpu_flags_x86_fma3 3 4)" fma)
89 $(use_enable zbus mips-zbus-timer)
93 case "${MULTIBUILD_ID}" in
95 #altivec, sse, single-paired only work for single
99 $(use_enable cpu_flags_x86_avx avx)
100 $(use_enable cpu_flags_x86_avx2 avx2)
101 $(use_enable cpu_flags_x86_sse sse)
102 $(use_enable cpu_flags_x86_sse2 sse2)
110 $(use_enable cpu_flags_x86_avx avx)
111 $(use_enable cpu_flags_x86_avx2 avx2)
112 $(use_enable cpu_flags_x86_sse2 sse2)
125 #quad does not support mpi
127 --enable-quad-precision
132 die "${MULTIBUILD_ID%-*} precision not implemented in this ebuild"
136 ECONF_SOURCE="${S}" econf "${myconf[@]}"
140 multibuild_foreach_variant multilib-minimal_src_configure
144 multibuild_foreach_variant multilib-minimal_src_compile
147 multilib_src_test() {
148 emake -C tests smallcheck
152 # We want this to be a reasonably quick test, but that is still hard...
153 ewarn "This test series will take 30 minutes on a modern 2.5Ghz machine"
154 # Do not increase the number of threads, it will not help your performance
155 # local testbase="perl check.pl --nthreads=1 --estimate"
156 # ${testbase} -${p}d || die "Failure: $n"
158 multibuild_foreach_variant multilib-minimal_src_test
162 DOCS=( AUTHORS ChangeLog NEWS README TODO COPYRIGHT CONVENTIONS )
163 HTML_DOCS=( doc/html/ )
165 multibuild_foreach_variant multilib-minimal_src_install
170 dodoc -r doc/FAQ/fftw-faq.html/.
172 rm -r "${ED}"/usr/share/doc/${PF}/html || die
176 for x in "${ED}"/usr/lib*/pkgconfig/*.pc; do
178 for u in $(usev mpi) $(usev threads) $(usex openmp omp ""); do
179 sed -e "s|-lfftw3[flq]\?|&_${u} &|" "$x" > "${x%.pc}_${u}.pc" || die
183 # fftw uses pkg-config to record its private dependencies
184 find "${ED}" -name '*.la' -delete || die