# -*- 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_proxy_html
version             3.0.1
categories          www
license             GPL-2
maintainers         nomaintainer
description         apache output filter to rewrite HTML
long_description    mod_proxy_html is an output filter to rewrite HTML links in a proxy situation, to ensure that links work for users outside the proxy. It serves the same purpose as Apache's ProxyPassReverse directive does for HTTP headers, and is an essential component of a reverse proxy.
homepage            http://apache.webthing.com/mod_proxy_html/
platforms           darwin
depends_lib         port:apache22 port:libxml2

use_bzip2           yes

master_sites        http://apache.webthing.com/mod_proxy_html30/
checksums           md5 badb7ee9fb3b892437589d7ceb21637c \
                    sha1 ed91fb0e37e90a1d892c2fa78513ce60791dbb86
worksrcdir          ${name}

use_configure       no
build.cmd           ${prefix}/apache22/bin/apxs -c -I${prefix}/include/libxml2 ${name}.c
build.target

destroot.violate_mtree yes
destroot {
    xinstall -m 755 -d ${destroot}${prefix}/apache22/modules
    xinstall -m 755 -d ${destroot}${prefix}/apache22/conf/extra
    system "${prefix}/apache22/build/instdso.sh SH_LIBTOOL='${prefix}/share/apr-1/build/libtool' ${worksrcpath}/${name}.la ${destroot}${prefix}/apache22/modules"
    xinstall -m 755 ${worksrcpath}/proxy_html.conf ${destroot}${prefix}/apache22/conf/extra
}

post-install {
    ui_msg "\nNow edit ${prefix}/apache22/httpd.conf and add the following lines at the end of the LoadModules section:\n"
    ui_msg " LoadFile ${prefix}/lib/libxml2.dylib"
    ui_msg " LoadModule proxy_html_module  modules/mod_proxy_html.so"
    ui_msg "\n...also add this line to the bottom of ${prefix}/apache22/conf/httpd.conf\n"
    ui_msg " <IfModule proxy_html>\n   Include conf/extra/proxy_html.conf\n </IfModule>\n"
}