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

name                tcl-tls
version             2.0.1
categories          devel
license             Tcl/Tk
maintainers         nomaintainer

description         TLS OpenSSL extension to TCL.
long_description \
    TLS is an OpenSSL / RSA-bsafe Tcl extension that provides secure \
    connections on top of the Tcl socket mechanism.

homepage            https://core.tcl-lang.org/tcltls/
master_sites        ${homepage}uv/
distname            tcltls${version}

checksums           rmd160 b50b4b9031339b93c886f11f439dff7539d13574 \
                    sha256 afffeb5de1978f47745db4804c1dfdcd6605ceac32e324fe8bbe49843de0baae

subport tcl8-tls {}
subport tcl9-tls {}

if {$subport eq $name} {
    PortGroup stub 1.0

    depends_lib  port:tcl8-tls

    livecheck.url       ${homepage}uvlist?byage=1
    livecheck.regex     tcltls-(\[\\d\\.\]+\\d+)
} else {
    set tclport [string range $subport 0 3]
    depends_lib         path:lib/libssl.dylib:openssl \
                        port:${tclport}

    patchfiles          flag-order.patch

    configure.args      --with-openssl-dir=${prefix} \
                        --includedir=${prefix}/include/${subport} \
                        --with-tcl=${prefix}/lib/${tclport} \
                        --with-tclinclude=${prefix}/include/${tclport} \
                        --libdir=${prefix}/lib/${tclport} \
                        --mandir=${prefix}/share/${tclport}/man

    livecheck.type      none
}
