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

name                libssh
epoch               1
version             0.11.1
revision            0
set major           [join [lrange [split ${version} .] 0 1] .]
master_sites        https://www.libssh.org/files/${major}
use_xz              yes

checksums           rmd160  b20556382920533b47cd8464aabb71554672a637 \
                    sha256  14b7dcc72e91e08151c58b981a7b570ab2663f630e7d2837645d5a9c612c1b79 \
                    size    621108

categories          devel security net
maintainers         {ionic @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            https://www.libssh.org

depends_build-append \
                    port:pkgconfig \
                    path:bin/doxygen:doxygen

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

default_variants    +kerberos5

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

# One header is missed:
# error: field ‘ifru_addr’ has incomplete type
patchfiles-append   patch-fix-includes.diff

# -isystem has the added benefit of moving the include
# directory specified to the end of the include path list.
# This will help the build system respect custom include
# paths correctly (i.e., searching them before the MP include
# directory.)
configure.cppflags-replace  -I${prefix}/include -isystem${prefix}/include
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       https://git.libssh.org/projects/libssh.git/refs/tags
livecheck.regex     "${name}-(\\d+\\.\\d+(\\.\\d+)+)"
