# $Id: Portfile 66997 2010-04-27 15:38:01Z narf_tm@macports.org $

PortSystem            1.0
PortGroup             perl5 1.0

perl5.setup           DBD-Pg 2.17.1
categories            perl databases
maintainers           narf_tm openmaintainer
description           Perl DBI module to provide access to PostgreSQL databases
long_description      DBD::Pg is a Perl module which works with the DBI \
                      module to provide access to PostgreSQL databases

platforms             darwin

checksums             md5 96b24b29d876bbbcc7c194115917a2f0 \
                      sha1 9346e6937a1dcc27d7da6f8aeb3f897bd8b39332 \
                      rmd160 33150577792c59e214971dbb7e751798de60498e

depends_lib-append    port:postgresql84 \
                      port:p5-dbi \
                      port:p5-version \
                      port:p5-module-signature \
                      port:p5-test-yaml-meta \
                      port:p5-test-warn

configure.env         PATH=${prefix}/lib/postgresql84/bin:$env(PATH) \
                      POSTGRES_INCLUDE="${prefix}/include/postgresql84" \
                      POSTGRES_LIB="${prefix}/lib/postgresql84 -lssl"

variant postgresql7 conflicts postgresql80 postgresql81 postgresql82 postgresql83 description {build with postgresql7 port} {
    depends_lib-delete      port:postgresql84
    depends_lib-append      port:postgresql7

    configure.env-delete    PATH=${prefix}/lib/postgresql84/bin:$env(PATH) \
                            POSTGRES_INCLUDE="${prefix}/include/postgresql84" \
                            POSTGRES_LIB="${prefix}/lib/postgresql84 -lssl"

    configure.env-append    PATH=${prefix}/lib/pgsql7/bin:$env(PATH) \
                            POSTGRES_INCLUDE="${prefix}/include/pgsql7" \
                            POSTGRES_LIB="${prefix}/lib/pgsql7 -lssl"
}

variant postgresql80 conflicts postgresql7 postgresql81 postgresql82 postgresql83 description {build with postgresql80 port} {
    depends_lib-delete      port:postgresql84
    depends_lib-append      port:postgresql80

    configure.env-delete    PATH=${prefix}/lib/postgresql84/bin:$env(PATH) \
                            POSTGRES_INCLUDE="${prefix}/include/postgresql84" \
                            POSTGRES_LIB="${prefix}/lib/postgresql84 -lssl"

    configure.env-append    PATH=${prefix}/lib/pgsql8/bin:$env(PATH) \
                            POSTGRES_INCLUDE="${prefix}/include/pgsql8" \
                            POSTGRES_LIB="${prefix}/lib/pgsql8 -lssl"
}

variant postgresql81 conflicts postgresql7 postgresql80 postgresql82 postgresql83 description {build with postgresql81 port} {
    depends_lib-delete      port:postgresql84
    depends_lib-append      port:postgresql81

    configure.env-delete    PATH=${prefix}/lib/postgresql84/bin:$env(PATH) \
                            POSTGRES_INCLUDE="${prefix}/include/postgresql84" \
                            POSTGRES_LIB="${prefix}/lib/postgresql84 -lssl"

    configure.env-append    PATH=${prefix}/lib/postgresql81/bin:$env(PATH) \
                            POSTGRES_INCLUDE="${prefix}/include/postgresql81" \
                            POSTGRES_LIB="${prefix}/lib/postgresql81 -lssl"
}

variant postgresql82 conflicts postgresql7 postgresql80 postgresql81 postgresql83 description {build with postgresql82 port} {
    depends_lib-delete      port:postgresql84
    depends_lib-append      port:postgresql82

    configure.env-delete    PATH=${prefix}/lib/postgresql84/bin:$env(PATH) \
                            POSTGRES_INCLUDE="${prefix}/include/postgresql84" \
                            POSTGRES_LIB="${prefix}/lib/postgresql84 -lssl"

    configure.env-append    PATH=${prefix}/lib/postgresql82/bin:$env(PATH) \
                            POSTGRES_INCLUDE="${prefix}/include/postgresql82" \
                            POSTGRES_LIB="${prefix}/lib/postgresql82 -lssl"
}

variant postgresql83 conflicts postgresql7 postgresql80 postgresql81 postgresql82 description {build with postgresql83 port} {
    depends_lib-delete      port:postgresql84
    depends_lib-append      port:postgresql83

    configure.env-delete    PATH=${prefix}/lib/postgresql84/bin:$env(PATH) \
                            POSTGRES_INCLUDE="${prefix}/include/postgresql84" \
                            POSTGRES_LIB="${prefix}/lib/postgresql84 -lssl"

    configure.env-append    PATH=${prefix}/lib/postgresql83/bin:$env(PATH) \
                            POSTGRES_INCLUDE="${prefix}/include/postgresql83" \
                            POSTGRES_LIB="${prefix}/lib/postgresql83 -lssl"
}
