# -*- 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
# $Id: Portfile 88008 2011-12-15 23:42:32Z dports@macports.org $

PortSystem              1.0

name                    gkrellm
version                 2.3.5
revision                3
categories              sysutils
platforms               darwin
maintainers             markd openmaintainer
license                 GPL-3+

description             A GTK based system monitor

long_description        ${description}

homepage                http://members.dslextreme.com/users/billw/gkrellm/gkrellm.html
master_sites            http://members.dslextreme.com/users/billw/gkrellm/

checksums               sha1    bcfc2efb5fd3f27e9bb703bda73f6a1d96b080df \
                        rmd160  6ac017985981a8731690a54a296e673b6bf7fab0

use_bzip2               yes

depends_build           port:pkgconfig

depends_lib             port:gtk2 \
                        port:xorg-libsm

patchfiles              207a0519ac73290ba65b6e5f7446549a2a66f5d2.patch

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
