# -*- 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

PortSystem          1.0
PortGroup           mpi 1.0

name                fftw
version             2.1.5
revision            9
categories          math devel
license             GPL-2+
maintainers         {sean @seanfarley}
description         Fast C routines to compute the Discrete Fourier Transform
long_description \
    FFTW is a C subroutine library for computing the Discrete Fourier \
    Transform (DFT) in one or more dimensions, of both real and complex \
    data, and of arbitrary input size. We believe that FFTW, which is \
    free software, should become the FFT library of choice for most \
    applications. Our benchmarks, performed on a variety of platforms, \
    show that FFTW's performance is typically superior to that of other \
    publicly available FFT software. Moreover, FFTW's performance is \
    portable: the program will perform well on most architectures \
    without modification.

platforms           darwin

homepage            http://www.fftw.org/
master_sites        ${homepage} \
                    ftp://ftp.fftw.org/pub/fftw/ \
                    ftp://ftp.kusastro.kyoto-u.ac.jp/pub/src/GNU/fftw/

checksums           rmd160  723308722d76c12710db6473979adf8d086b0909 \
                    sha256  f8057fae1c7df8b99116783ef3e94a6a44518d49c72e2e630c24b689c6022630

# don't change configure.cc, etc. since we'll take care of that manually with
# MPICC env var
mpi.setup           require_fortran

configure.args      --enable-type-prefix --enable-threads \
                    --enable-fortran --infodir=${prefix}/share/info \
                    --enable-shared

# TODO: Fix to build with muniversal
universal_variant   no

platform darwin {
    patchfiles-append patch-configure_darwin
}

post-destroot {
    xinstall -m 644 ${worksrcpath}/fortran/fftw_f77.i ${destroot}${prefix}/include
}

if {[mpi_variant_isset]} {
    configure.args-append --enable-mpi

    post-extract {
        reinplace "s/mpicc/${mpi.cc} mpicc/" configure
    }
}

subport fftw-single {
    configure.args-append --enable-float

    depends_lib port:fftw

    post-destroot  {
        delete ${destroot}${prefix}/share
        delete ${destroot}${prefix}/include/fftw_f77.i
    }
}

livecheck.type      none
