# -*- 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 120250 2014-05-20 14:03:05Z mf2k@macports.org $

PortSystem          1.0
PortGroup           cmake 1.0

name                xrootd
version             3.3.6
revision            0

categories          science
maintainers         hep.phy.cam.ac.uk:jonesc openmaintainer

description         generic suite for fast, low-latency and scalable data access

long_description    XRootD software framework is a fully generic suite for fast, \
                    low-latency and scalable data access.

license             LGPL-3+
platforms           darwin

homepage            http://xrootd.org/
master_sites        ${homepage}download/v${version}

checksums           rmd160  0ba0cb959a713be2e8eb3a1ad9a8d41b72ea0033 \
                    sha256  06656d919f5296bcf49953e97b1f3d1cf601c9a1d676945529032fa0046d7217

depends_lib         port:zlib port:libevent port:swig

default_variants    +ssl +readline

patchfiles          patch-cmake-XRootDOSDefs.cmake.diff

# do a out of place build
pre-configure {
    file mkdir ${workpath}/build
}
configure.dir       ${workpath}/build
configure.post_args ${worksrcpath}
build.dir           ${workpath}/build

configure.args-append -DENABLE_CRYPTO=False \
                      -DENABLE_READLINE=False \
                      -DENABLE_KRB5=False \
                      -DENABLE_PERL=False

variant perl description {Build with Perl Support} {
    configure.args-delete   -DENABLE_PERL=False
    configure.args-append   -DENABLE_PERL=True

    depends_lib-append      port:perl5
    depends_build-append    port:swig-perl
}

variant readline description {Build with Readline Support} {
    configure.args-delete   -DENABLE_READLINE=False
    configure.args-append   -DENABLE_READLINE=True -DREADLINE_ROOT_DIR="${prefix}"
    depends_lib-append      port:readline
}

variant ssl description {Build with OpenSSL Support} {
    configure.args-delete   -DENABLE_CRYPTO=False
    configure.args-append   -DENABLE_CRYPTO=True -DOPENSSL_ROOT_DIR="${prefix}"
    depends_lib-append      port:openssl
}

variant kerberos description {Build with Kerberos 5 Support} {
    configure.args-delete   -DENABLE_KRB5=False
    configure.args-append   -DENABLE_KRB5=True -DKERBEROS5_ROOT_DIR="${prefix}"
    depends_lib-append      port:kerberos5
}
