# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4
# $Id: Portfile 73864 2010-11-27 10:17:48Z ryandesign@macports.org $

PortSystem          1.0

name                mnogosearch
version             3.3.9
categories          www
platforms           darwin
maintainers         gmail.com:dbraband openmaintainer
description         Full-featured SQL-based web search engine
long_description    mnoGoSearch is a full-featured SQL-based web search \
                    engine. mnoGoSearch consists of two parts. The first \
                    part is the indexing mechanism (indexer).  indexer walks \
                    over html hypertext references and stores found words \
                    and new references into a database. The second part is \
                    the web CGI front-end to provide searching using data \
                    collected by indexer.

homepage            http://www.mnogosearch.org/
master_sites        ${homepage}Download/

checksums           sha1    eef8bb0eb2a15d464d10e4057c4e94ca57944260 \
                    rmd160  776dfaa874eb8fc38135645d1e25c75da2f92eb6

depends_lib         port:openssl port:zlib
patchfiles          patch-doc_Makefile.in

configure.args      --sysconfdir=${prefix}/etc/mnogosearch \
                    --localstatedir=${prefix}/var/mnogosearch \
                    --datadir=${prefix}/share/mnogosearch \
                    --mandir=${prefix}/share/man --disable-static \
                    --with-openssl --with-zlib

pre-configure {
    if {![variant_isset mysql4] && ![variant_isset mysql5] && ![variant_isset postgresql7] && ![variant_isset postgresql81] && ![variant_isset postgresql83] && ![variant_isset postgresql84]} {
        ui_msg "\n\n-------------------------------------------------------------"
        ui_msg "Note: Because you did not select any database variants,"
        ui_msg "${name} will be built without the indexer (which may not"
        ui_msg "be what you wanted)."
        ui_msg "-------------------------------------------------------------\n\n"
    }
}

destroot.keepdirs	${destroot}${prefix}/var/mnogosearch

post-destroot {
    xinstall -m 755 -d ${destroot}${prefix}/share/doc/${name}
    xinstall -m 644 -W ${worksrcpath} AUTHORS COPYING ChangeLog INSTALL \
        NEWS README README.CVS README.XML TODO \
        ${destroot}${prefix}/share/doc/${name}
}

variant mysql4 conflicts mysql5 {
    depends_lib-append      port:mysql4
    configure.args-append   --with-mysql=${prefix}
}

variant mysql5 conflicts mysql4 {
    use_autoconf yes
    patchfiles-append       patch-locations_configure.in
    depends_lib-append      path:bin/mysql_config5:mysql5
    configure.args-append   --with-mysql=${prefix}
}

variant postgresql7 conflicts postgresql81 postgresql83 postgresql84 {
    depends_lib-append      port:postgresql7
    configure.args-append   --with-pgsql=${prefix}/lib/pgsql7
}

variant postgresql81 conflicts postgresql7 postgresql83 postgresql84 {
    depends_lib-append      port:postgresql81
    configure.args-append   --with-pgsql=${prefix}/lib/postgresql81
}

variant postgresql83 conflicts postgresql7 postgresql81 postgresql84 {
    use_autoconf yes
    patchfiles-append       patch-locations_configure.in
    depends_lib-append      port:postgresql83
    configure.args-append   --with-pgsql=${prefix}
}

variant postgresql84 conflicts postgresql7 postgresql81 postgresql83 {
    use_autoconf yes
    patchfiles-append       patch-locations_configure.in
    depends_lib-append      port:postgresql84
    configure.args-append   --with-pgsql=${prefix}
}

# Other database variants would go here

variant nosyslog {
    configure.args-append   --disable-syslog
}

livecheck.type      regex
livecheck.url       ${homepage}download.html
livecheck.regex     ${name}-(\[0-9.\]+)\\.tar
