commit:     27003093937c3e0162477bbd3fd23c5de986d17a
Author:     David Seifert <soap <AT> gentoo <DOT> org>
AuthorDate: Wed Aug 31 20:07:38 2016 +0000
Commit:     David Seifert <soap <AT> gentoo <DOT> org>
CommitDate: Wed Aug 31 20:09:27 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=27003093

sci-libs/fftw: Rewrite ebuild to EAPI=6 standards

* Use multibuild.eclass for single/double precision
* Make patches -p1 compliant
* Simplify src_configure phase

Package-Manager: portage-2.3.0

 sci-libs/fftw/fftw-2.1.5-r9.ebuild                | 138 ++++++++++++++++++++++
 sci-libs/fftw/files/fftw-2.1.5-as-needed.patch    |  16 +--
 sci-libs/fftw/files/fftw-2.1.5-configure.in.patch |   4 +-
 sci-libs/fftw/files/fftw-2.1.5-no-test.patch      |  12 +-
 4 files changed, 154 insertions(+), 16 deletions(-)

diff --git a/sci-libs/fftw/fftw-2.1.5-r9.ebuild 
b/sci-libs/fftw/fftw-2.1.5-r9.ebuild
new file mode 100644
index 00000000..bc142c7
--- /dev/null
+++ b/sci-libs/fftw/fftw-2.1.5-r9.ebuild
@@ -0,0 +1,138 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=6
+
+FORTRAN_NEEDED=fortran
+
+inherit autotools flag-o-matic fortran-2 multibuild toolchain-funcs
+
+DESCRIPTION="Fast C library for the Discrete Fourier Transform"
+HOMEPAGE="http://www.fftw.org";
+SRC_URI="http://www.fftw.org/${P}.tar.gz";
+
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~s390 ~sparc ~x86 
~amd64-linux ~x86-linux ~ppc-macos ~x86-macos"
+
+LICENSE="GPL-2+"
+SLOT="2.1"
+IUSE="doc float fortran mpi openmp threads static-libs"
+
+RDEPEND="mpi? ( virtual/mpi )"
+DEPEND="${RDEPEND}"
+
+PATCHES=(
+       "${FILESDIR}"/${P}-as-needed.patch
+       "${FILESDIR}"/${P}-configure.in.patch
+       "${FILESDIR}"/${P}-no-test.patch
+       "${FILESDIR}"/${P}-cc.patch
+       "${FILESDIR}"/${P}-texinfo5.1.patch
+)
+
+pkg_setup() {
+       if [[ ${MERGE_TYPE} != binary ]] && use openmp; then
+               if ! tc-has-openmp; then
+                       ewarn "OpenMP is not available in your current selected 
compiler"
+
+                       if tc-is-clang; then
+                               ewarn "OpenMP support in sys-devel/clang is 
provided by sys-libs/libomp,"
+                               ewarn "which you will need to build 
${CATEGORY}/${PN} with USE=\"openmp\""
+                       fi
+
+                       die "need openmp capable compiler"
+               fi
+               FORTRAN_NEED_OPENMP=1
+       fi
+
+       fortran-2_pkg_setup
+
+       MULTIBUILD_VARIANTS=( single double )
+}
+
+src_prepare() {
+       default
+
+       # fix info files
+       local infofile
+       for infofile in doc/fftw*info*; do
+               cat >> ${infofile} <<-EOF || die
+                       INFO-DIR-SECTION Libraries
+                       START-INFO-DIR-ENTRY
+                       * fftw: (fftw).                         ${DESCRIPTION}
+                       END-INFO-DIR-ENTRY
+               EOF
+       done
+
+       mv configure.{in,ac} || die
+       sed -i 's/AM_CONFIG_HEADER/AC_CONFIG_HEADERS/g' configure.ac || die
+
+       eautoreconf
+
+       # 'FAQ' is actually a dir and causes issues with einstalldocs
+       rm -r FAQ || die
+
+       multibuild_copy_sources
+}
+
+fftw_src_configure() {
+       local myconf=(
+               --with-gcc=$(tc-getCC)
+               --enable-shared
+               --enable-type-prefix
+               --enable-vec-recurse
+               $(use_enable fortran)
+               $(use_enable mpi)
+               $(use_enable static-libs static)
+               $(use_enable x86 i386-hacks)
+               $(use_with openmp)
+       )
+
+       if use openmp || use threads; then
+               myconf+=( --enable-threads )
+       else
+               myconf+=( --disable-threads )
+       fi
+
+       [[ $MULTIBUILD_VARIANT == single ]] && myconf+=( --enable-float )
+
+       econf "${myconf[@]}"
+}
+
+src_configure() {
+       # 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 use x86; then
+               is-flag -fomit-frame-pointer || append-flags 
-fomit-frame-pointer
+       fi
+       use openmp && [[ $(tc-getCC)$ == icc* ]] && append-ldflags 
$(no-as-needed)
+
+       multibuild_foreach_variant run_in_build_dir fftw_src_configure
+}
+
+src_compile() {
+       multibuild_foreach_variant run_in_build_dir default_src_compile
+}
+
+src_test() {
+       multibuild_foreach_variant run_in_build_dir default_src_test
+}
+
+src_install () {
+       use doc && HTML_DOCS=( doc/{*.html,*.gif} )
+       multibuild_foreach_variant run_in_build_dir default_src_install
+
+       doheader fortran/fftw_f77.i
+
+       create_fftw_symlinks() {
+               local i f letter=$1
+               for i in fft rfft; do
+                       for f in 
"${ED%/}"/usr/{include,$(get_libdir)}/*${letter}${i}*; do
+                               ln -s $(basename ${f}) ${f/${letter}${i}/${i}} 
|| die
+                       done
+               done
+       }
+       create_fftw_symlinks $(usex float s d)
+}

diff --git a/sci-libs/fftw/files/fftw-2.1.5-as-needed.patch 
b/sci-libs/fftw/files/fftw-2.1.5-as-needed.patch
index 2389f0e..63f46dc 100644
--- a/sci-libs/fftw/files/fftw-2.1.5-as-needed.patch
+++ b/sci-libs/fftw/files/fftw-2.1.5-as-needed.patch
@@ -1,5 +1,5 @@
---- rfftw/Makefile.am.orig     2008-04-03 15:23:06.989019659 +0000
-+++ rfftw/Makefile.am  2008-04-03 15:23:35.658653448 +0000
+--- a/rfftw/Makefile.am
++++ b/rfftw/Makefile.am
 @@ -18,6 +18,7 @@
                                         rfftw.h                   
  
@@ -8,8 +8,8 @@
  MAINTAINERCLEANFILES = $(CODELETS) rconfig.c
  DISTCLEANFILES = srfftw.h drfftw.h
  
---- threads/Makefile.am.orig   2008-04-03 15:23:10.101197011 +0000
-+++ threads/Makefile.am        2008-04-03 15:23:35.662653676 +0000
+--- a/threads/Makefile.am
++++ b/threads/Makefile.am
 @@ -28,6 +28,10 @@
                               -version-info @SHARED_VERSION_INFO@ \
                               -rpath $(libdir)
@@ -33,8 +33,8 @@
  @FFTW_PREFIX1@rfftw_threads.h: rfftw_threads.h
        rm -f $@
        sed 's/\"fftw/\"@FFTW_PREFIX@fftw/g;s/\"rfftw/\"@FFTW_PREFIX@rfftw/g' 
$(srcdir)/rfftw_threads.h > $@
---- mpi/Makefile.am.orig       2008-04-03 15:22:43.811698858 +0000
-+++ mpi/Makefile.am    2008-04-03 15:25:50.930362143 +0000
+--- a/mpi/Makefile.am
++++ b/mpi/Makefile.am
 @@ -28,6 +28,9 @@
                           -version-info @SHARED_VERSION_INFO@ \
                           -rpath $(libdir)
@@ -92,8 +92,8 @@
  
  # for some reason, automake tries to use autoheader in order to
  # generate config.h.in, and fails because config.h.in is GNU-lly
---- mpi/test_sched.c.orig      2008-04-03 16:58:01.969033125 +0000
-+++ mpi/test_sched.c   2008-04-03 16:59:27.521908505 +0000
+--- a/mpi/test_sched.c
++++ b/mpi/test_sched.c
 @@ -27,6 +27,8 @@
       int **sched;
       int npes = -1, sortpe = -1, steps;

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 718e746..7abe3e7 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-07-09 17:52:16.762461233 +0100
-+++ configure.in       2008-07-09 18:34:13.106471656 +0100
+--- a/configure.in
++++ b/configure.in
 @@ -1,6 +1,8 @@
 +
  dnl Process this file with autoconf to produce a configure script.

diff --git a/sci-libs/fftw/files/fftw-2.1.5-no-test.patch 
b/sci-libs/fftw/files/fftw-2.1.5-no-test.patch
index f9f54f6..cc844a4 100644
--- a/sci-libs/fftw/files/fftw-2.1.5-no-test.patch
+++ b/sci-libs/fftw/files/fftw-2.1.5-no-test.patch
@@ -1,13 +1,13 @@
---- tests/Makefile.am.orig     2008-06-22 12:29:53.149138283 +0100
-+++ tests/Makefile.am  2008-06-22 12:30:32.731595087 +0100
+--- a/tests/Makefile.am
++++ b/tests/Makefile.am
 @@ -1,4 +1,4 @@
 -noinst_PROGRAMS = fftw_test rfftw_test
 +check_PROGRAMS = fftw_test rfftw_test
  noinst_HEADERS = test_main.h
  
  FFTWDIR=../fftw
---- mpi/Makefile.am.orig       2008-06-22 17:21:16.998466390 +0100
-+++ mpi/Makefile.am    2008-06-22 17:27:42.996463162 +0100
+--- a/mpi/Makefile.am
++++ b/mpi/Makefile.am
 @@ -4,8 +4,8 @@
  
  lib_LTLIBRARIES = @FFTW_MPI_LIBLIST@
@@ -18,8 +18,8 @@
  EXTRA_LTLIBRARIES = lib@FFTW_PREFIX@fftw_mpi.la \
                      lib@FFTW_PREFIX@rfftw_mpi.la
  EXTRA_HEADERS = @FFTW_PREFIX@fftw_mpi.h @FFTW_PREFIX@rfftw_mpi.h 
---- threads/Makefile.am.orig   2008-06-22 17:18:18.940409610 +0100
-+++ threads/Makefile.am        2008-06-22 17:28:00.485459803 +0100
+--- a/threads/Makefile.am
++++ b/threads/Makefile.am
 @@ -4,9 +4,9 @@
  
  lib_LTLIBRARIES = @FFTW_THREADS_LIBLIST@

Reply via email to