# -*- 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.81
categories          security net
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  bc43172278395568f1ee936c12b7786d30a4ee72 \
                    sha256  cb8b00a94f453494e345a3df281d7a3ed26bb0dd7e36264f145206f8857639fe \
                    size    2844616

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}