# -*- 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               github 1.0
PortGroup               legacysupport 1.1

# clock_{get,set}time, getline, O_CLOEXEC
legacysupport.newest_darwin_requires_legacy 15

github.setup            hercules-team augeas 1.14.1 release-
github.tarball_from     releases
revision                0
categories              sysutils
license                 LGPL-2.1+
maintainers             nomaintainer

description             configuration editing tool

long_description        ${name} is a {*}${description}. It parses configuration \
                        files in their native formats and transforms them \
                        into a tree. Configuration changes are made by \
                        manipulating this tree and saving it back into native \
                        config files

homepage                https://augeas.net/

checksums               rmd160  5eb6aada45acd6adc5d45a7756eb8f48c33b5cf7 \
                        sha256  368bfdd782e4b9c7163baadd621359c82b162734864b667051ff6bcb57b9edff \
                        size    2653776

depends_build-append    path:bin/pkg-config:pkgconfig \
                        port:naturaldocs
depends_lib-append      port:readline \
                        port:libxml2

# Remove after augeas 1.14.1
patchfiles              0001-CVE-2025-2588-return-_REG_ENOSYS-if-no-specific-erro.patch

configure.args          --disable-silent-rules \
                        ac_cv_path_ND_PROG=${prefix}/bin/NaturalDocs \
                        ac_cv_prog_AWK=/usr/bin/awk

# this port doesn't build the examples as 32 bit <https://trac.macports.org/ticket/57897>
if {(!(${universal_possible} && [variant_isset universal]) && ${configure.build_arch} in "i386 ppc") ||
    (${universal_possible} && [variant_isset universal] &&
    ("i386" in ${configure.universal_archs} || "ppc" in ${configure.universal_archs}))} {
    post-patch {
        reinplace "s|examples||" ${worksrcpath}/Makefile.am
    }
    use_autoreconf       yes
}

post-destroot {
    file mkdir ${destroot}${prefix}/share/doc/${name}
    move ${worksrcpath}/doc/naturaldocs/output/c_api ${destroot}${prefix}/share/doc/${name}
    move ${worksrcpath}/doc/naturaldocs/output/lenses ${destroot}${prefix}/share/doc/${name}
}
