| 1 |
# Copyright 1999-2012 Gentoo Foundation |
| 2 |
# Distributed under the terms of the GNU General Public License v2 |
| 3 |
# $Header: /var/cvsroot/gentoo-x86/sci-libs/fftw/fftw-3.3.2.ebuild,v 1.7 2012/10/18 21:42:09 jlec Exp $ |
| 4 |
|
| 5 |
EAPI=4 |
| 6 |
|
| 7 |
#AUTOTOOLS_AUTORECONF=1 |
| 8 |
FORTRAN_NEEDED=fortran |
| 9 |
|
| 10 |
inherit autotools-utils eutils flag-o-matic fortran-2 toolchain-funcs versionator |
| 11 |
|
| 12 |
DESCRIPTION="Fast C library for the Discrete Fourier Transform" |
| 13 |
HOMEPAGE="http://www.fftw.org/" |
| 14 |
SRC_URI="http://www.fftw.org/${P}.tar.gz" |
| 15 |
|
| 16 |
LICENSE="GPL-2" |
| 17 |
SLOT="3.0" |
| 18 |
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x86-macos" |
| 19 |
IUSE="altivec avx doc fortran mpi neon openmp quad sse sse2 static-libs threads zbus" |
| 20 |
|
| 21 |
DEPEND="mpi? ( virtual/mpi )" |
| 22 |
RDEPEND="${DEPEND}" |
| 23 |
|
| 24 |
pkg_setup() { |
| 25 |
if use openmp; then |
| 26 |
if [[ $(tc-getCC) == *gcc ]] && ! tc-has-openmp; then |
| 27 |
ewarn "OpenMP is not available in your current selected gcc" |
| 28 |
die "need openmp capable gcc" |
| 29 |
fi |
| 30 |
FORTRAN_NEED_OPENMP=1 |
| 31 |
fi |
| 32 |
fortran-2_pkg_setup |
| 33 |
FFTW_DIRS="single double longdouble" |
| 34 |
if use quad; then |
| 35 |
if [[ $(tc-getCC) == *gcc ]] && ! version_is_at_least 4.6 $(gcc-version); then |
| 36 |
ewarn "quad precision only available for gcc >= 4.6" |
| 37 |
die "need quad precision capable gcc" |
| 38 |
fi |
| 39 |
FFTW_DIRS+=" quad" |
| 40 |
fi |
| 41 |
} |
| 42 |
|
| 43 |
src_prepare() { |
| 44 |
# fix info file for category directory |
| 45 |
sed -i \ |
| 46 |
-e 's/Texinfo documentation system/Libraries/' \ |
| 47 |
doc/fftw3.info || die "failed to fix info file" |
| 48 |
|
| 49 |
# why? |
| 50 |
#rm m4/lt* m4/libtool.m4 |
| 51 |
autotools-utils_src_prepare |
| 52 |
} |
| 53 |
|
| 54 |
src_configure() { |
| 55 |
local x |
| 56 |
|
| 57 |
# filter -Os according to docs |
| 58 |
replace-flags -Os -O2 |
| 59 |
|
| 60 |
for x in ${FFTW_DIRS}; do |
| 61 |
myeconfargs=( |
| 62 |
$(use_enable fortran) |
| 63 |
$(use_enable zbus mips-zbus-timer) |
| 64 |
$(use_enable threads) |
| 65 |
$(use_enable openmp) |
| 66 |
) |
| 67 |
if [[ $x == single ]]; then |
| 68 |
#altivec, sse, single-paired only work for single |
| 69 |
myeconfargs+=( |
| 70 |
--enable-single |
| 71 |
$(use_enable altivec) |
| 72 |
$(use_enable avx) |
| 73 |
$(use_enable sse) |
| 74 |
$(use_enable mpi) |
| 75 |
$(use_enable neon) |
| 76 |
) |
| 77 |
elif [[ $x == double ]]; then |
| 78 |
myeconfargs+=( |
| 79 |
$(use_enable avx) |
| 80 |
$(use_enable sse2) |
| 81 |
$(use_enable mpi) |
| 82 |
) |
| 83 |
elif [[ $x == longdouble ]]; then |
| 84 |
myeconfargs+=( |
| 85 |
--enable-long-double |
| 86 |
$(use_enable mpi) |
| 87 |
) |
| 88 |
elif [[ $x == quad ]]; then |
| 89 |
#quad does not support mpi |
| 90 |
myeconfargs+=( --enable-quad-precision ) |
| 91 |
else |
| 92 |
die "${x} precision not implemented in this ebuild" |
| 93 |
fi |
| 94 |
|
| 95 |
einfo "Configuring for ${x} precision" |
| 96 |
AUTOTOOLS_BUILD_DIR="${S}-${x}" \ |
| 97 |
autotools-utils_src_configure |
| 98 |
done |
| 99 |
} |
| 100 |
|
| 101 |
src_compile() { |
| 102 |
for x in ${FFTW_DIRS}; do |
| 103 |
einfo "Compiling for ${x} precision" |
| 104 |
AUTOTOOLS_BUILD_DIR="${S}-${x}" \ |
| 105 |
autotools-utils_src_compile |
| 106 |
done |
| 107 |
} |
| 108 |
|
| 109 |
src_test () { |
| 110 |
# We want this to be a reasonably quick test, but that is still hard... |
| 111 |
ewarn "This test series will take 30 minutes on a modern 2.5Ghz machine" |
| 112 |
# Do not increase the number of threads, it will not help your performance |
| 113 |
#local testbase="perl check.pl --nthreads=1 --estimate" |
| 114 |
# ${testbase} -${p}d || die "Failure: $n" |
| 115 |
for x in ${FFTW_DIRS}; do |
| 116 |
cd "${S}-${x}/tests" |
| 117 |
einfo "Testing ${x} precision" |
| 118 |
emake smallcheck |
| 119 |
done |
| 120 |
} |
| 121 |
|
| 122 |
src_install () { |
| 123 |
local u x |
| 124 |
DOCS=( AUTHORS ChangeLog NEWS README TODO COPYRIGHT CONVENTIONS ) |
| 125 |
HTML_DOCS=( doc/html/ ) |
| 126 |
for x in ${FFTW_DIRS}; do |
| 127 |
AUTOTOOLS_BUILD_DIR="${S}-${x}" \ |
| 128 |
autotools-utils_src_install |
| 129 |
done |
| 130 |
|
| 131 |
if use doc; then |
| 132 |
dodoc doc/*.pdf |
| 133 |
insinto /usr/share/doc/${PF}/faq |
| 134 |
doins -r doc/FAQ/fftw-faq.html/* |
| 135 |
else |
| 136 |
rm -r "${ED}"/usr/share/doc/${PF}/html |
| 137 |
fi |
| 138 |
|
| 139 |
for x in "${ED}"/usr/lib*/pkgconfig/*.pc; do |
| 140 |
for u in $(usev mpi) $(usev threads) $(usex openmp omp ""); do |
| 141 |
sed -e "s|-lfftw3[flq]\?|&_$u &|" "$x" > "${x%.pc}_$u.pc" || die |
| 142 |
done |
| 143 |
done |
| 144 |
} |