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

# getline
legacysupport.newest_darwin_requires_legacy 10

github.setup        alba4k albafetch 4.3 v
revision            0

description         Faster neofetch alternative, written in C
long_description    ${name} is a simple and fast program to display \
                    a lot of system information in a neofetch-like layout \
                    in way less than a second.

categories          sysutils
installs_libs       no
license             MIT
maintainers         nomaintainer

checksums           rmd160  099e39ff409643b6c8686ad60604194290703fc6 \
                    sha256  3eafc627b00489198ef460451da6ce337c9659a3921b6f0ce193780e380d85e4 \
                    size    375756
github.tarball_from archive

# https://github.com/alba4k/albafetch/issues/186
conflicts_build     libuuid

use_configure       no

patchfiles-append   0001-Fix-Makefile.patch \
                    0002-fix-apple-logo.patch

post-patch {
    reinplace "s|@DESTDIR@|${destroot}${prefix}|" ${worksrcpath}/Makefile
}

if {${os.platform} eq "darwin" && ${os.major} < 11} {
    patchfiles-append \
                    0003-meson.build-legacysupport.patch

    post-patch {
        reinplace "s|@PREFIX@|${prefix}|" ${worksrcpath}/meson.build
    }
}

# Yes, it is called from a Makefile.
depends_build-append \
                    port:meson
# meson is not invoked via portgroup, and if ccache is installed
# on the system, it is forcibly used when it is not needed
# also make sure that the correct compiler is being used
build.env           CC=${configure.cc} \
                    OBJC=${configure.objc}

if {${os.platform} ne "darwin"} {
    depends_build-append \
                    path:bin/pkg-config:pkgconfig
    depends_lib-append \
                    port:pciutils
}

compiler.c_standard 1999
