# -*- 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           active_variants 1.1
PortGroup           cmake 1.1

name                putty
version             0.83
categories          security net
conflicts           pssh-lilydjwg
maintainers         nomaintainer
license             MIT

description         A free implementation of Telnet and SSH, \
                    along with an xterm terminal emulator

long_description    PuTTY is ${description}.

homepage            https://www.chiark.greenend.org.uk/~sgtatham/putty/
master_sites        ftp://ftp.chiark.greenend.org.uk/users/sgtatham/putty-${version}/ \
                    https://the.earth.li/~sgtatham/putty/${version}/

checksums           rmd160  4bf188317ec858c5c9a69989527a5d3056b96dcb \
                    sha256  718777c13d63d0dff91fe03162bc2a05b4dfc8b0827634cd60b51cefdff631c6 \
                    size    3007178

patchfiles-append   patch-STDC_FORMAT_MACROS.diff

# ecc-ssh.c: error: unknown field ‘ecdh_vt’ specified in initializer
compiler.blacklist-append \
                    *gcc-4.0 *gcc-4.2

depends_build-append    port:pkgconfig
configure.args-append   -DPUTTY_GTK_VERSION=0

if {${os.platform} eq "darwin" && ${os.major} < 16} {
    configure.args-append \
                        -DHAVE_ALIGNED_ALLOC=0
}

pre-configure {
    configure.cflags-delete -DNDEBUG
}

variant gui description {Build the GUI tools (including putty itself)} {
    depends_lib-append      path:lib/pkgconfig/gtk+-3.0.pc:gtk3
    require_active_variants gtk3 x11
    configure.args-append   -DPUTTY_GTK_VERSION=3
}

default_variants    +gui

livecheck.type      regex
livecheck.url       ${homepage}download.html
livecheck.regex     ${name}-(\[0-9.\]+)${extract.suffix}