# -*- 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                     ccfits
version                  2.7
revision                 1
categories               science
license                  BSD
maintainers              {mcalhoun @MarcusCalhoun-Lopez} openmaintainer

description              C++ interface for cfitsio

long_description         CCfits is an object oriented interface to the cfitsio \
                         library. It is designed to make the capabilities of \
                         cfitsio available to programmers working in C++.

homepage                 https://heasarc.gsfc.nasa.gov/docs/software/fitsio/ccfits/
master_sites             https://heasarc.gsfc.nasa.gov/FTP/software/fitsio/ccfits/v${version}/
distname                 CCfits-${version}

checksums               rmd160  2d3909fe2429e95cdab11e096393cd92bf72092a \
                        sha256  f63546d2feecbf732cc08aaaa80a2eb5334ada37fb2530181b7363a5dbdeb01a \
                        size    1669087

depends_build-append    port:libtool
depends_lib-append      port:cfitsio

configure.args-append   --with-cfitsio=${prefix}

# avoid depends_build-append path:libexec/coreutils/libstdbuf.so:coreutils
configure.env-append    "MKDIR_P=/bin/mkdir -p"

# avoid depends_build-append port:gmake
configure.env-append    GMAKE=/usr/bin/make

# configure: error: *** A compiler with support for C++14 language features is required
compiler.cxx_standard   2014

post-configure {
    # when linking, libtool does not respect -arch
    delete              ${worksrcpath}/libtool
    xinstall -m 0755    ${prefix}/bin/glibtool \
                        ${worksrcpath}/libtool
}

post-destroot {
    set docdir ${destroot}${prefix}/share/doc/${name}
    xinstall -m 0755 -d ${docdir}
    xinstall -m 0755 -d ${docdir}/html
    xinstall -m 0755 -d ${docdir}/pdf

    xinstall -m 0644    ${worksrcpath}/License.txt \
                        ${docdir}

    xinstall -m 0644    {*}[glob ${worksrcpath}/html/*.html] \
                        {*}[glob ${worksrcpath}/html/*.css] \
                        {*}[glob ${worksrcpath}/html/*.png] \
                        ${docdir}/html

    xinstall -m 0644    {*}[glob ${worksrcpath}/*.pdf] \
                        ${docdir}/pdf
}

livecheck.regex         {Version (\d+(?:\.\d+)*)}
