# -*- 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

PortSystem                                      1.0
PortGroup           cmake                       1.1
PortGroup           github                      1.0
PortGroup           legacysupport               1.1
PortGroup           openssl                     1.0

github.setup        cern-fts davix 0_8_10 R_
version             [string map {_ .} ${github.version}]
revision            0
github.tarball_from releases
distname            ${github.project}-${version}

checksums           rmd160  c182744725807a769b7184ff67145cd836792c2d \
                    sha256  66aa9adadee6ff2bae14caba731597ba7a7cd158763d9d80a9cfe395afc17403 \
                    size    6100049

categories          net
maintainers         {jonesc @cjones051073} openmaintainer

description         High-performance file management over WebDAV / HTTP

long_description    Davix aims to make the task of managing files over \
                    HTTP-based protocols simple. It is being developed \
                    by IT-ST at CERN, and while the project's purpose  \
                    is its use on the CERN grid, the functionality     \
                    offered is generic.

license             LGPL-2.1
platforms           darwin

set py_ver          3.12
set py_ver_no_dot   [join [split ${py_ver} "."] ""]

depends_build-append port:pkgconfig \
                     port:python${py_ver_no_dot}

depends_lib-append   port:curl \
                     port:libxml2

compiler.cxx_standard  2011
# Non-standard support for variable length arrays is required, which seems to
# break with Xcode clang on OSX 10.10 and 10.11
compiler.blacklist-append  {clang < 900}

configure.args-append -DPYTHON_EXECUTABLE=${prefix}/bin/python${py_ver} \
                      -DEMBEDDED_LIBCURL=FALSE

# gtest conflict. Disable tests for now
# https://trac.macports.org/ticket/58955
configure.args-append -DDAVIX_TESTS=FALSE

pre-configure {
    # Force use of macports python in build scripts
    # Find command finds text files containing the string to be replaced.
    set pystringtoreplace "/usr/bin/env python2"
    foreach f [ exec find ${worksrcpath} -type f -and -name "*.py" ] {
        reinplace -q "s|${pystringtoreplace}|${prefix}/bin/python${py_ver}|g" $f
    }
}
