# -*- 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           compilers 1.0
PortGroup           github 1.0
PortGroup           makefile 1.0

github.setup        interkosmos fortran-pcre2 0.1.1
revision            0
categories          fortran devel
license             ISC
maintainers         {@barracuda156 gmail.com:vital.had} openmaintainer
description         Fortran 2018 ISO_C_BINDING interfaces \
                    to Perl-compatible Regular Expressions 2
long_description    {*}${description}
checksums           rmd160  5563fecfd65b25fb665d1be4f05bd83836753766 \
                    sha256  dfd5c88d15ffcb7ff16d1bbd588259b144508a1d875275c61f886342ae04286b \
                    size    9748
github.tarball_from archive

depends_lib-append  port:pcre2

patchfiles-append   patch-Makefile.diff

post-patch {
    reinplace "s,@PREFIX@,${prefix}," ${worksrcpath}/Makefile
    reinplace "s,@FC@,${configure.fc}," ${worksrcpath}/Makefile
    reinplace "s,@FFLAGS@,${configure.fcflags}," ${worksrcpath}/Makefile
}

compilers.setup     require_fortran
compiler.blacklist-append \
                    *gcc-4.* {clang < 500}

build.target        all test

use_parallel_build  no

destroot.args-append \
                    PREFIX=${destroot}${prefix}

test.run            yes
test.cmd            ./test_pcre2
test.target
