| 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-2.1.5-r5.ebuild,v 1.24 2012/04/25 17:48:26 jlec Exp $
|
| 4 |
|
| 5 |
inherit autotools eutils flag-o-matic fortran-2 toolchain-funcs
|
| 6 |
|
| 7 |
DESCRIPTION="Fast C library for the Discrete Fourier Transform"
|
| 8 |
SRC_URI="http://www.fftw.org/${P}.tar.gz"
|
| 9 |
HOMEPAGE="http://www.fftw.org"
|
| 10 |
|
| 11 |
DEPEND="
|
| 12 |
fortran? ( virtual/fortran )
|
| 13 |
mpi? ( virtual/mpi )"
|
| 14 |
RDEPEND="${DEPEND}"
|
| 15 |
|
| 16 |
SLOT="2.1"
|
| 17 |
LICENSE="GPL-2"
|
| 18 |
IUSE="doc float fortran mpi openmp threads"
|
| 19 |
|
| 20 |
KEYWORDS="alpha amd64 ~arm hppa ia64 ppc ppc64 s390 sparc x86"
|
| 21 |
|
| 22 |
pkg_setup() {
|
| 23 |
use openmp && FORTRAN_NEED_OPENMP="1"
|
| 24 |
use fortran && fortran-2_pkg_setup
|
| 25 |
# this one is reported to cause trouble on pentium4 m series
|
| 26 |
filter-mfpmath "sse"
|
| 27 |
|
| 28 |
# here I need (surprise) to increase optimization:
|
| 29 |
# --enable-i386-hacks requires -fomit-frame-pointer to work properly
|
| 30 |
if use x86; then
|
| 31 |
is-flag "-fomit-frame-pointer" || append-flags "-fomit-frame-pointer"
|
| 32 |
fi
|
| 33 |
if use openmp && [[ $(tc-getCC) == *gcc* ]] && ! $(tc-has-openmp); then
|
| 34 |
ewarn "You are using gcc and OpenMP is only available with gcc >= 4.2 "
|
| 35 |
ewarn "If you want to build fftw with OpenMP, abort now,"
|
| 36 |
ewarn "and switch CC to an OpenMP capable compiler"
|
| 37 |
ewarn "Otherwise the configure script will select POSIX threads."
|
| 38 |
fi
|
| 39 |
use openmp && [[ $(tc-getCC)$ == icc* ]] && append-ldflags $(no-as-needed)
|
| 40 |
}
|
| 41 |
|
| 42 |
src_unpack() {
|
| 43 |
# doc suggests installing single and double precision versions
|
| 44 |
# via separate compilations. will do in two separate source trees
|
| 45 |
# since some sed'ing is done during the build
|
| 46 |
# (?if --enable-type-prefix is set?)
|
| 47 |
|
| 48 |
unpack ${A}
|
| 49 |
cd "${S}"
|
| 50 |
epatch "${FILESDIR}"/${P}-as-needed.patch
|
| 51 |
epatch "${FILESDIR}"/${P}-configure.in.patch
|
| 52 |
epatch "${FILESDIR}"/${P}-no-test.patch
|
| 53 |
|
| 54 |
# fix info files
|
| 55 |
for infofile in doc/fftw*info*; do
|
| 56 |
cat >> ${infofile} <<-EOF
|
| 57 |
INFO-DIR-SECTION Libraries
|
| 58 |
START-INFO-DIR-ENTRY
|
| 59 |
* fftw: (fftw). ${DESCRIPTION}
|
| 60 |
END-INFO-DIR-ENTRY
|
| 61 |
EOF
|
| 62 |
done
|
| 63 |
|
| 64 |
eautoreconf
|
| 65 |
|
| 66 |
cd "${WORKDIR}"
|
| 67 |
cp -R ${P} ${P}-double
|
| 68 |
mv ${P} ${P}-single
|
| 69 |
}
|
| 70 |
|
| 71 |
src_compile() {
|
| 72 |
local myconf="
|
| 73 |
--enable-shared
|
| 74 |
--enable-type-prefix
|
| 75 |
--enable-vec-recurse
|
| 76 |
$(use_enable fortran)
|
| 77 |
$(use_enable mpi)
|
| 78 |
$(use_enable x86 i386-hacks)"
|
| 79 |
if use openmp; then
|
| 80 |
myconf="${myconf}
|
| 81 |
--enable-threads
|
| 82 |
--with-openmp"
|
| 83 |
elif use threads; then
|
| 84 |
myconf="${myconf}
|
| 85 |
--enable-threads
|
| 86 |
--without-openmp"
|
| 87 |
else
|
| 88 |
myconf="${myconf}
|
| 89 |
--disable-threads
|
| 90 |
--without-openmp"
|
| 91 |
fi
|
| 92 |
cd "${S}-single"
|
| 93 |
econf ${myconf} --enable-float
|
| 94 |
emake || die "emake for float failed"
|
| 95 |
|
| 96 |
cd "${S}-double"
|
| 97 |
econf ${myconf}
|
| 98 |
emake || die "emake for double failed"
|
| 99 |
}
|
| 100 |
|
| 101 |
src_test() {
|
| 102 |
cd "${S}-single"
|
| 103 |
emake -j1 check || die "emake check single failed"
|
| 104 |
cd "${S}-double"
|
| 105 |
emake -j1 check || die "emake check double failed"
|
| 106 |
}
|
| 107 |
|
| 108 |
src_install () {
|
| 109 |
|
| 110 |
# both builds are installed in the same place
|
| 111 |
# libs are distinguished by prefix (s or d), see docs for details
|
| 112 |
|
| 113 |
cd "${S}-single"
|
| 114 |
emake DESTDIR="${D}" install || die "emake install float failed"
|
| 115 |
|
| 116 |
cd "${S}-double"
|
| 117 |
emake DESTDIR="${D}" install || die "emake install double failed"
|
| 118 |
|
| 119 |
insinto /usr/include
|
| 120 |
doins fortran/fftw_f77.i || die "doins failed"
|
| 121 |
dodoc AUTHORS ChangeLog NEWS TODO README README.hacks || die "dodoc failed"
|
| 122 |
use doc && dohtml doc/*
|
| 123 |
|
| 124 |
if use float; then
|
| 125 |
for f in "${D}"/usr/{include,$(get_libdir)}/*sfft*; do
|
| 126 |
ln -s $(basename ${f}) ${f/sfft/fft}
|
| 127 |
done
|
| 128 |
for f in "${D}"/usr/{include,$(get_libdir)}/*srfft*; do
|
| 129 |
ln -s $(basename ${f}) ${f/srfft/rfft}
|
| 130 |
done
|
| 131 |
else
|
| 132 |
for f in "${D}"/usr/{include,$(get_libdir)}/*dfft*; do
|
| 133 |
ln -s $(basename ${f}) ${f/dfft/fft}
|
| 134 |
done
|
| 135 |
for f in "${D}"/usr/{include,$(get_libdir)}/*drfft*; do
|
| 136 |
ln -s $(basename ${f}) ${f/drfft/rfft}
|
| 137 |
done
|
| 138 |
fi
|
| 139 |
}
|