# -*- 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_python
version             3.5.0
revision            0

categories          www python
license             Apache-2
maintainers         nomaintainer

description         Apache2 module that embeds Python within the server.
long_description \
   Mod_python is an Apache 2 module that embeds the Python interpreter \
   within the server. With mod_python you can write web-based applications \
   in Python that will run many times faster than traditional CGI and will \
   have access to advanced features such as ability to retain database \
   connections and other data between hits and access to Apache internals.
homepage            http://www.modpython.org/

master_sites        http://dist.modpython.org/dist/
extract.suffix      .tgz

checksums           rmd160  03315af0843892059a11758209f350c82164acc3 \
                    sha256  0ef09058ed98b41c18d899d8b710a0cce2df2b53c44d877401133b3f28bdca90 \
                    size    571403

if {$subport ne $name} {
    depends_build       port:flex
    depends_lib         port:apache2

    patchfiles          patch-dist-Makefile.in.diff

    set apxs            ${prefix}/bin/apxs
    set httpd_conf      ${prefix}/etc/apache2/httpd.conf
    set mdir            ${destroot}${prefix}/lib/apache2/modules/

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

    pre-destroot {
       xinstall -d -m 755 ${mdir} \
          ${destroot}${prefix}/share/doc
       file copy ${worksrcpath}/doc-html ${destroot}${prefix}/share/doc/${subport}
    }

    notes "To enable ${subport}, add
    LoadModule python_module modules/mod_python.so
    to your apache2 config file:
    ${httpd_conf}"
} else {
    PortGroup           stub 1.0

    supported_archs     noarch

    # mod_python used to be for python 2.4
    replaced_by         mod_python27
    depends_lib         port:mod_python27

    livecheck.type      regex
    livecheck.url       https://archive.apache.org/dist/httpd/modpython/
    livecheck.regex     mod_python-(\[0-9\\.\]+)\\.tgz
}

subport mod_python27 {
    depends_lib-append  port:python27
    configure.args-append \
                        --with-python=${prefix}/bin/python2.7
}
