# -*- 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                monit
version             5.35.2
revision            0

categories          sysutils
platforms           darwin freebsd linux netbsd openbsd solaris
license             GPL-3
maintainers         nomaintainer

description         A utility for managing and monitoring processes, files, etc.
long_description    A utility for managing and monitoring processes, programs,\
                    files, directories and filesystems on a Unix system. Monit\
                    conducts automatic maintenance and repair and can execute\
                    meaningful causal actions in error situations. Monit logs\
                    to syslog or to its own log file and notifies you about error\
                    conditions via customizable alert messages. Monit can perform\
                    various TCP/IP network checks, protocol checks and can utilize\
                    SSL for such checks. Monit provides an optional http(s) interface\
                    and you can use a browser to access the Monit program.

homepage            https://mmonit.com/monit/
master_sites        ${homepage}dist/

checksums           rmd160  1d9dd1a87911e960ac62ef5138f581e9ea199046 \
                    sha256  4dfef54329e63d9772a9e1c36ac99bc41173b79963dc0d8235f2c32f4b9e078f \
                    size    1526704

depends_build       bin:flex:flex bin:bison:bison
depends_lib         path:lib/libssl.dylib:openssl

patchfiles          patch-monitrc.diff

post-patch {
    reinplace "s|@PREFIX@|${prefix}|g" ${worksrcpath}/monitrc
}

configure.args      --with-ssl-dir=${prefix}

platform freebsd {
    build.type      gnu
}

platform netbsd {
    build.type      gnu
}

platform openbsd {
    build.type      gnu
}

destroot.keepdirs   ${destroot}${prefix}/etc/monit.d
post-destroot {
    xinstall -m 700 ${worksrcpath}/monitrc ${destroot}${prefix}/etc/monitrc

    xinstall -d ${destroot}${prefix}/share/doc/${name}
    xinstall -m 444 -W ${worksrcpath} CONTRIBUTORS COPYING \
        ${destroot}${prefix}/share/doc/${name}
}

startupitem.create     yes
startupitem.executable ${prefix}/bin/monit -I -c ${prefix}/etc/monitrc
