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

name                MenuMeters
categories          aqua sysutils
platforms           macosx
maintainers         {gmail.com:audvare @Tatsh} openmaintainer
license             GPL-2

description         Set of CPU, memory, disk, and network monitoring tools
long_description    The MenuMeters monitors are true SystemUIServer plugins     \
                    (also known as Menu Extras). This means they can be reordered   \
                    using command-drag and remember their positions in the menubar  \
                    across logins and restarts.

if {${os.major} > 15} {
    github.setup    yujitach MenuMeters 2.1.6.1
    revision        1
    checksums       rmd160  d2e666567655456b19579fc618c84ba30acec872 \
                    sha256  2dde435032cced14e60d4f98dadb25208cd7d9c338f524f1ed1eb71096ecd19e \
                    size    1541706
    supported_archs i386 arm64 x86_64

    patchfiles-append \
                    patch-bc.diff \
                    patch-fix-void-prototypes.diff

    xcode.configuration Release
    xcode.target    "${name} No Sparkle"
    xcode.destroot.settings \
                    CODE_SIGN_IDENTITY=- \
                    CODE_SIGN_STYLE=Manual \
                    ENABLE_HARDENED_RUNTIME=NO

    # Compile and install in one step, for now. See https://trac.macports.org/ticket/57137
    build {}

} else {
    # Pin this for older systems:
    version         1.8.1
    revision        0
    maintainers-append \
                    {@barracuda156 gmail.com:vital.had}
    distname        ${name}
    master_sites    https://ragingmenace.com/software/download/
    checksums       rmd160  a3383ffbed8e9088e71a6d18f0a3a9e148ebeb2c \
                    sha256  b516d8d9feffba20675c1ad0599ae6829df43d10bf85766fa02b1feb58bd7f9c \
                    size    717887
    extract.rename  yes

    patchfiles-append \
                    patch-proj.diff

    if {${os.major} == 10 && ${os.arch} eq "powerpc"} {
        # If set to release, build system checks some irrelevant Xcode components,
        # some of which may not contain ppc arch on 10.6.
        xcode.configuration Debug
    } else {
        xcode.configuration Release
    }
    xcode.target    PrefPane
    xcode.build.settings-append \
                    CODE_SIGN_IDENTITY=- \
                    ARCHS=${configure.build_arch} \
                    ONLY_ACTIVE_ARCH=yes

    destroot {
        xinstall -d "${destroot}/Library/PreferencePanes"
            copy "${worksrcpath}/build/${xcode.configuration}/MenuMeters.prefPane" \
                "${destroot}/Library/PreferencePanes/MenuMeters.prefPane"
    }

    destroot.violate_mtree yes
}
