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

# readlinkat
legacysupport.newest_darwin_requires_legacy 13

name                        pkgconf
version                     3.0.9
revision                    0
categories                  devel
license                     ISC
maintainers                 {mcalhoun @MarcusCalhoun-Lopez} openmaintainer
description                 a program which helps to configure compiler and linker flags for development libraries
long_description            pkgconf is ${description}. \
                            It is similar to pkg-config from freedesktop.org.

homepage                    https://github.com/pkgconf/pkgconf
master_sites                https://distfiles.ariadne.space/pkgconf/

checksums                   rmd160  20b29bed21ab967e28741307868432c482e7f3d8 \
                            sha256  642700ab125e6dcb3ceb822469420b0132c26f5585dec88cbe6057134525e57d \
                            size    626468

# both ports install ${prefix}/share/aclocal/pkg.m4
conflicts                   pkgconfig

# These are intended in order to filter ${prefix}/include and ${prefix}/lib
# See: https://trac.macports.org/ticket/73393
configure.args-append       -Dwith-pkg-config-dir="${prefix}/lib/pkgconfig:/usr/lib/pkgconfig" \
                            -Dwith-system-includedir=${configure.sdkroot}/usr/include \
                            -Dwith-system-libdir=/usr/lib

# pkgconf 3.0.9 doesn't contain the version change in meson
# See: https://github.com/pkgconf/pkgconf/issues/615
# Remove once resolved on the next release
post-extract {
    reinplace "s|version : '3.0.8'|version : '${version}'|" ${worksrcpath}/meson.build
}

post-destroot {
    # since ports already conflict, follow https://github.com/pkgconf/pkgconf/#pkg-config-symlink
    ln -s pkgconf ${destroot}${prefix}/bin/pkg-config
    ln -s pkgconf.1 ${destroot}${prefix}/share/man/man1/pkg-config.1
}

# Skip 'x.x.90+' (development) releases
livecheck.regex             {pkgconf-(\d+\.\d+\.(?!9[0-9])\d+)}
