# -*- 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] .]
categories          devel security net
maintainers         {ionic @Ionic} openmaintainer
license             LGPL-2.1

description         SSH library
long_description    The {*}${description} designed to be used \
                    by programmers needing a working SSH implementation \
                    by means of a library.

homepage            https://www.libssh.org
master_sites        ${homepage}/files/${major}
use_xz              yes

checksums           rmd160  4eab4614c24ffce2d911fb5b74b7f96c8a8f4f4f \
                    sha256  1a6af424d8327e5eedef4e5fe7f5b924226dd617ac9f3de80f217d82a36a7121 \
                    size    751928

depends_build-append \
                    path:bin/pkg-config:pkgconfig \
                    path:bin/doxygen:doxygen

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

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

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

# https://trac.macports.org/ticket/72378
compiler.blacklist-append \
                    *gcc-4.0 *gcc-4.2

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

default_variants    +kerberos5

livecheck.type      regex
livecheck.url       https://git.libssh.org/projects/libssh.git/refs/tags
livecheck.regex     "${name}-(\\d+\\.\\d+(\\.\\d+)+)"
