# -*- 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 104524 2013-03-27 00:37:39Z ryandesign@macports.org $

PortSystem                  1.0
PortGroup                   cmake 1.0

name                        soci
version                     3.2.0
license                     Boost-1
categories                  databases devel
platforms                   darwin
maintainers                 rmh.de:g.lorenz openmaintainer

description                 SOCI - The C++ Database Access Library

long_description            SOCI is a database access library for C++ that makes the illusion of \
                            embedding SQL queries in the regular C++ code, staying entirely within \
                            the Standard C++. The idea is to provide C++ programmers a way to \
                            access SQL databases in the most natural and intuitive way. If you \
                            find existing libraries too difficult for your needs or just \
                            distracting, SOCI can be a good alternative.

homepage                    http://soci.sourceforge.net/
master_sites                sourceforge:project/soci/soci/soci-${version}

checksums                   rmd160  9dd5f9ac9d5364606f4fc7bc988f6f700a965361 \
                            sha256  5ee765fdb65e50f2f5109b484417506d5550ba69b51f9a15bdce0f471e550e32

configure.args-append       -DWITH_BOOST=OFF \
                            -DWITH_MYSQL=OFF \
                            -DWITH_ODBC=OFF \
                            -DWITH_ORACLE=OFF \
                            -DWITH_POSTGRESQL=OFF \
                            -DWITH_SQLITE3=OFF

default_variants            +boost

variant boost description {Build with Boost integration} {
    depends_lib-append          port:boost
    configure.args-delete       -DWITH_BOOST=OFF
}

variant mysql4 conflicts mysql5 description {Build MySQL 4 backend} {
    depends_lib-append          port:mysql4
    configure.args-delete       -DWITH_MYSQL=OFF
    configure.args-append       -DMYSQL_INCLUDE_DIR=${prefix}/include/mysql
    configure.args-append       -DMYSQL_LIBRARY=${prefix}/lib/mysql/libmysqlclient_r.dylib
}

variant mysql5 conflicts mysql4 description {Build MySQL 5 backend} {
    depends_lib-append          port:mysql5
    configure.args-delete       -DWITH_MYSQL=OFF
    configure.args-append       -DMYSQL_INCLUDE_DIR=${prefix}/include/mysql5/mysql
    configure.args-append       -DMYSQL_LIBRARY=${prefix}/lib/mysql5/mysql/libmysqlclient_r.dylib
}

variant odbc description {Build ODBC backend} {
    depends_lib-append          port:libiodbc
    configure.args-delete       -DWITH_ODBC=OFF
}

variant oracle description {Build Oracle backend} {
    depends_lib-append          port:oracle-instantclient
    configure.args-delete       -DWITH_ORACLE=OFF
    configure.env-append        ORACLE_HOME=${prefix}/lib/oracle
}

variant postgresql84 conflicts postgresql90 \
        description {Build PostgreSQL 8.4 backend, using MacPorts postgresql84 port} {
    depends_lib-append           port:postgresql84
    configure.args-append       -DPG_CONFIG=${prefix}/lib/postgresql84/bin/pg_config
    configure.args-append       -DPOSTGRESQL_INCLUDE_DIR=${prefix}/include/postgresql84
    configure.args-append       -DPOSTGRESQL_LIBRARIES=${prefix}/lib/postgresql84/libpq.dylib
    configure.args-delete       -DWITH_POSTGRESQL=OFF
}

variant postgresql90 conflicts postgresql84 \
        description {Build PostgreSQL 9.0 backend, using MacPorts postgresql90 port} {
    depends_lib-append          port:postgresql90
    configure.args-append       -DPG_CONFIG=${prefix}/lib/postgresql90/bin/pg_config
    configure.args-append       -DPOSTGRESQL_INCLUDE_DIR=${prefix}/include/postgresql90
    configure.args-append       -DPOSTGRESQL_LIBRARIES=${prefix}/lib/postgresql90/libpq.dylib
    configure.args-delete       -DWITH_POSTGRESQL=OFF
}

variant sqlite3 description {Build SQLite 3 backend, using MacPorts sqlite3 port} {
    depends_lib-append          port:sqlite3
    configure.args-delete       -DWITH_SQLITE3=OFF
}

livecheck.regex             /${name}-(\[0-9.\]+)${extract.suffix}
