# -*- 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

name            h4h5tools
version         2.2.3
revision        16
categories      science
# Equivalent to BSD + explicitly requiring modifications to be documented
license         Permissive
platforms       darwin
maintainers     nomaintainer

description     HDF4 to HDF5 conversion tools.
long_description    Provides the h4toh5 conversion utility and library.

homepage        https://support.hdfgroup.org/products/hdf5_tools/h4toh5/
master_sites    https://www.hdfgroup.org/ftp/HDF5/tools/h4toh5/src/

checksums       rmd160  e70b41006334085cbd00fdcad9448bfb7b5cde3e \
                sha256  ba167d9e5ec1f9014a95e3f5d0621f814caa6e83508e235ce60cfd315e3a9d3f \
                size    2666039

# https://trac.macports.org/ticket/62917
patchfiles-append patch-h4h5tools.diff

depends_lib-append \
                port:hdf4 \
                port:hdf5 \
                port:hdfeos \
                port:netcdf

configure.args-append \
                --with-hdfeos2=${prefix}
configure.cppflags \
                -I${prefix}/include
configure.ldflags \
                -L${prefix}/lib
configure.env-append \
                "LIBS=-ldf -lmfhdf"

post-destroot {
    xinstall -m 755 -d ${destroot}${prefix}/share/doc/${name}
    xinstall -m 644 -W ${worksrcpath} README.txt COPYING Copyright.html \
        ${destroot}${prefix}/share/doc/${name}

    xinstall -m 755 -d ${destroot}${prefix}/share/doc/${name}/pdf
    xinstall -m 644 -W ${worksrcpath}/doc \
        H4H5ProgrammersNotes.pdf h4toh5lib_RM.pdf h4toh5lib_UG.pdf \
        ${destroot}${prefix}/share/doc/${name}/pdf

    xinstall -m 755 -d ${destroot}${prefix}/share/doc/${name}/html
    xinstall -m 644 -W ${worksrcpath}/doc \
        h4toh5lib_RM.html h4toh5lib_UG.html \
        ${destroot}${prefix}/share/doc/${name}/html
}

livecheck.type  regex
livecheck.url   ${homepage}
livecheck.regex {Current Release:</note> &nbsp; ([0-9]+\.[0-9.]+)<br />}
