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

name                    gkrellm
version                 2.3.11
revision                0
categories              sysutils
maintainers             nomaintainer
license                 GPL-3+

description             A GTK based system monitor

long_description        {*}${description}

# gkrellm.net invalid 2023 - Author Bill Wilson RIP 2022
homepage                http://gkrellm.srcbox.net
master_sites            http://gkrellm.srcbox.net/releases/

checksums               rmd160  0fa58d3a4bf861b3dd5c3b6aecdcda06ce18fabe \
                        sha256  1ee0643ed9ed99f88c1504c89d9ccb20780cf29319c904b68e80a8e7c8678c06 \
                        size    783123

use_bzip2               yes

depends_build           port:gettext \
                        port:pkgconfig

depends_lib             port:gettext-runtime \
                        path:lib/pkgconfig/gtk+-2.0.pc:gtk2 \
                        port:xorg-libsm

patch.pre_args-replace  -p0 -p1
patchfiles              patch-2.11-master-commits.diff

use_configure           no

variant universal {}

build.type              gnu
build.env               CC=${configure.cc} \
                        "CFLAGS=${configure.cflags} [get_canonical_archflags cc]" \
                        CPPFLAGS=${configure.cppflags} \
                        "LDFLAGS=${configure.ldflags} [get_canonical_archflags ld]"

build.target            darwin9
destroot.target         install_darwin9

set plugin_dir          ${prefix}/libexec/gkrellm2/plugins
set theme_dir           ${prefix}/share/gkrellm2/themes

platform darwin 8 {
    build.target        darwin
    destroot.target     install_darwin
}

post-patch {
    reinplace "s|\$(PREFIX)|${prefix}|g" \
        "${worksrcpath}/Makefile"

    reinplace "s|/usr/local/share/gkrellm2/themes|${theme_dir}|g" \
        "${worksrcpath}/src/gkrellm.h"

    reinplace "s|/usr/share/gkrellm2/themes|${theme_dir}|g" \
        "${worksrcpath}/src/gkrellm.h"

    reinplace "s|/usr/local/lib/gkrellm2/plugins|${plugin_dir}|g" \
        "${worksrcpath}/src/gkrellm.h"

    reinplace "s|/usr/lib/gkrellm2/plugins|${plugin_dir}|g" \
        "${worksrcpath}/src/gkrellm.h"
}

post-destroot {
    xinstall -m 755 -d ${destroot}${theme_dir}
    xinstall -m 755 -d ${destroot}${plugin_dir}

    destroot.keepdirs \
        ${destroot}${theme_dir} \
        ${destroot}${plugin_dir}
}

notes "
After the first launch of GkrellM, the directory ~/.gkrellm2/\
is created that contains the file user-config to keep your\
settings, and also contains directories named themes/ and plugins/.\
However, the plugins and themes directories for this port of\
GkrellM are fixed at these locations:

${plugin_dir}
${theme_dir}
"

startupitem.create      yes
startupitem.executable  ${prefix}/bin/gkrellmd
