# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8::et:sw=4:ts=4:sts=4

PortSystem          1.0
PortGroup           github 1.0

github.setup        klada sunwait 0.8
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
epoch               1
revision            3
categories          sysutils
license             GPL-3
maintainers         nomaintainer

description         calculates sunrise, sunset, twilight
long_description \
    Sunwait is a small program for calculating sunrise, \
    sunset, civil twilight, nautical twilight, and astronomical \
    twilight. It has options to wait until some time-offset from \
    one of these events, making it useful for home automation \
    tasks that should happen relative to the sun's position.

checksums           rmd160  29f22a395909e72b3a501259b175b0ac875178d3 \
                    sha256  4d403b4739834b866c5eb992fa5e67170a8676918180d48e6068f008660a88a2 \
                    size    20317

patchfiles          patch-makefile.diff \
                    patch-sunriset.cpp.diff \
                    patch-sunwait.cpp.diff \
                    patch-sunwait.cpp-DST_edge_cases.diff

post-patch {
   reinplace "s|%PREFIX%|${prefix}|" ${worksrcpath}/Makefile
}

use_configure       no

variant universal   {}

build.args          C="${configure.cxx} [get_canonical_archflags cxx]"
build.target        sunwait

destroot {
    xinstall -m 755 ${worksrcpath}/sunwait ${destroot}${prefix}/bin
}
