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

github.setup        Dr-Noob cpufetch 1.06 v
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
revision            0
categories          sysutils
license             GPL-2
maintainers         {mps @Schamschula} openmaintainer
description         cpufetch is a command-line tool written in C that displays the CPU \
                    information in a clean and beautiful way
long_description    {*}${description}

checksums           rmd160  cd60284bd36eca566173341a1494ad06f79416f1 \
                    sha256  7b53630f3a26211683a21b07359c25a1b1b8c297e3850e477861633e7f6588c0 \
                    size    2833538

use_configure       no

# https://trac.macports.org/ticket/66630
# https://github.com/Dr-Noob/cpufetch/issues/167
platform powerpc {
    # Hack for Rosetta to build for ppc:
    if {${os.platform} eq "darwin" && ${os.major} == 10} {
        patchfiles-append \
                    patch-rosetta.diff
    }
    # clang: warning: not using the clang compiler for the 'powerpc' architecture
    compiler.blacklist-append clang
    # Fix for gcc-4.2
    post-patch {
        # cc1: error: unrecognized command line option "-Wno-language-extension-token"
        reinplace "s,-Wno-language-extension-token,," ${worksrcpath}/Makefile
    }
}

destroot {
    xinstall -m 0755 ${worksrcpath}/cpufetch    ${destroot}${prefix}/bin
    xinstall -m 0644 ${worksrcpath}/cpufetch.1  ${destroot}${prefix}/share/man/man1
}
