# -*- 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
# $Id$

PortSystem          1.0
PortGroup           github 1.0

github.setup        gnosek fcgiwrap 1.1.0
categories          www
platforms           darwin
maintainers         nomaintainer
license             MIT

description         simple server for running CGI applications over FastCGI. \
                    It hopes to provide clean CGI support to Nginx

long_description    ${description}

homepage            https://nginx.localdomain.pl/wiki/FcgiWrap

checksums           rmd160  db492eefd2f78effa4738526537a0804877d692c \
                    sha256  bf8f3f864e8dc0a7ab1e24e7692db7320a045fbbf47298286f0786a2f978c911

depends_build       port:pkgconfig

depends_lib         port:fcgi

depends_run         port:spawn-fcgi

# There is no configure script in the archive.
use_autoreconf      yes

# The project's build system uses autoconf incorrectly.
configure.args      --mandir=/share/man

build.args          CC=${configure.cc}

post-destroot {
    xinstall -d ${destroot}${prefix}/share/doc/${name}
    copy ${worksrcpath}/README.rst ${destroot}${prefix}/share/doc/${name}/
}

## FIXME! plist not working
#startupitem.create      yes
#startupitem.name        ${name}
## -n = no forking
#startupitem.executable  ${prefix}/bin/spawn-fcgi -n -F 1 -P ${prefix}/var/run/${name}.pid -s ${prefix}/var/run/${name}.socket -U nobody -G nobody ${prefix}/sbin/fcgiwrap
#startupitem.pidfile     ${prefix}/var/run/${name}.pid

notes "
To end setup, if using with Nginx, follow:

    http://wiki.nginx.org/Fcgiwrap

You can launch ${name} by running:

    $ ${prefix}/bin/spawn-fcgi -F 1 -P ${prefix}/var/run/${name}.pid -s ${prefix}/var/run/${name}.socket \
         -U nobody -G nobody ${prefix}/sbin/fcgiwrap
"