# -*- coding: utf-8; mode: tcl; tab-width: 4; truncate-lines: t; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:et:sw=4:ts=4:sts=4
# $Id: Portfile 67429 2010-05-09 13:56:57Z jmr@macports.org $

PortSystem 1.0

name			    sphinx
version			    0.9.9
categories		    textproc net
maintainers		    brett openmaintainer

platforms		    darwin
description		    Sphinx is a full-text search engine
long_description    Sphinx is a full-text search engine, meant to provide \
                    fast, size-efficient and relevant fulltext search \
                    functions to other applications. Sphinx was specially \
                    designed to integrate well with SQL databases and \
                    scripting languages. Currently built-in data sources \
                    support fetching data either via direct connection to \
                    MySQL or PostgreSQL, or from an XML pipe.

homepage		    http://www.sphinxsearch.com/
master_sites    	${homepage}downloads/
checksums       	sha1 8c739b96d756a50972c27c7004488b55d7458015 \
                   	rmd160 ed3cd1a9328114c1d2a6325cce5520065076c275

depends_lib		    port:expat \
                    port:libiconv

configure.args      --mandir=${prefix}/share/man \
                    --datadir=${prefix}/share/doc \
                    --sysconfdir=${prefix}/etc/sphinx \
                    --without-mysql \
                    ac_cv_search_iconv=-liconv

test.run            yes

variant postgres conflicts postgresql83 postgresql84 description {Enable PostgreSQL support for old PgSQL 8.2} {
    depends_lib-append      port:postgresql82
    configure.args-append   --with-pgsql \
                            --with-pgsql-includes=${prefix}/include/postgresql82 \
                            --with-pgsql-libs=${prefix}/lib/postgresql82
}

variant postgresql83 conflicts postgres postgresql84 description {Enable PostgreSQL support for newer PgSQL v8.3} {
    depends_lib-append      port:postgresql83
    configure.args-append   --with-pgsql \
                            --with-pgsql-includes=${prefix}/include/postgresql83 \
                            --with-pgsql-libs=${prefix}/lib/postgresql83
}

variant postgresql84 conflicts postgres postgresql83 description {Enable PostgreSQL support for newer PgSQL v8.4} {
    depends_lib-append      port:postgresql84
    configure.args-append   --with-pgsql \
                            --with-pgsql-includes=${prefix}/include/postgresql84 \
                            --with-pgsql-libs=${prefix}/lib/postgresql84
}

variant mysql5 description {Enable MySQL 5 support} {
    depends_lib-append      path:bin/mysql_config5:mysql5
    configure.args-delete   --without-mysql
    configure.args-append   --with-mysql-includes=${prefix}/include/mysql5/mysql \
		                    --with-mysql-libs=${prefix}/lib/mysql5/mysql
}

if {![variant_isset postgres] && ![variant_isset postgresql83] && ![variant_isset postgresql84] && ![variant_isset mysql5]} {
    default_variants +mysql5
}
