# -*- 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                sunclock
version             3.57
revision            1
checksums           rmd160 42ef99381405745bf2be13ad9c05c9f07e5ff1cd \
                    sha256 f3b3499b4a84c7a31411d2a9043e2d9171b745ec29a991ef9930ce582b9d41ab \
                    size    1571073

categories          x11
maintainers         nomaintainer
license             GPL-2

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            https://web.archive.org/web/20080821132523/http://www.arvernes.com/wiki/index.php/Sunclock
master_sites        debian:s/${name}
distname            ${name}_${version}.orig
worksrcdir          ${name}-${version}

depends_lib         path:include/turbojpeg.h:libjpeg-turbo \
                    port:libpng \
                    port:xorg-libX11 \
                    port:xpm \
                    port:zlib

patchfiles          gzFile.patch \
                    implicit.patch \
                    malloc.patch

use_configure       no

set datadir         ${prefix}/share/${name}
set docdir          ${prefix}/share/doc/${name}

configure.cflags-append -Wall -DZLIB
configure.cflags-append {-DSHAREDIR=\\\"${datadir}\\\"}
configure.cflags-append {-DEMXBINDIR=\\\"${prefix}/bin\\\"}
configure.cflags-append {-DDOCDIR=\\\"${docdir}\\\"}
configure.ldflags-append -lXpm -ljpeg -lpng -lz -lX11

build.env-append    datadir=${datadir} \
                    docdir=${docdir} \
                    prefix=${prefix}

build.pre_args      -f Makefile.noimake
build.target        all
build.args          DESTDIR=${prefix} \
                    MANDIR=/share/man/man1 \
                    XAPPLOADDIR=/share/X11/app-defaults \
                    XBINDIR=/bin \
                    CC=${configure.cc} \
                    CFLAGS="[join ${configure.cflags}] [get_canonical_archflags]" \
                    LFLAGS="${configure.ldflags} [get_canonical_archflags]"

destroot {
    xinstall -m 755 -W ${worksrcpath} sunclock editkit/emx ${destroot}${prefix}/bin
    xinstall -m 644 -W ${worksrcpath} sunclock.man ${destroot}${prefix}/share/man/man1/sunclock.1

    xinstall -d -m 755 ${destroot}${datadir}
    xinstall -m 644 -W ${worksrcpath} Sunclockrc ${destroot}${datadir}

    xinstall -d -m 755 ${destroot}${datadir}/earthmaps/vmf
    xinstall -m 644 {*}[glob ${worksrcpath}/vmf/*.vmf] ${destroot}${datadir}/earthmaps/vmf

    xinstall -d -m 755 ${destroot}${datadir}/earthmaps/i18n
    xinstall -m 644 {*}[glob ${worksrcpath}/i18n/Sunclock.??] ${destroot}${datadir}/earthmaps/i18n

    xinstall -d -m 755 ${destroot}${docdir}
    xinstall -m 644 -W ${worksrcpath}/editkit MANUAL.emacs README ${destroot}${docdir}
}

livecheck.type      none