# -*- 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 cmake     1.1
PortGroup mpi       1.0
PortGroup boost     1.0

name                metview
version             5.25.1
revision            0
maintainers         {takeshi @tenomoto}
license             Apache-2
categories          science
description         meteorological workstation application
homepage            https://confluence.ecmwf.int/display/METV/
master_sites        https://confluence.ecmwf.int/download/attachments/3964985/
distname            Metview-${version}-Source
checksums           rmd160  d27c776a72b0aaa504449e23317d3576a1932606 \
                    sha256  9ad8ff93e31f2705799829cb61356b971bea4b61a27ddbdc33df302a02c862fd \
                    size    51383611
long_description \
    Metview is a meteorological workstation application designed to be \
    a complete working environment for both the operational and research meteorologist. \
    Its capabilities include powerful data access, processing and visualisation.

fetch.ignore_sslcert    yes

compilers.choose    cxx fc
mpi.setup           require_fortran -g95
compilers.enforce_fortran \
                    port:ecCodes

depends_extract     bin:gnutar:gnutar
depends_build-append \
                    port:bison \
                    port:ImageMagick \
                    port:xdpyinfo
depends_lib-append  path:lib/pkgconfig/cairo.pc:cairo \
                    port:curl \
                    port:expat \
                    port:fontconfig \
                    port:freetype \
                    port:gdbm \
                    port:gettext \
                    port:ecCodes \
                    port:hdf5 \
                    port:jasper \
                    path:include/turbojpeg.h:libjpeg-turbo \
                    port:libaec \
                    port:libpng \
                    port:magicspp \
                    port:netcdf \
                    port:netcdf-cxx \
                    port:openjpeg \
                    port:proj9 \
                    port:qt5-qtwebkit \
                    port:xorg-libice \
                    port:xorg-libsm \
                    port:xorg-libX11 \
                    port:xorg-libXmu \
                    port:xorg-libXt \
                    port:zlib \
                    path:lib/pkgconfig/glib-2.0.pc:glib2 \
                    path:lib/pkgconfig/pango.pc:pango
depends_run         bin:ksh:ksh93

require_active_variants \
                    magicspp qt5

extract.post_args   "| gnutar -x"

cmake.out_of_source yes

cmake.install_prefix    ${prefix}/lib/${name}
configure.cppflags-append \
                    -I${prefix}/lib/proj9/include
configure.args-append \
                    -DBISON_EXECUTABLE=${prefix}/bin/bison \
                    -DCMAKE_BUILD_TYPE=RelWithDebinfo \
                    -DENABLE_EXPOSE_SUBPACKAGES=ON \
                    -DECBUILD_GIT=OFF \
                    -DENABLE_AEC=ON \
                    -DAEC_PATH=${prefix}/lib/libaec \
                    -DENABLE_ARMADILLO=OFF \
                    -DENABLE_EIGEN=OFF \
                    -DENABLE_CUDA=OFF \
                    -DENABLE_GRIDTOOLS_STORAGE=OFF \
                    -DENABLE_LAPACK=OFF \
                    -DENABLE_MARS=OFF \
                    -DENABLE_MKL=OFF \
                    -DENABLE_MPI=OFF \
                    -DENABLE_MIR_DOWNLOAD_MASKS=OFF \
                    -DENABLE_PNG=ON \
                    -DENABLE_PROJ=ON \
                    -DPROJ_PATH=${prefix}/lib/proj9 \
                    -DENABLE_TEST_ASSERTIONS=OFF \
                    -DENABLE_TESTS=OFF \
                    -DMETVIEW_INSTALL_EXE_BIN_DIR=lib/${name}/bin \
                    -DWITH_PLOTTING=ON \
                    -DMAGICS_PATH=${prefix} \
                    -DECCODES_PATH=${prefix}

notes "Install Python interface from pypi e.g.
pip install --user metview
"
livecheck.type      regex
livecheck.url       ${homepage}/Releases
livecheck.regex     {Metview-([0-9]+\.[0-9]+\.[0-9]+)-Source.tar.gz}
