# -*- 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_chroot
version             0.5
categories          www security
platforms           darwin
maintainers         nomaintainer

description         module for running apache2 in a secure chroot environment

long_description    mod_chroot makes running apache2 in a secure chroot \
                    environment easy. You don't need to create a special \
                    directory hierarchy containing /dev, /lib, /etc...

homepage            https://web.archive.org/web/20170509004627/http://core.segfault.pl:80/~hobbit/mod_chroot
master_sites        ${homepage}/dist/ \
                    freebsd

checksums           sha1    42935c37fb163ff519651ddd0b0fd6982a978015 \
                    rmd160  baba1cac0f05953dac5ab7f483bbc49417eaf8ff

depends_lib         port:apache2

use_configure       no

build.args          -c mod_chroot.c
build.target

if {[variant_isset apache22]} {
    set apxs        ${prefix}/apache22/bin/apxs
    set mdir        ${destroot}${prefix}/apache22/modules/
} else {
    set apxs        ${prefix}/bin/apxs
    set mdir        ${destroot}${prefix}/lib/apache2/modules/
}

variant apache22 description "use apache22 instead of apache2" {
    depends_lib-replace port:apache2 port:apache22
    destroot.violate_mtree  yes
}

build.cmd           ${apxs}

destroot {
    xinstall -d -m 755 ${destroot}${prefix}/share/doc/${name} ${mdir}
    xinstall -m 644 ${worksrcpath}/.libs/mod_chroot.so ${mdir}
    xinstall -m 644 -W ${worksrcpath} \
        CAVEATS \
        ChangeLog \
        INSTALL \
        LICENSE \
        README \
        README.Apache20 \
        ${destroot}${prefix}/share/doc/${name}
}