source: trunk/dports/math/fftw-3/Portfile

Last change on this file was 154163, checked in by jeremyhu@…, 13 months ago

fftw-3: Workaround a build failure on Leopard

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 8.0 KB
Line 
1# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
2# $Id: Portfile 154163 2016-10-23 08:48:25Z ryandesign@macports.org $
3
4PortSystem      1.0
5PortGroup       muniversal 1.0
6PortGroup       compiler_blacklist_versions 1.0
7PortGroup       mpi 1.0
8
9name            fftw-3
10version         3.3.5
11categories      math
12license         GPL-2+
13platforms       darwin
14maintainers     sean
15homepage        http://www.fftw.org/
16distname        fftw-${version}
17
18master_sites \
19    ${homepage} \
20    ftp://ftp.fftw.org/pub/fftw/ \
21    ftp://ftp.kusastro.kyoto-u.ac.jp/pub/src/GNU/fftw/
22
23description \
24    Fast C routines to compute the Discrete Fourier Transform
25
26long_description \
27    FFTW is a C subroutine library for computing the \
28    Discrete Fourier Transform (DFT) in one or more \
29    dimensions, of both real and complex data, and of \
30    arbitrary input size. We believe that FFTW, which is \
31    free software, should become the FFT library of choice \
32    for most applications. Our benchmarks, performed on a \
33    variety of platforms, show that FFTW's performance is \
34    typically superior to that of other publicly available \
35    FFT software. Moreover, FFTW's performance is portable: \
36    the program will perform well on most architectures \
37    without modification. \
38    This port is of fftw version 3.x. It has many \
39    improvements relative to 2.x, but is not backwardly \
40    compatible.
41
42checksums           rmd160  d5800f3d56b7b499265633b52a0b9850b17c148e \
43                    sha256  8ecfe1b04732ec3f5b7d279fdb8efcad536d555f9d1e8fabd027037d45ea8bcf
44
45# Don't link with "-flat_namespace -undefined suppress" on Yosemite and
46# later (#45707).
47patchfiles \
48    yosemite-libtool.patch
49
50variant pfft_patches description {Apply patches recommended for use as dependency of pfft port} {
51    if {![mpi_variant_isset]} {
52        ui_warn "Variant +pfft_patches has no effect without setting an MPI variant."
53    }
54
55    # Cut from scripts at https://www-user.tu-chemnitz.de/~potts/workgroup/pippig/software.php.en#fftwinstall,
56    # except that the last hunk of mpi/transpose-pairwise.c has been incorporated into 3.3.5 already.
57    #Important: Within these scripts we apply the following patches that have been submitted to FFTW but are not yet included in FFTW-3.3.4:
58    #  We add two more global transposition algorithms to the planner.
59    #  We patch file mpi/transpose-pairwise.c in order to fix a double free bug.
60    patchfiles-append patch-pfft.diff
61
62    # mpi/Makefile.am is modified, and effects are complicated to emulate with a patch to mpi/Makefile.in
63    use_autoreconf yes
64}
65
66# don't change configure.cc, etc. since we'll take care of that manually with
67# MPICC env var
68mpi.setup
69
70# blacklist older versions of clang which do not handle the --enable-avx option (#41622, #41673)
71compiler.blacklist-append {clang <= 211.10.1} gcc-4.2
72
73configure.args \
74    --enable-threads \
75    --disable-fortran \
76    --enable-shared
77
78configure.cflags-append \
79    -fno-common \
80    -O3 \
81    -fomit-frame-pointer \
82    -fstrict-aliasing
83
84pre-configure {
85    if { [avx_compiler_isset] == 1 } {
86        array set merger_configure_args {
87            ppc    "--enable-fma"
88            ppc64  "--enable-fma"
89            i386   "--enable-sse2 --enable-avx"
90            x86_64 "--enable-sse2 --enable-avx"
91        }
92    } else {
93        array set merger_configure_args {
94            ppc    "--enable-fma"
95            ppc64  "--enable-fma"
96            i386   "--enable-sse2"
97            x86_64 "--enable-sse2"
98        }
99    }
100}
101
102test.run     yes
103test.target  check
104
105use_parallel_build yes
106
107platform darwin {
108  if {${os.major} < 10} {
109    configure.args-append --with-our-malloc
110  }
111}
112
113platform powerpc {
114  if {![variant_isset universal]} {
115    configure.args-append --enable-fma
116  }
117}
118
119subport fftw-3-single {
120    configure.args-append --enable-float
121
122    depends_lib port:fftw-3
123
124    platform powerpc {
125        if {![variant_isset universal]} {
126            configure.args-append --enable-altivec
127        }
128    }
129
130    pre-configure {
131        if { [avx_compiler_isset] == 1 } {
132            array set merger_configure_args {
133                ppc    "--enable-fma --enable-altivec"
134                ppc64  "--enable-fma --enable-altivec"
135                i386   "--enable-sse --enable-avx"
136                x86_64 "--enable-sse --enable-avx"
137            }
138        } else {
139            array set merger_configure_args {
140                ppc    "--enable-fma --enable-altivec"
141                ppc64  "--enable-fma --enable-altivec"
142                i386   "--enable-sse"
143                x86_64 "--enable-sse"
144            }
145        }
146
147        platform i386 {
148            if {![variant_isset universal]} {
149                configure.args-delete --enable-sse2
150                configure.args-append --enable-sse
151                if { [avx_compiler_isset] == 1 } {
152                    configure.args-append --enable-avx
153                }
154            }
155        }
156    }
157
158    post-destroot {
159        file delete ${destroot}${prefix}/include/fftw3.f
160        file delete ${destroot}${prefix}/include/fftw3.f03
161        file delete ${destroot}${prefix}/include/fftw3l.f03
162        file delete ${destroot}${prefix}/include/fftw3q.f03
163        file delete ${destroot}${prefix}/include/fftw3.h
164        file delete ${destroot}${prefix}/bin/fftw-wisdom-to-conf
165        file delete ${destroot}${prefix}/share/man/man1/fftw-wisdom-to-conf.1
166        file delete ${destroot}${prefix}/share/info/fftw3.info
167        file delete ${destroot}${prefix}/share/info/fftw3.info-1
168        file delete ${destroot}${prefix}/share/info/fftw3.info-2
169        file delete ${destroot}${prefix}/share/info/fftw3.info-3
170        file delete ${destroot}${prefix}/share/info/fftw3.info-4
171        file delete ${destroot}${prefix}/share/info/fftw3.info-5
172
173        if {[mpi_variant_isset]} {
174          file delete ${destroot}${prefix}/include/fftw3-mpi.f03
175          file delete ${destroot}${prefix}/include/fftw3-mpi.h
176          file delete ${destroot}${prefix}/include/fftw3l-mpi.f03
177        }
178    }
179}
180
181subport fftw-3-long {
182    configure.args-append --enable-long-double
183
184    depends_lib port:fftw-3
185
186    pre-configure {
187        array set merger_configure_args {
188            ppc    ""
189            ppc64  ""
190            i386   ""
191            x86_64 ""
192        }
193    }
194
195    post-destroot {
196        file delete ${destroot}${prefix}/include/fftw3.f
197        file delete ${destroot}${prefix}/include/fftw3.f03
198        file delete ${destroot}${prefix}/include/fftw3l.f03
199        file delete ${destroot}${prefix}/include/fftw3q.f03
200        file delete ${destroot}${prefix}/include/fftw3.h
201        file delete ${destroot}${prefix}/bin/fftw-wisdom-to-conf
202        file delete ${destroot}${prefix}/share/man/man1/fftw-wisdom-to-conf.1
203        file delete ${destroot}${prefix}/share/info/fftw3.info
204        file delete ${destroot}${prefix}/share/info/fftw3.info-1
205        file delete ${destroot}${prefix}/share/info/fftw3.info-2
206        file delete ${destroot}${prefix}/share/info/fftw3.info-3
207        file delete ${destroot}${prefix}/share/info/fftw3.info-4
208        file delete ${destroot}${prefix}/share/info/fftw3.info-5
209
210        if {[mpi_variant_isset]} {
211          file delete ${destroot}${prefix}/include/fftw3-mpi.f03
212          file delete ${destroot}${prefix}/include/fftw3-mpi.h
213          file delete ${destroot}${prefix}/include/fftw3l-mpi.f03
214        }
215    }
216}
217
218if {${os.arch} eq "i386"} {
219    lappend merger_configure_args(ppc)     "--disable-fortran"
220    lappend merger_configure_args(ppc64)   "--disable-fortran"
221} else {
222    lappend merger_configure_args(i386)    "--disable-fortran"
223    lappend merger_configure_args(x86_64)  "--disable-fortran"
224}
225
226if {[fortran_variant_isset]} {
227    configure.args-delete --disable-fortran
228}
229
230pre-configure {
231    if {[mpi_variant_isset]} {
232        # MPIRUN is needed for test phase
233        configure.env           MPICC=${mpi.cc} MPIRUN=${mpi.exec}
234        configure.args-append   --enable-mpi
235    }
236}
237
238if {${name} eq ${subport}} {
239    livecheck.type  regex
240    livecheck.url   ${homepage}
241    livecheck.regex {FFTW (\d+(?:\.\d+)*) is the latest}
242} else {
243    livecheck.type  none
244}
Note: See TracBrowser for help on using the repository browser.