# -*- 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 78228 2011-04-29 02:42:44Z ryandesign@macports.org $

PortSystem          1.0

name                mongrel2
version             1.5
categories          www
platforms           darwin
maintainers         and.damore openmaintainer
description         The Language Agnostic Web Server
long_description    \
    Mongrel2 is an application, language, and network architecture agnostic \
    web server that focuses on web applications using modern browser \
    technologies.

homepage            http://mongrel2.org/home
master_sites        http://mongrel2.org/static/downloads
use_bzip2           yes
checksums           md5     b699ffc7ef922ad7d703fcd39a897910 \
                    sha1    f179c11702556ed6bf10fe092ba7a4e1cdce2c67 \
                    rmd160  72bc262b1556b3ed6a0a60585c0d7f4285d7eeb2

use_configure       no
depends_lib         port:gmake \
                    port:zmq20 \
                    port:sqlite3

patchfiles          patch-Makefile.diff \
                    patch-tools_m2sh_Makefile.diff

post-patch {
    reinplace "s|@@PREFIX@@|${prefix}|g" ${worksrcpath}/Makefile
    reinplace "s|/opt/local|${prefix}|g" ${worksrcpath}/Makefile
    reinplace "s|@@PREFIX@@|${prefix}|g" ${worksrcpath}/tools/m2sh/Makefile
}

#build.target        macports

post-destroot {
    xinstall -m 755 -d ${destroot}${prefix}/share/doc/${name}
    xinstall -m 755 -d ${destroot}${prefix}/share/examples/${name}
    
    xinstall -m 644 ${worksrcpath}/LICENSE ${destroot}${prefix}/share/doc/${name}
    xinstall -m 644 ${worksrcpath}/docs/manual/book.wiki ${destroot}${prefix}/share/doc/${name}/book.html

    xinstall -m 644 ${worksrcpath}/tests/config.sqlite ${destroot}${prefix}/share/examples/${name}/test-config.sqlite
    eval file copy [glob ${worksrcpath}/examples/*] ${destroot}${prefix}/share/examples/${name}
}
