# -*- 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.12.0
revision            0
set major           [join [lrange [split ${version} .] 0 1] .]
master_sites        https://www.libssh.org/files/${major}
use_xz              yes

checksums           rmd160  4eab4614c24ffce2d911fb5b74b7f96c8a8f4f4f \
                    sha256  1a6af424d8327e5eedef4e5fe7f5b924226dd617ac9f3de80f217d82a36a7121 \
                    size    751928

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+)+)"
