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

github.setup        htop-dev htop 3.3.0
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
revision            2
epoch               1

checksums           rmd160  32f836bc4016f2ebf6b2332396993baad5c69ee6 \
                    sha256  c94ea007b55cc76311219aacd8e38f0f7122aca2fa216a2156eeb08bcaa8e24b \
                    size    406099

categories          sysutils
maintainers         {cal @neverpanic} openmaintainer
license             GPL-2

description         an interactive text-mode process viewer for Unix
long_description    ${name} is {*}${description} systems. It aims to be a better 'top'.

homepage            https://htop.dev

depends_build-append \
                    port:autoconf \
                    port:automake \
                    port:libtool \
                    port:pkgconfig

depends_lib-append  port:ncurses

# https://github.com/htop-dev/htop/pull/1381
patchfiles-append   0001-darwin-Platform.c-use-mach-port.h.patch
# https://github.com/htop-dev/htop/pull/1383
patchfiles-append   0002-darwin-PlatformHelpers-fix-CPU-detection-for-PowerPC.patch

pre-configure {
    system -W ${worksrcpath} "sh autogen.sh"
}

configure.args      --disable-unwind

post-destroot {
    # Delete the .png and .desktop files
    foreach dir [list applications pixmaps] {
        delete ${destroot}${prefix}/share/${dir}
    }
}

# Exclude beta releases from livecheck
github.livecheck.regex  {([0-9.]+)}