# -*- 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           compilers 1.0
PortGroup           github 1.0
PortGroup           linear_algebra 1.0
PortGroup           legacysupport 1.1
PortGroup           mpi 1.0

# clock_gettime
legacysupport.newest_darwin_requires_legacy 15

github.setup        starpu-runtime starpu 1.4.7 starpu-
revision            0
categories          devel
license             LGPL-2.1
maintainers         nomaintainer
description         Unified runtime system for heterogeneous multicore architectures
long_description    StarPU is a runtime system that offers support for heterogeneous multicore machines. \
                    While many efforts are devoted to design efficient computation kernels \
                    for those architectures (e.g. to implement BLAS kernels on GPUs), StarPU \
                    not only takes care of offloading such kernels (and implementing data coherency \
                    across the machine), but it also makes sure the kernels are executed as efficiently as possible.
homepage            https://starpu.gitlabpages.inria.fr
checksums           rmd160  c9ac505248ecb70730082862dc7b2229f0aeb1b5 \
                    sha256  bf8c351f46c427705a7cfdcef67ca30de47c1289bbd7da717c2f795d82b9452b \
                    size    13728110
github.tarball_from archive

patchfiles          autogen.sh.patch

compiler.blacklist-append \
                    *gcc-4.* {clang < 400}
compilers.choose    fc f90 f77 cc

# Until mpich-defailt is enabled with gcc:
if {${os.platform} eq "darwin" && ${os.arch} eq "powerpc"} {
    mpi.setup       require require_fortran \
                    -gcc44 -gcc45 -gcc46 -gcc47 -gcc48 -gcc49 \
                    -clang -fortran
} else {
    mpi.setup       require require_fortran \
                    -gcc44 -gcc45 -gcc46 -gcc47 -gcc48 -gcc49
}

use_autoreconf      yes
autoreconf.cmd      ./autogen.sh

depends_build-append \
                    port:autoconf \
                    port:automake \
                    port:libtool \
                    port:pkgconfig
depends_lib-append  port:fftw-3 \
                    port:hwloc

configure.args-append \
                    --disable-silent-rules \
                    --with-mpiexec=${prefix}/bin/${mpi.exec} \
                    --with-mpicc=${prefix}/bin/${mpi.cc} \
                    --with-mpicxx=${prefix}/bin/${mpi.cxx} \
                    --with-mpifort=${prefix}/bin/${mpi.f90}

# Making a variant due to https://trac.macports.org/ticket/67273
variant hdf5 description "Enable HDF5 support" {
    depends_lib-append \
                    port:hdf5
    require_active_variants hdf5 fortran
    configure.args-append \
                    --enable-hdf5 \
                    --with-hdf5-include-dir=${prefix}/include \
                    --with-hdf5-lib-dir=${prefix}/lib
}

# Run complete test suite:
test.run            yes
test.cmd            make check -k
test.target
