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