# -*- 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
PortGroup       active_variants 1.1

name            pfft
version         1.0.8-alpha
revision        3
categories      math
license         GPL-3
platforms       darwin
maintainers     {dstrubbe @dstrubbe}
homepage        https://www-user.tu-chemnitz.de/~potts/workgroup/pippig/software.php.en#pfft

master_sites    http://www.tu-chemnitz.de/~potts/workgroup/pippig/software

description     An extension of FFTW to massively parallel architectures

long_description \
PFFT is a parallel FFT software library based on MPI.

checksums       rmd160  afb6d254b2b517e4c39c8eb1e73166c5736b8087 \
                sha256  6c43960ad72fcff7e49b87c604c5f471fb5890f1bd11ce750ab52f035e7c5317

mpi.setup       require require_fortran

depends_lib     port:fftw-3
mpi.enforce_variant fftw-3

test.run        yes
test.target     check
# strangely, "make check" only builds the test executables but does not run them.
post-test {
    reinplace -W ${worksrcpath}/tests "s|mpirun|${mpi.exec}|g" run_checks.sh
    system -W ${worksrcpath}/tests ./run_checks.sh
}

use_parallel_build yes

pre-configure {
    if {![active_variants fftw-3 pfft_patches]} {
        ui_warn "You are recommended to install fftw-3 with variant +pfft_patches."
    }

    configure.args-append  MPICC=${mpi.cc} MPIFC=${mpi.f90} \
        CPPFLAGS=-I${prefix}/include LDFLAGS="-L${prefix} -lfftw3 -lfftw3_mpi"
}

livecheck.type  regex
# [sic], it is really pnfft in the URL even though that refers to a different piece of software
livecheck.url   https://www-user.tu-chemnitz.de/~potts/workgroup/pippig/software.php.en#pnfftDownloads
livecheck.regex ${name}-(\[0-9\\-a-z\.\]+).tar.gz
