# -*- 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 78979 2011-05-28 21:10:59Z ryandesign@macports.org $

PortSystem          1.0

name                thrift
version             0.6.0
categories          devel
maintainers         gmail.com:naoya.n
platforms           darwin

description         framework for scalable cross-language services development

long_description    Thrift is a software framework for scalable cross-language \
                    services development. It combines a software stack with a \
                    code generation engine to build services that work \
                    efficiently and seamlessly between C++, Java, Python, PHP, \
                    Ruby, Erlang, Perl, Haskell, C#, Cocoa, Smalltalk, and \
                    OCaml.

homepage            http://thrift.apache.org/
master_sites        apache:${name}/${version}

checksums           md5     c1a9c679bc75d038ce5ef447bf6e4c75 \
                    sha1    5027cba1e901134a3b767ffd5af1d8a1b3cb40f5 \
                    rmd160  634a8ff7b6a41029358d671ec9e936ca905ef373

depends_build       port:boost \
                    port:pkgconfig

configure.args      --with-csharp=no \
                    --with-java=no \
                    --with-erlang=no \
                    --with-py=no \
                    --with-perl=no \
                    --with-ruby=no \
                    --with-haskell=no \
                    --with-php=no \
                    --with-php_extension=no

variant java description "enable the Java library" {
    depends_build-append    bin:ant:apache-ant
    configure.env-append    JAVA_PREFIX=${prefix}/share/java
    configure.args-delete   --with-java=no
    configure.args-append   --with-java=yes
}

variant csharp description "enable the C# library" {
    configure.args-delete   --with-csharp=no
    configure.args-append   --with-csharp=yes
    depends_lib-append      port:mono
}

variant python description "enable the Python library" {
    configure.python        ${prefix}/bin/python2.6
    configure.env-append    PY_PREFIX=${frameworks_dir}/Python.framework/Versions/2.6
    configure.args-delete   --with-py=no
    configure.args-append   --with-py=yes
    depends_lib-append      port:python26
}
if {![variant_isset python]} {
    # still insists on installing files in PY_PREFIX, which is in /usr/lib by default
    configure.env-append    PY_PREFIX=${prefix}/share/${name}/python
}

# doesn't install into destroot
#variant ruby description "enable the Ruby library" {
#    configure.args-delete   --with-ruby=no
#    configure.args-append   --with-ruby=yes
#    depends_lib-append      port:ruby
#}

variant haskell description "enable the Haskell library" {
    configure.args-delete   --with-haskell=no
    configure.args-append   --with-haskell=yes
    depends_lib-append      port:ghc
}
variant perl description "enable the Perl library" {
    configure.env-append    PERL_PREFIX=${prefix}
    configure.args-delete   --with-perl=no
    configure.args-append   --with-perl=yes
    depends_lib-append      port:p5-class-accessor port:p5-bit-vector
}

variant php description "enable the PHP library" {
    configure.env-append    PHP_PREFIX=${prefix}/lib/php
    configure.args-delete   --with-php=no
    configure.args-append   --with-php=yes
    depends_lib-append      path:bin/php:php5
}

variant erlang description "enable the Erlang library" {
    configure.args-delete   --with-erlang=no
    configure.args-append   --with-erlang=yes
    depends_lib-append      port:erlang
}
