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

# Because this port only installs a static library, revbump all ports that link
# with this library when this port's version is changed.

name                libf2c
version             20240131
revision            0
checksums           rmd160  f4c60aeaef8a5bc1e45b80f31d88ed8bb76dc2b2 \
                    sha256  cc84253b47b5c036aa1d529332a6c218a39ff71c76974296262b03776f822695 \
                    size    130671

categories          lang
maintainers         {ryandesign @ryandesign} openmaintainer

description         library to which you must link code you have converted from Fortran to C using f2c

long_description    ${name} is the ${description}.

homepage            https://netlib.org/f2c/
master_sites        ${homepage}
dist_subdir         ${name}/${version}
distname            ${name}
use_zip             yes

extract.mkdir       yes

patchfiles          patch-makefile.u.diff

use_configure       no

variant universal {}

build.args          -f makefile.u \
                    CC="${configure.cc} [get_canonical_archflags cc]" \
                    CFLAGS="${configure.cflags}"

pre-build {
    system -W ${worksrcpath} "${build.cmd} [join ${build.args}] hadd"
}

destroot.args       [join ${build.args}]
destroot.destdir    LIBDIR=${destroot}${prefix}/lib

post-destroot {
    xinstall -m 0644 ${worksrcpath}/f2c.h ${destroot}${prefix}/include
    set docdir ${prefix}/share/doc/${name}
    xinstall -d ${destroot}${docdir}
    xinstall -m 0644 ${worksrcpath}/Notice ${destroot}${docdir}
}

livecheck.type      moddate
livecheck.url       [lindex ${master_sites} 0]${distfiles}
