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

PortSystem          1.0
PortGroup           cmake 1.0

name                libssh
epoch               1
version             0.7.3
revision            1
master_sites        https://git.libssh.org/projects/libssh.git/snapshot/
use_bzip2           yes
checksums           rmd160  3f62ac8aa7d2617658cabcefda47705e3f1f01a2 \
                    sha256  5a3de53b77235bb2984c73c12dd7c6558ccfbf91e8ef77e2fad233a4b0d64d7d

set major           [join [lrange [split ${version} .] 0 1] .]
categories          devel security net
platforms           darwin
maintainers         cal ionic openmaintainer
license             LGPL-2.1

description         an SSH library

long_description    The ssh library was designed to be used by \
                    programmers needing a working SSH implementation \
                    by the mean of a library.

homepage            http://www.libssh.org

#patchfiles

depends_build-append \
                    port:pkgconfig

depends_lib         path:lib/libssl.dylib:openssl \
                    port:zlib

default_variants    +kerberos5

post-extract {
    file mkdir ${workpath}/build
}

cmake.out_of_source yes

# clear configure.cppflags to prevent the cmake portgroup from adding them to
# cflags, which breaks the build in presence of an older version, because it
# puts -I$prefix/include before the local include directories of the port
configure.cppflags
configure.args-append \
                    -DWITH_GCRYPT=OFF \
                    -DWITH_INTERNAL_DOC=OFF \
                    -DWITH_LIBZ=ON \
                    -DWITH_GSSAPI=OFF

variant kerberos5 description {Enable GSSApi/Kerberos support} {
    depends_lib-append      port:kerberos5
    configure.args-replace  -DWITH_GSSAPI=OFF \
                            -DWITH_GSSAPI=ON
}

livecheck.type      regex
livecheck.url       ${homepage}
livecheck.regex     "[quotemeta ${name}] (\\d+\\.\\d+(\\.\\d+)+)"