# -*- 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: Portfile 92421 2012-04-28 05:56:51Z ryandesign@macports.org $

PortSystem          1.0

name                mod_cband
version             0.9.7.5
categories          www
platforms           darwin
maintainers         nomaintainer

description         bandwidth limiting module for apache2

long_description    mod_cband is an Apache 2 module that solves the problem \
                    of limiting the bandwidth usage of users, virtual hosts \
                    and destinations. When the configured transfer limit is \
                    exceeded, mod_cband will redirect all further requests \
                    to a location specified in the configuration file.

homepage            http://sysdesign.pl/mod_cband/
#master_sites        http://dembol.org/downloads/cband/
distname            mod-cband-${version}
extract.suffix      .tgz

# md5 is needed for http master_site below
checksums           md5     5c5d65dc9abe6cdc6931b6dd33be5018 \
                    rmd160  19ea621a1f46878dd9178dd2186479ce2fb9a922 \
                    sha256  6fd9024354153cc52538c81986afc18c1ff9395523bbe096f1810903fa7528ab

foreach {type checksum} ${checksums} {
    if {${type} == "md5"} {
        master_sites http://pkgs.fedoraproject.org/repo/pkgs/${name}/${distfiles}/${checksum}
    }
}

depends_lib         port:apache2

# Doesn't end up building universal software.
universal_variant   no

patchfiles          patch-src-mod_cband.h.diff

configure.args      --with-apxs=${prefix}/apache2/bin/apxs

build.target        src/.libs/mod_cband.so

destroot.violate_mtree yes
destroot {
    set moddir ${destroot}${prefix}/apache2/modules
    set docdir ${destroot}${prefix}/share/doc/${name}
    xinstall -m 755 -d ${moddir} ${docdir}/examples
    xinstall -m 644 ${worksrcpath}/src/.libs/mod_cband.so ${moddir}
    xinstall -m 644 -W ${worksrcpath} AUTHORS Changes LICENSE ${docdir}
    xinstall -m 644 ${worksrcpath}/conf/vhosts.conf.example ${docdir}/examples
}
