# $Id: Portfile 67274 2010-05-04 06:20:40Z jmr@macports.org $

PortSystem       1.0
name             sunclock
version          3.50pre1
revision         3
extract.suffix   .tgz
categories       x11
maintainers      nomaintainer
description      shows Earth's surface illuminated by the Sun
long_description \
    This program is a clock that shows which portion of the \
    Earth's surface is illuminated by the sun. It is designed \
    to be usually iconic, but can be opened for a larger \
    display with the time updated every second and both the \
    local time zone and UTC displayed.
homepage         http://www.arvernes.com/wiki/index.php/Sunclock
platforms        darwin
master_sites     ftp://ftp.ac-grenoble.fr/ge/geosciences/sunclock/ \
                 openbsd:distfiles
checksums        md5 6e07964a99848018432825c5b3297cc6
depends_lib      port:jpeg

pre-configure {
    reinplace "s|DESTDIR=/usr|DESTDIR=${prefix}|" "${worksrcpath}/Imakefile"
    reinplace "s|MANDIR=/X11R6|MANDIR=/share|" "${worksrcpath}/Imakefile"
    reinplace "s|BINDIR=/X11R6/bin|BINDIR=/bin|" "${worksrcpath}/Imakefile"
    reinplace "s|#JLIBDIR=-L/usr/lib|JLIBDIR=-L${prefix}/lib|" "${worksrcpath}/Imakefile"
    reinplace "s|#JINC=-I/usr/include|JINC=-I${prefix}/include|" "${worksrcpath}/Imakefile"
}

use_xmkmf        yes

pre-build {
    reinplace "s|INCROOT = /usr/X11R6/include|INCROOT = ${prefix}/include|" "${worksrcpath}/Makefile"
    reinplace "s|#include <malloc.h>||" "${worksrcpath}/tildepath.c"
}

destroot.destdir DESTDIR=${destroot}${prefix} DOCHTMLDIR=/share/doc
