# -*- 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                mod_fcgid
version             2.3.9
categories          www
license             Apache-2
platforms           darwin
maintainers         nomaintainer

description         An alternative FastCGI module for Apache2
long_description    ${description}

homepage            https://httpd.apache.org/mod_fcgid/
master_sites        apache:httpd/${name}

use_bzip2           yes

checksums           rmd160  cb5fd1fbf705ba3dff62a705d06c0632acd491bd \
                    sha256  442c29528e34fefc946dd356fcf8240e1953aed89eb5597fc55898d3d06f183f

depends_lib         port:apache2

patch.pre_args-replace  -p0 -p1
patchfiles          patch-modules-fcgid-fcgid_conf.c.diff

post-patch {
    reinplace "s|@PREFIX@|${prefix}|g" \
        ${worksrcpath}/modules/fcgid/fcgid_conf.c
    reinplace "s|@NAME@|${name}|g" \
        ${worksrcpath}/modules/fcgid/fcgid_conf.c
}

set apache_name apache2
set apxs            ${prefix}/bin/apxs
set extra           ${prefix}/etc/apache2/extra/
set httpd_conf      ${prefix}/etc/apache2/httpd.conf
set mdir            ${destroot}${prefix}/lib/apache2/modules/

configure.env       APXS=${apxs}
configure.cmd       ./configure.apxs
configure.pre_args  {}

destroot.keepdirs   ${destroot}${prefix}/var/run/${name}
post-destroot {
    xinstall -m 755 -d ${destroot}${prefix}/share/doc/${name}
    xinstall -m 644 -W ${worksrcpath} \
        CHANGES-FCGID LICENSE-FCGID NOTICE-FCGID README-FCGID STATUS-FCGID \
        ${destroot}${prefix}/share/doc/${name}
    xinstall -m 755 -d ${extra}
    xinstall -m 644 ${filespath}/httpd-fcgid.conf \
        ${extra}
}

notes "
==========
This port installs a configuration file to enable mod_fcgid in Apache.
After install add these lines to the end of ${httpd_conf} to enable mod_fcgid.
    # Include module mod_fcgid
    Include conf/extra/httpd-fcgid.conf

You should then restart ${apache_name} to load the module.
    $ sudo port unload ${apache_name}
    $ sudo port load ${apache_name}

For further configuration information please visit
    https://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html

When upgrading from mod_fcgid version 2.2, please see the above URL
    about deprecated config options!
=========="

livecheck.url       https://httpd.apache.org/download.cgi
livecheck.type      regex
livecheck.regex     "(?!${name}).*${name}-((?!${extract.suffix}).*)${extract.suffix}"
