summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastien Fabbro <bicatali@gentoo.org>2008-07-02 09:20:22 +0000
committerSebastien Fabbro <bicatali@gentoo.org>2008-07-02 09:20:22 +0000
commit514da1c1ac421a9bbd6df1b39d6fd96ca1c42a59 (patch)
tree7ea7a6557c54e51a04600ecec7e6f605f0d7dcad /sci-libs/fftw
parentAdded openmp local USE flag for sci-libs/fftw (diff)
downloadgentoo-2-514da1c1ac421a9bbd6df1b39d6fd96ca1c42a59.tar.gz
gentoo-2-514da1c1ac421a9bbd6df1b39d6fd96ca1c42a59.tar.bz2
gentoo-2-514da1c1ac421a9bbd6df1b39d6fd96ca1c42a59.zip
Added openmp support for both fftw-2 and fftw-3. Added as-needed fixes for fftw-3, needed for threads support. Added a doc use flag for fftw-3.
(Portage version: 2.1.4.4)
Diffstat (limited to 'sci-libs/fftw')
-rw-r--r--sci-libs/fftw/ChangeLog12
-rw-r--r--sci-libs/fftw/fftw-2.1.5-r5.ebuild129
-rw-r--r--sci-libs/fftw/fftw-3.1.2-r1.ebuild119
-rw-r--r--sci-libs/fftw/files/fftw-2.1.5-configure.in.patch29
-rw-r--r--sci-libs/fftw/files/fftw-3.1.2-as-needed.patch35
-rw-r--r--sci-libs/fftw/files/fftw-3.1.2-configure.ac.patch13
-rw-r--r--sci-libs/fftw/files/fftw-3.1.2-openmp.patch12
7 files changed, 340 insertions, 9 deletions
diff --git a/sci-libs/fftw/ChangeLog b/sci-libs/fftw/ChangeLog
index 93c99bca0a48..a1bde79e6c27 100644
--- a/sci-libs/fftw/ChangeLog
+++ b/sci-libs/fftw/ChangeLog
@@ -1,6 +1,16 @@
# ChangeLog for sci-libs/fftw
# Copyright 2002-2008 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sci-libs/fftw/ChangeLog,v 1.66 2008/06/23 14:31:13 bicatali Exp $
+# $Header: /var/cvsroot/gentoo-x86/sci-libs/fftw/ChangeLog,v 1.67 2008/07/02 09:20:22 bicatali Exp $
+
+*fftw-3.1.2-r1 (02 Jul 2008)
+*fftw-2.1.5-r5 (02 Jul 2008)
+
+ 02 Jul 2008; Sébastien Fabbro <bicatali@gentoo.org>
+ files/fftw-2.1.5-configure.in.patch, +files/fftw-3.1.2-as-needed.patch,
+ files/fftw-3.1.2-configure.ac.patch, +files/fftw-3.1.2-openmp.patch,
+ +fftw-2.1.5-r5.ebuild, +fftw-3.1.2-r1.ebuild:
+ Added openmp support for both fftw-2 and fftw-3. Added as-needed fixes for
+ fftw-3, needed for threads support. Added a doc use flag for fftw-3.
23 Jun 2008; Sébastien Fabbro <bicatali@gentoo.org>
+files/fftw-2.1.5-no-test.patch, fftw-2.1.5-r4.ebuild, fftw-3.1.2.ebuild:
diff --git a/sci-libs/fftw/fftw-2.1.5-r5.ebuild b/sci-libs/fftw/fftw-2.1.5-r5.ebuild
new file mode 100644
index 000000000000..a5ec2b4e6b7d
--- /dev/null
+++ b/sci-libs/fftw/fftw-2.1.5-r5.ebuild
@@ -0,0 +1,129 @@
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sci-libs/fftw/fftw-2.1.5-r5.ebuild,v 1.1 2008/07/02 09:20:22 bicatali Exp $
+
+inherit eutils flag-o-matic multilib autotools fortran
+
+DESCRIPTION="Fast C library for the Discrete Fourier Transform"
+SRC_URI="http://www.fftw.org/${P}.tar.gz"
+HOMEPAGE="http://www.fftw.org"
+
+# hppa does not have yet a virtual/mpi
+DEPEND="mpi? ( virtual/mpi )"
+
+SLOT="2.1"
+LICENSE="GPL-2"
+IUSE="doc float fortran mpi openmp threads"
+
+KEYWORDS="~alpha ~amd64 ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86"
+
+pkg_setup() {
+ # this one is reported to cause trouble on pentium4 m series
+ filter-mfpmath "sse"
+
+ # here I need (surprise) to increase optimization:
+ # --enable-i386-hacks requires -fomit-frame-pointer to work properly
+ if [ "${ARCH}" == "x86" ]; then
+ is-flag "-fomit-frame-pointer" || append-flags "-fomit-frame-pointer"
+ fi
+ FORTRAN="gfortran ifc g77"
+ use fortran && fortran_pkg_setup
+}
+
+src_unpack() {
+ # doc suggests installing single and double precision versions
+ # via separate compilations. will do in two separate source trees
+ # since some sed'ing is done during the build
+ # (?if --enable-type-prefix is set?)
+
+ unpack ${A}
+ cd "${S}"
+ epatch "${FILESDIR}"/${P}-as-needed.patch
+ epatch "${FILESDIR}"/${P}-configure.in.patch
+ epatch "${FILESDIR}"/${P}-no-test.patch
+
+ # fix info files
+ for infofile in doc/fftw*info*; do
+ cat >> ${infofile} <<-EOF
+ INFO-DIR-SECTION Libraries
+ START-INFO-DIR-ENTRY
+ * fftw: (fftw). ${DESCRIPTION}
+ END-INFO-DIR-ENTRY
+ EOF
+ done
+
+ eautoreconf
+
+ cd "${WORKDIR}"
+ cp -R ${P} ${P}-double
+ mv ${P} ${P}-single
+}
+
+src_compile() {
+ cd "${S}-single"
+ econf \
+ --enable-float \
+ --enable-shared \
+ --enable-type-prefix \
+ --enable-vec-recurse \
+ $(use_enable threads) \
+ $(use_with openmp) \
+ $(use_enable fortran) \
+ $(use_enable mpi) \
+ $(use_enable x86 i386-hacks) \
+ || die "econf for float failed"
+ emake || die "emake for float failed"
+
+ # the only difference here is no --enable-float
+ cd "${S}-double"
+ econf \
+ --enable-shared \
+ --enable-type-prefix \
+ --enable-vec-recurse \
+ $(use_enable threads) \
+ $(use_with openmp) \
+ $(use_enable fortran) \
+ $(use_enable mpi) \
+ $(use_enable x86 i386-hacks) \
+ || die "econf for double failed"
+ emake || die "emake for double failed"
+}
+
+src_test() {
+ cd "${S}-single"
+ emake -j1 check || die "emake check single failed"
+ cd "${S}-double"
+ emake -j1 check || die "emake check double failed"
+}
+
+src_install () {
+
+ # both builds are installed in the same place
+ # libs are distinguished by prefix (s or d), see docs for details
+
+ cd "${S}-single"
+ emake DESTDIR="${D}" install || die "emake install float failed"
+ insinto /usr/include
+ doins fortran/fftw_f77.i || die "doins failed"
+ dodoc AUTHORS ChangeLog NEWS TODO README README.hacks || die "dodoc failed"
+ use doc && dohtml doc/*
+
+ cd "${S}-double"
+ emake DESTDIR="${D}" install || die "emake install double failed"
+
+ if use float; then
+ for f in "${D}"/usr/{include,$(get_libdir)}/*sfft*; do
+ ln -s $(basename ${f}) ${f/sfft/fft}
+ done
+ for f in "${D}"/usr/{include,$(get_libdir)}/*srfft*; do
+ ln -s $(basename ${f}) ${f/srfft/rfft}
+ done
+ else
+ for f in "${D}"/usr/{include,$(get_libdir)}/*dfft*; do
+ ln -s $(basename ${f}) ${f/dfft/fft}
+ done
+ for f in "${D}"/usr/{include,$(get_libdir)}/*drfft*; do
+ ln -s $(basename ${f}) ${f/drfft/rfft}
+ done
+ fi
+}
diff --git a/sci-libs/fftw/fftw-3.1.2-r1.ebuild b/sci-libs/fftw/fftw-3.1.2-r1.ebuild
new file mode 100644
index 000000000000..3989ae95b521
--- /dev/null
+++ b/sci-libs/fftw/fftw-3.1.2-r1.ebuild
@@ -0,0 +1,119 @@
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sci-libs/fftw/fftw-3.1.2-r1.ebuild,v 1.1 2008/07/02 09:20:22 bicatali Exp $
+
+inherit flag-o-matic eutils toolchain-funcs autotools fortran
+
+DESCRIPTION="Fast C library for the Discrete Fourier Transform"
+HOMEPAGE="http://www.fftw.org/"
+SRC_URI="http://www.fftw.org/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="3.0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86"
+IUSE="altivec doc fortran openmp sse sse2 threads"
+
+pkg_setup() {
+ FORTRAN="gfortran ifc g77"
+ use fortran && fortran_pkg_setup
+}
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+ epatch "${FILESDIR}"/${P}-configure.ac.patch
+ epatch "${FILESDIR}"/${P}-openmp.patch
+ epatch "${FILESDIR}"/${P}-as-needed.patch
+
+ # fix info file
+ sed -e 's/Texinfo documentation system/Libraries/' \
+ -i doc/fftw3.info || die "failed to fix info file"
+ AT_M4DIR=m4 eautoreconf
+ cd "${WORKDIR}"
+ mv ${P} ${P}-single
+ cp -pPR ${P}-single ${P}-double
+ cp -pPR ${P}-single ${P}-longdouble
+}
+
+src_compile() {
+ # filter -Os according to docs
+ replace-flags -Os -O2
+
+ local myconfcommon="--enable-shared
+ $(use_with openmp)
+ $(use_enable threads)
+ $(use_enable fortran)"
+ local myconfsingle=""
+ local myconfdouble=""
+ local myconflongdouble=""
+
+ if use sse2; then
+ myconfsingle="${myconfsingle} --enable-sse"
+ myconfdouble="${myconfdouble} --enable-sse2"
+ elif use sse; then
+ myconfsingle="${myconfsingle} --enable-sse"
+ fi
+ # altivec only helps floats, not doubles
+ if use altivec; then
+ myconfsingle="${myconfsingle} --enable-altivec"
+ fi
+
+ cd "${S}-single"
+ econf \
+ --enable-float \
+ ${myconfcommon} \
+ ${myconfsingle} || \
+ die "econf single failed"
+ emake || die "emake single failed"
+
+ # the only difference here is no --enable-float
+ cd "${S}-double"
+ econf \
+ ${myconfcommon} \
+ ${myconfdouble} || \
+ die "econf double failed"
+ emake || die "emake double failed"
+
+ # the only difference here is --enable-long-double
+ cd "${S}-longdouble"
+ econf \
+ --enable-long-double \
+ ${myconfcommon} \
+ ${myconflongdouble} || \
+ die "econf long double failed"
+ emake || die "emake long double failed"
+}
+
+
+src_test () {
+ # We want this to be a reasonably quick test, but that is still hard...
+ ewarn "This test series will take 30 minutes on a modern 2.5Ghz machine"
+ # Do not increase the number of threads, it will not help your performance
+ #local testbase="perl check.pl --nthreads=1 --estimate"
+ # ${testbase} -${p}d || die "Failure: $n"
+ for d in single double longdouble; do
+ cd "${S}-${d}"/tests
+ einfo "Testing ${PN}-${d}"
+ emake -j1 check || die "emake test failed"
+ done
+}
+
+src_install () {
+ # all builds are installed in the same place
+ # libs have distinuguished names; include files, docs etc. identical.
+ for i in single double longdouble; do
+ cd "${S}-${i}"
+ emake DESTDIR="${D}" install || die "emake install for ${i} failed"
+ done
+
+ # Install documentation.
+ cd "${S}-single"
+ dodoc AUTHORS ChangeLog NEWS README TODO COPYRIGHT CONVENTIONS || die
+ if use doc; then
+ cd doc
+ insinto /usr/share/doc/${PF}
+ doins -r html fftw3.pdf || die "doc install failed"
+ insinto /usr/share/doc/${PF}/faq
+ doins FAQ/fftw-faq.html/*
+ fi
+}
diff --git a/sci-libs/fftw/files/fftw-2.1.5-configure.in.patch b/sci-libs/fftw/files/fftw-2.1.5-configure.in.patch
index f4dde992611f..62b388590e12 100644
--- a/sci-libs/fftw/files/fftw-2.1.5-configure.in.patch
+++ b/sci-libs/fftw/files/fftw-2.1.5-configure.in.patch
@@ -1,5 +1,5 @@
---- configure.in.orig 2008-04-01 22:46:45.943787297 +0100
-+++ configure.in 2008-04-01 22:58:13.510969518 +0100
+--- configure.in.orig 2008-06-22 17:01:59.013047109 +0100
++++ configure.in 2008-06-22 17:17:39.421924454 +0100
@@ -1,6 +1,7 @@
dnl Process this file with autoconf to produce a configure script.
AC_INIT(fftw/planner.c)
@@ -95,7 +95,24 @@
fi
-@@ -243,7 +244,7 @@
+@@ -230,6 +231,16 @@
+ AC_TRY_LINK_FUNC(omp_set_num_threads,THREADLIBS=" "
+ omp_enabler="$CC -omp")
+ if test -z "$THREADLIBS"; then
++ CFLAGS="$save_CFLAGS -fopenmp"
++ AC_TRY_LINK_FUNC(omp_set_num_threads,THREADLIBS="-lgomp"
++ omp_enabler="$CC -fopenmp")
++ fi
++ if test -z "$THREADLIBS"; then
++ CFLAGS="$save_CFLAGS -fopenmp"
++ AC_TRY_LINK_FUNC(omp_set_num_threads,THREADLIBS=""
++ omp_enabler="$CC -openmp")
++ fi
++ if test -z "$THREADLIBS"; then
+ CFLAGS="$save_CFLAGS -mp"
+ AC_TRY_LINK_FUNC(omp_set_num_threads,THREADLIBS=" "
+ omp_enabler="$CC -mp")
+@@ -243,7 +249,7 @@
if test -z "$THREADLIBS"; then
AC_MSG_ERROR([don't know how to enable OpenMP])
fi
@@ -104,7 +121,7 @@
fi
if test "$with_sgimp"x != nox; then
AC_MSG_CHECKING(how to enable SGI MP)
-@@ -261,7 +262,7 @@
+@@ -261,7 +267,7 @@
if test -z "$THREADLIBS"; then
AC_MSG_ERROR([don't know how to enable SGI MP])
fi
@@ -113,7 +130,7 @@
fi
# POSIX threads, the default choice:
-@@ -270,38 +271,38 @@
+@@ -270,38 +276,38 @@
ACX_PTHREAD([THREADLIBS="$PTHREAD_LIBS "
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
CC="$PTHREAD_CC"
@@ -158,7 +175,7 @@
fi
if test -z "$THREADLIBS"; then
AC_MSG_ERROR(couldn't find threads library for --enable-threads)
-@@ -334,7 +335,7 @@
+@@ -334,7 +340,7 @@
CC="$MPICC"
ok=yes
AC_TRY_LINK([#include <mpi.h>
diff --git a/sci-libs/fftw/files/fftw-3.1.2-as-needed.patch b/sci-libs/fftw/files/fftw-3.1.2-as-needed.patch
new file mode 100644
index 000000000000..fca95715827c
--- /dev/null
+++ b/sci-libs/fftw/files/fftw-3.1.2-as-needed.patch
@@ -0,0 +1,35 @@
+--- Makefile.am.orig 2008-06-22 14:49:18.725790127 +0100
++++ Makefile.am 2008-06-22 15:09:37.339234950 +0100
+@@ -35,6 +35,13 @@
+ if THREADS
+ if COMBINED_THREADS
+ COMBINED_THREADLIBS=threads/libfftw3@PREC_SUFFIX@_threads.la
++else
++lib_LTLIBRARIES += libfftw3@PREC_SUFFIX@_threads.la
++libfftw3@PREC_SUFFIX@_threads_la_SOURCES =
++libfftw3@PREC_SUFFIX@_threads_la_LDFLAGS = -version-info @SHARED_VERSION_INFO@
++libfftw3@PREC_SUFFIX@_threads_la_LIBADD = \
++ libfftw3@PREC_SUFFIX@.la \
++ threads/libfftw3@PREC_SUFFIX@_threads.la
+ endif
+ endif
+
+--- threads/Makefile.am.orig 2008-07-01 11:46:56.464637525 +0100
++++ threads/Makefile.am 2008-07-01 11:48:02.268387467 +0100
+@@ -2,15 +2,12 @@
+ -I$(top_srcdir)/rdft -I$(top_srcdir)/api
+
+ if THREADS
+-if COMBINED_THREADS
+ noinst_LTLIBRARIES = libfftw3@PREC_SUFFIX@_threads.la
+-else
+-lib_LTLIBRARIES = libfftw3@PREC_SUFFIX@_threads.la
+-endif
+ endif
+
+ libfftw3@PREC_SUFFIX@_threads_la_SOURCES = api.c conf.c threads.c \
+ threads.h dft-vrank-geq1.c ct.c rdft-vrank-geq1.c hc2hc.c \
+ vrank-geq1-rdft2.c f77api.c f77funcs.h
+
++libfftw3@PREC_SUFFIX@_threads_la_LIBADD = $(THREADLIBS)
+ libfftw3@PREC_SUFFIX@_threads_la_LDFLAGS = -version-info @SHARED_VERSION_INFO@
diff --git a/sci-libs/fftw/files/fftw-3.1.2-configure.ac.patch b/sci-libs/fftw/files/fftw-3.1.2-configure.ac.patch
index bbc0ccb6b5f8..de54a25dab05 100644
--- a/sci-libs/fftw/files/fftw-3.1.2-configure.ac.patch
+++ b/sci-libs/fftw/files/fftw-3.1.2-configure.ac.patch
@@ -1,5 +1,5 @@
---- configure.ac.orig 2008-03-31 23:03:45.200210228 +0100
-+++ configure.ac 2008-03-31 23:06:57.111081976 +0100
+--- configure.ac.orig 2008-06-30 23:10:27.431674828 +0100
++++ configure.ac 2008-06-30 23:50:59.266804845 +0100
@@ -135,7 +135,7 @@
AC_PROG_CC
AX_COMPILER_VENDOR
@@ -18,3 +18,12 @@
dnl Checks for header files.
AC_HEADER_STDC
+@@ -362,7 +364,7 @@
+ THREADLIBS=""
+ if test "$enable_threads" = "yes"; then
+ if test "$with_openmp"x != nox; then
+- AX_OPENMP([THREADLIBS=" "
++ AX_OPENMP([THREADLIBS="$OPENMP_LIBS"
+ AC_DEFINE(USING_OPENMP_THREADS, 1, [Define if we have and are using OpenMP multithreading directives])
+ CFLAGS="$CFLAGS $OPENMP_CFLAGS"],
+ [AC_MSG_ERROR([don't know how to enable OpenMP])])
diff --git a/sci-libs/fftw/files/fftw-3.1.2-openmp.patch b/sci-libs/fftw/files/fftw-3.1.2-openmp.patch
new file mode 100644
index 000000000000..5ccfea691a8f
--- /dev/null
+++ b/sci-libs/fftw/files/fftw-3.1.2-openmp.patch
@@ -0,0 +1,12 @@
+--- m4/ax_openmp.m4.orig 2008-07-01 00:14:48.814076874 +0100
++++ m4/ax_openmp.m4 2008-06-30 23:42:30.534809664 +0100
+@@ -59,6 +59,9 @@
+ else
+ if test "x$ax_cv_[]_AC_LANG_ABBREV[]_openmp" != "xnone"; then
+ OPENMP_[]_AC_LANG_PREFIX[]FLAGS=$ax_cv_[]_AC_LANG_ABBREV[]_openmp
++ if test "x$ax_cv_[]_AC_LANG_ABBREV[]_openmp" = "x-fopenmp"; then
++ OPENMP_LIBS="-lgomp"
++ fi
+ fi
+ m4_default([$1], [AC_DEFINE(HAVE_OPENMP,1,[Define if OpenMP is enabled])])
+ fi