# -*- 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 112800 2013-11-01 19:14:17Z ryandesign@macports.org $

PortSystem 1.0

name                tomcat-native
version             1.1.29
categories          java www
maintainers         nomaintainer
license             Apache-2
platforms           darwin

description         Tomcat 5 HTTP Server native library support.
long_description    This port provides access to native apr and other \
                    functions utilized by tomcat.

homepage            http://tomcat.apache.org/
master_sites        apache:tomcat/tomcat-connectors/native/${version}/source/

checksums           rmd160  09aca2213da583dcb0e1e95a6844c6ec0906a3fc \
                    sha256  25fc6f3d65aeb3ac93142a4b536587b1231ac925eaf32a40f55c92a0991cf232

distname            ${name}-${version}-src
worksrcdir          ${distname}/jni/native

depends_lib         port:apr \
                    port:openssl

configure.args      --with-apr=${prefix} \
                    --with-ssl=${prefix} \
                    --with-java-platform=2

if {[info exists env(JAVA_HOME)]} {
    configure.args-append   --with-java-home="$env(JAVA_HOME)"
} else {
    configure.args-append   --with-java-home="/System/Library/Frameworks/JavaVM.framework"
}

build.args          EXTRA_LDFLAGS="-shrext .jnilib"

notes "
To integrate this into tomcat, add something like
-Djava.library.path=${prefix} to the tomcat options.

You then need to configure a Connector in server.xml
with the appropriate apr protocol class for your use,
for instance:
    protocol=\"org.apache.coyote.http11.Http11AprProtocol\",
    protocol=\"org.apache.coyote.ajp.AjpAprProtocol\"

As in:
    <!-- Define a non-SSL HTTP/1.1 Connector on port 8081 using apr -->
    <Connector port=\"8081\" maxHttpHeaderSize=\"8192\"
               maxThreads=\"150\" minSpareThreads=\"25\" maxSpareThreads=\"75\"
               enableLookups=\"false\" redirectPort=\"8443\" acceptCount=\"100\"
               connectionTimeout=\"20000\" disableUploadTimeout=\"true\" protocol=\"org.apache.coyote.http11.Http11AprProtocol\" />
"

livecheck.type      regex
livecheck.url       http://archive.apache.org/dist/tomcat/tomcat-connectors/native/
livecheck.regex     {(\d+\.\d+\.\d+)/}
