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

name                mod_security
version             1.9.5
categories          www security
maintainers         nomaintainer
description         intrusion detection and prevention engine for web applications
long_description    ModSecurity is an open source intrusion detection and \
                    prevention engine for web applications. It operates \
                    embedded into the web server, acting as a powerful \
                    umbrella - shielding applications from attacks. \
                    It supports both branches of the Apache web server.
homepage            http://www.modsecurity.org/
license             GPL-2
platforms           darwin
# http://sourceforge.net/projects/mod-security/files/modsecurity-apache/1.9.5/
#master_sites       sourceforge:macports
#master_sites       sourceforge:mod-security/files/modsecurity-apache/${version}/        # NOK
#master_sites       sourceforge:projects/mod-security/files/modsecurity-apache/${version}/    # NOK
#master_sites       sourceforge:project/mod-security/files/modsecurity-apache/${version}/    # NOK
#master_sites       sourceforge:modsecurity-apache/${version}/                # NOK
master_sites        sourceforge:project/mod-security/modsecurity-apache/${version}
distname            modsecurity-apache_${version}

checksums           rmd160  f36f29f75bb30ca80ebaf5a96aa951e9de475d03 \
                    sha256  927fafbce4fc11d32fe808a46c62da335a8703a6d18c22aadb7dd9692cf752a5

use_configure       no

#variant apache1 {
    # See #41436 et al.
    depends_lib port:apache
    build.cmd   ${prefix}/sbin/apxs
    set apachedir   apache
    set apachever   apache1
#}

#variant apache2    {
#   depends_lib port:apache2
#   build.cmd   ${prefix}/apache2/bin/apxs
#   set apachedir   apache2
#   set apachever   apache2
#}

build.args      -c -o ${name}.so ${apachever}/${name}.c
build.target

destroot {
    xinstall -d -m 755 ${destroot}${prefix}/libexec/${apachedir} \
        ${destroot}${prefix}/share/doc/${name}
    xinstall -m 755 ${worksrcpath}/${name}.so \
        ${destroot}${prefix}/libexec/${apachedir}/
    xinstall -m 644 -W ${worksrcpath} CHANGES INSTALL LICENSE README \
        ${destroot}${prefix}/share/doc/${name}
}

notes "mod_security ${version} has been released on 2009.01.22. You are strongly encouraged to use mod_security2 or other maintained alternatives."

livecheck.type      regex
livecheck.url       http://sourceforge.net/projects/mod-security/files/modsecurity-apache/
livecheck.regex     "<a href=\"/projects/mod-security/files/modsecurity-apache/(1(?:\\.\\d+)*)/\""