Permalink
Fetching contributors…
Cannot retrieve contributors at this time
171 lines (156 sloc) 6.88 KB
# -*- 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
compilers.choose f90 cxx
compilers.setup require_fortran -clang
mpi.setup
mpi.enforce_variant netcdf-fortran
name esmf
version 7_1_0r
categories science devel
platforms darwin
license UoI-NCSA
maintainers {takeshi @tenomoto}
description software for building and coupling weather, climate, and related models
long_description The ESMF defines an architecture for composing complex, coupled \
modeling systems and includes data structures \
and utilities for developing individual models.
homepage http://esmf-cu.colorado.edu
master_sites http://www.earthsystemmodeling.org/esmf_releases/public/ESMF_${version}
checksums rmd160 d0f4cdeacf572dccef6615131036ff262d82611a \
sha256 ae9a5edb8d40ae97a35cbd4bd00b77061f995c77c43d36334dbb95c18b00a889
depends_build bin:ranlib:cctools \
bin:install_name_tool:cctools
depends_lib port:netcdf-fortran \
port:xercesc3
distname ${name}_${version}_src
worksrcdir ${name}
post-patch {
if {[variant_isset openmpi]} {
foreach c {g95 gfortran gfortranclang} {
reinplace "s| -lmpi_f77||" ${worksrcpath}/build_config/Darwin.${c}.default/build_rules.mk
}
}
}
pre-configure {
if {${configure.cxx_stdlib} eq "libc++" && ![mpi_variant_isset]} {
reinplace "s|stdc++|c++|" ${worksrcpath}/build_config/Darwin.gfortranclang.default/build_rules.mk
reinplace "s|stdc++|c++|" ${worksrcpath}/build_config/Darwin.g95.default/build_rules.mk
}
}
if {![variant_isset atlas]} {
default_variants +accelerate
}
use_configure no
if {[variant_isset gcc47] || [variant_isset gcc48] || [variant_isset gcc49] || [variant_isset gcc5]} {
configure.cxxflags-append -std=c++11
} elseif {[variant_isset gcc44] || [variant_isset gcc45] || [variant_isset gcc46]} {
configure.cxxflags-append -std=c++0x
}
build.target lib
pre-build {
build.env ESMF_DIR=${worksrcpath} \
ESMF_F90=${configure.f90} \
ESMF_F90COMPILEOPTS="${configure.f90flags}" \
ESMF_CXX=${configure.cxx} \
ESMF_CXXCOMPILEOPTS="${configure.cxxflags}" \
ESMF_NETCDF=split \
ESMF_NETCDF_INCLUDE=${prefix}/include \
ESMF_NETCDF_LIBPATH=${prefix}/lib \
ESMF_XERCES=standard \
ESMF_XERCES_INCLUDE=${prefix}/include \
ESMF_XERCESF_LIBPATH=${prefix}/lib \
ESMF_XERCES_LIBS=-lxerces-c
if {[variant_isset accelerate]} {
build.env-append ESMF_LAPACK=system \
ESMF_LAPACK_LIBS=-lvecLibFort
} elseif {[variant_isset atlas]} {
build.env-append ESMF_LAPACK=system \
ESMF_LAPACK_LIBS=-lsatlas
}
build.args-append ESMF_LIBDIR=${worksrcpath}/lib
if {[variant_isset g95]} {
build.env-append ESMF_COMPILER=g95
} else {
if {[string match *clang* ${configure.cxx}]} {
build.env-append ESMF_COMPILER=gfortranclang
} else {
build.env-append ESMF_COMPILER=gfortran
}
}
if {[variant_isset mpich] || [variant_isset mpich_devel]} {
build.env-append ESMF_COMM=mpich2
} elseif {[variant_isset openmpi] || [variant_isset openmpi_devel]} {
build.env-append ESMF_COMM=openmpi
} else {
build.env-append ESMF_COMM=mpiuni
}
}
pre-destroot {
destroot.env ESMF_DIR=${worksrcpath} \
ESMF_F90=${configure.f90} \
ESMF_F90COMPILEOPTS="${configure.f90flags}" \
ESMF_F90LINKOPTS="-L${worksrcpath}/lib ${configure.ldflags}" \
ESMF_CXX=${configure.cxx} \
ESMF_CXXCOMPILEOPTS="${configure.cxxflags}" \
ESMF_CXXLINKOPTS="-L${worksrcpath}/lib ${configure.ldflags}" \
ESMF_NETCDF=split \
ESMF_NETCDF_INCLUDE=${prefix}/include \
ESMF_NETCDF_LIBPATH=${prefix}/lib \
ESMF_XERCES=standard \
ESMF_XERCES_INCLUDE=${prefix}/include \
ESMF_XERCESF_LIBPATH=${prefix}/lib \
ESMF_XERCES_LIBS=-lxerces-c \
ESMF_INSTALL_PREFIX=${destroot}${prefix} \
ESMF_INSTALL_HEADERDIR=${destroot}${prefix}/include/${name} \
ESMF_INSTALL_MODDIR=${destroot}${prefix}/include/${name} \
ESMF_INSTALL_LIBDIR=${destroot}${prefix}/lib \
ESMF_INSTALL_BINDIR=${destroot}${prefix}/bin \
ESMF_INSTALL_DOCDIR=${destroot}${prefix}/share/doc/${name}
if {[variant_isset accelerate]} {
destroot.env-append ESMF_LAPACK=system \
ESMF_LAPACK_LIBS=-lvecLibFort
} elseif {[variant_isset atlas]} {
destroot.env-append ESMF_LAPACK=system \
ESMF_LAPACK_LIBS=-lsatlas
}
destroot.args-append ESMF_LIBDIR=${worksrcpath}/lib
if {[variant_isset g95]} {
destroot.env-append ESMF_COMPILER=g95
} else {
if {[string match *clang* ${configure.cxx}]} {
destroot.env-append ESMF_COMPILER=gfortranclang
} else {
destroot.env-append ESMF_COMPILER=gfortran
}
}
if {[variant_isset mpich] || [variant_isset mpich_devel]} {
destroot.env-append ESMF_COMM=mpich2
} elseif {[variant_isset openmpi] || [variant_isset openmpi_devel]} {
destroot.env-append ESMF_COMM=openmpi
} else {
destroot.env-append ESMF_COMM=mpiuni
}
}
variant accelerate conflicts atlas description {use Accelerate framework for LAPACK} {
depends_lib-append port:vecLibFort
}
variant atlas conflicts accelerate description {use Atlas for LAPACK} {
depends_lib-append port:atlas
}
post-destroot {
reinplace "s|${destroot}||g" ${destroot}${prefix}/lib/esmf.mk
reinplace "s|-L${worksrcpath}/lib||g" ${destroot}${prefix}/lib/esmf.mk
reinplace "s|-I${worksrcpath}/src/Infrastructure/stubs|-I${prefix}/share/esmf/src/Infrastructure/stubs|g" ${destroot}${prefix}/lib/esmf.mk
xinstall -d ${destroot}${prefix}/share/${name}
file copy ${worksrcpath}/src ${destroot}${prefix}/share/${name}
system -W ${destroot}${prefix}/lib "ranlib libesmf.a"
foreach l {libesmf.dylib libesmf_fullylinked.dylib} {
if {[file exists ${destroot}${prefix}/lib/${l}]} {
system -W ${destroot}${prefix}/lib "
install_name_tool -id ${prefix}/lib/${l} ${l}
"
}
}
}