| 1 |
# Copyright 1999-2011 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-r1.ebuild,v 1.1 2011/10/09 11:56:41 xarthisius Exp $
|
| 4 |
|
| 5 |
EAPI=4
|
| 6 |
|
| 7 |
inherit autotools 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 doc fortran mpi openmp sse sse2 static-libs threads"
|
| 17 |
|
| 18 |
DEPEND="
|
| 19 |
fortran? ( virtual/fortran )
|
| 20 |
mpi? ( virtual/mpi )"
|
| 21 |
RDEPEND="${DEPEND}"
|
| 22 |
|
| 23 |
pkg_setup() {
|
| 24 |
use openmp && FORTRAN_NEED_OPENMP="1"
|
| 25 |
use fortran && fortran-2_pkg_setup
|
| 26 |
use openmp && FFTW_OPENMP="--enable-openmp"
|
| 27 |
if use openmp && ! tc-has-openmp; then
|
| 28 |
ewarn "You are using gcc and OpenMP is only available with gcc >= 4.2 "
|
| 29 |
ewarn "If you want to build fftw with OpenMP, abort now,"
|
| 30 |
ewarn "and switch CC to an OpenMP capable compiler"
|
| 31 |
ewarn "Otherwise, we will build using POSIX threads."
|
| 32 |
epause 5
|
| 33 |
FFTW_OPENMP="--disable-openmp"
|
| 34 |
fi
|
| 35 |
FFTW_DIRS="single double longdouble"
|
| 36 |
use openmp && [[ $(tc-getCC)$ == icc* ]] && append-ldflags $(no-as-needed)
|
| 37 |
}
|
| 38 |
|
| 39 |
src_prepare() {
|
| 40 |
# fix info file for category directory
|
| 41 |
sed -i \
|
| 42 |
-e 's/Texinfo documentation system/Libraries/' \
|
| 43 |
doc/fftw3.info || die "failed to fix info file"
|
| 44 |
|
| 45 |
rm m4/lt* m4/libtool.m4
|
| 46 |
|
| 47 |
AT_M4DIR=m4 eautoreconf
|
| 48 |
for x in ${FFTW_DIRS}; do
|
| 49 |
mkdir "${S}-${x}" || die
|
| 50 |
done
|
| 51 |
}
|
| 52 |
|
| 53 |
src_configure() {
|
| 54 |
# filter -Os according to docs
|
| 55 |
replace-flags -Os -O2
|
| 56 |
|
| 57 |
local myconfcommon="--enable-shared
|
| 58 |
$(use_enable static-libs static)
|
| 59 |
$(use_enable fortran)
|
| 60 |
$(use_enable mpi)
|
| 61 |
$(use_enable threads)
|
| 62 |
${FFTW_OPENMP}"
|
| 63 |
|
| 64 |
local myconfsingle="${myconfcommon} --enable-single"
|
| 65 |
local myconfdouble="${myconfcommon}"
|
| 66 |
local myconflongdouble="${myconfcommon} --enable-long-double"
|
| 67 |
if use sse2; then
|
| 68 |
myconfsingle="${myconfsingle} --enable-sse"
|
| 69 |
myconfdouble="${myconfdouble} --enable-sse2"
|
| 70 |
elif use sse; then
|
| 71 |
myconfsingle="${myconfsingle} --enable-sse"
|
| 72 |
fi
|
| 73 |
# altivec only helps singles, not doubles
|
| 74 |
if use altivec; then
|
| 75 |
myconfsingle="${myconfsingle} --enable-altivec"
|
| 76 |
fi
|
| 77 |
|
| 78 |
for x in ${FFTW_DIRS}; do
|
| 79 |
cd "${S}-${x}"
|
| 80 |
einfo "Configuring for ${x} precision"
|
| 81 |
local p=myconf${x}
|
| 82 |
ECONF_SOURCE="${S}" econf ${!p}
|
| 83 |
done
|
| 84 |
}
|
| 85 |
|
| 86 |
src_compile() {
|
| 87 |
for x in ${FFTW_DIRS}; do
|
| 88 |
cd "${S}-${x}"
|
| 89 |
einfo "Compiling for ${x} precision"
|
| 90 |
emake
|
| 91 |
done
|
| 92 |
}
|
| 93 |
|
| 94 |
src_test () {
|
| 95 |
# We want this to be a reasonably quick test, but that is still hard...
|
| 96 |
ewarn "This test series will take 30 minutes on a modern 2.5Ghz machine"
|
| 97 |
# Do not increase the number of threads, it will not help your performance
|
| 98 |
#local testbase="perl check.pl --nthreads=1 --estimate"
|
| 99 |
# ${testbase} -${p}d || die "Failure: $n"
|
| 100 |
for x in ${FFTW_DIRS}; do
|
| 101 |
cd "${S}-${x}/tests"
|
| 102 |
einfo "Testing ${x} precision"
|
| 103 |
emake -j1 check
|
| 104 |
done
|
| 105 |
}
|
| 106 |
|
| 107 |
src_install () {
|
| 108 |
local f u
|
| 109 |
|
| 110 |
# all builds are installed in the same place
|
| 111 |
# libs have distinuguished names; include files, docs etc. identical.
|
| 112 |
for x in ${FFTW_DIRS}; do
|
| 113 |
cd "${S}-${x}"
|
| 114 |
emake DESTDIR="${D}" install
|
| 115 |
done
|
| 116 |
|
| 117 |
cd "${S}"
|
| 118 |
dodoc AUTHORS ChangeLog NEWS README TODO COPYRIGHT CONVENTIONS
|
| 119 |
if use doc; then
|
| 120 |
cd doc
|
| 121 |
insinto /usr/share/doc/${PF}
|
| 122 |
doins -r html fftw3.pdf
|
| 123 |
insinto /usr/share/doc/${PF}/faq
|
| 124 |
doins FAQ/fftw-faq.html/*
|
| 125 |
fi
|
| 126 |
|
| 127 |
use openmp && [[ ${FFTW_OPENMP} = "--enable-openmp" ]] && u="omp"
|
| 128 |
for f in "${ED}"/usr/lib*/pkgconfig/*.pc; do
|
| 129 |
for u in $(usev mpi) $(usev threads) ${u}; do
|
| 130 |
sed "s|-lfftw3[lf]\?|&_$u &|" "$f" > "${f%.pc}_$u.pc" || die
|
| 131 |
done
|
| 132 |
done
|
| 133 |
}
|