# -*- 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
PortGroup           legacysupport 1.1

# clock_gettime, through the statically linked Skarnet libraries.
legacysupport.newest_darwin_requires_legacy 15

name                s6-rc
version             0.8.0.2
revision            0
categories          sysutils
license             ISC
maintainers         @bjornpagen openmaintainer
description         dependency-based service manager for s6

long_description    s6-rc compiles service definitions and starts or stops \
                    supervised daemons and one-shot tasks in dependency \
                    order. It also supports live service database updates.

homepage            https://skarnet.org/software/s6-rc/
master_sites        ${homepage}

checksums           rmd160  5fdda1aa26cdbe8e955432cf6e291eb38f66875c \
                    sha256  2fc0fcfe1e74b404b132a978eb316668c8bcdbc1104b3b0fe702a3d2d76caef5 \
                    size    161779

depends_build-append \
                    port:execline \
                    port:pkgconfig \
                    port:s6 \
                    port:skalibs

depends_run         port:execline port:s6

# Match the normalized target recorded by skalibs.
# https://trac.macports.org/ticket/74350
configure.args-append \
                    --enable-pkgconfig \
                    --with-pkgconfig \
                    --build=${build_arch}-apple-darwin${os.major} \
                    --target=${build_arch}-apple-darwin${os.major} \
                    --livedir=${prefix}/var/run/s6-rc \
                    --repodir=${prefix}/var/lib/s6-rc/repository

# Install tools and documentation, not a database or service instance.
post-destroot {
    set docdir ${prefix}/share/doc/${name}
    xinstall -d ${destroot}${docdir}
    xinstall -m 0644 -W ${worksrcpath} \
        AUTHORS \
        COPYING \
        INSTALL \
        NEWS \
        README \
        ${destroot}${docdir}
    xinstall -m 0644 {*}[glob ${worksrcpath}/doc/*.html] \
        ${destroot}${docdir}
}

livecheck.type      regex
livecheck.url       ${homepage}
livecheck.regex     "${name}-(\[0-9.\]+)\\.tar\\.gz"
