# -*- 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
# $Id: Portfile 92833 2012-05-08 23:46:29Z ryandesign@macports.org $

PortSystem          1.0

name                fortrancl
version             0.1alpha3
categories          devel parallel science
platforms           darwin
license             LGPL
maintainers         takeshi
description         OpenCL Fortran 90 interface
long_description    \
   FortranCL is an OpenCL interface for Fortran 90. \
   It allows programmers to call the OpenCL parallel programming framework \
   directly from Fortran, so developers can accelerate their Fortran code \
   using graphical processing units (GPU) and other accelerators.
homepage            http://code.google.com/p/fortrancl/
master_sites        googlecode

checksums           rmd160  4919f317f0f64bd730a9c045c454e4c08d602ff8 \
                    sha256 4d99864b8d9c10d13e4047a2016d16fd78e96e0744b29c36c442636a3ef1d3b8

pre-fetch {
    if {${os.major} < 10} {
        return -code error "OpenCL is not available. Snow Leopard or newer is required."
    }
}

configure.cppflags-append   -framework OpenCL
configure.args              --enable-shared

post-destroot {
    xinstall -d -m 755 ${destroot}${prefix}/share/${name}/examples
    xinstall -m 644 -W ${worksrcpath}/examples \
        devices.f90 sum.cl sum.f90 \
        ${destroot}${prefix}/share/${name}/examples/
}

if {![variant_isset g95]} {
   default_variants +gcc45
}

variant gcc45 conflicts g95 description {build with gfortran-mp-4.5} {
   depends_build-append    port:gcc45
   configure.compiler      macports-gcc-4.5
}

variant g95 conflicts gcc45 description {build with g95} {
   depends_build-append    port:gcc45
   configure.fc            g95
}
