# -*- 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
# $Id$
PortSystem      1.0
PortGroup       compilers 1.0

name            eso-tk84
conflicts       eso-tk84-devel
version         8.4.20
revision        12

set _name       tk
categories      x11
maintainers     eso.org:usd-help
description     Tcl Tool Kit
long_description \
  This is Tk version ${version}, a GUI toolkit for Tcl. The best way to get \
  started with Tcl is to read ``Tcl and the Tk Toolkit'' by John K.         \
  Ousterhout, Addison-Wesley, ISBN 0-201-63337-X. 

platforms       darwin
master_sites    sourceforge:tcl
homepage      http://www.tcl.tk/
master_sites  sourceforge:project/tcl/Tcl/${version}


dist_subdir     eso-tcltk
distname        ${_name}${version}-src
worksrcdir      ${_name}${version}/unix
checksums \
  ${distname}${extract.suffix} \
    md5 24d18fbebe3bb8853e418431be01bf2c \
    sha1 464bd7e1411e247e365e4ff585900333b3f91f56 \
    rmd160 8545933c172ffcd7024db91f7292190776d3a873
# suck in Tcl as well so we can use it internally.
distfiles-append    tcl${version}-src${extract.suffix}
checksums-append \
  tcl${version}-src${extract.suffix} \
    md5 f1c783a49547778d160e10be2fb5d76f \
    sha1 7edc6b8eb5f49980ba9b788e12c236501327c815 \
    rmd160 8432aff66525a3c3f9dadb2bd8e32c28c539d14d

checksums           tk8.4.20-src.tar.gz \
                    md5     7183ced20a9985e2fb39cd7fb3a3882b \
                    sha1    c97f24ea4a0ec9a65e0b02015244a32cd49650f8 \
                    rmd160  236f097f26cced54a3be2d44e63bc082a07b4eeb \
                    sha256  61f8a8dcbfb959986439b8e30a86688376671b8b3cac77b466671bbfaef244bd \
                    tcl8.4.20-src.tar.gz \
                    md5     b57ecc6540026fd4a83288ac6bf2b02b \
                    sha1    a9b7836aa5a1de31fde2738e2c15033d731f2aba \
                    rmd160  27abfdd9d8d518cfc3beff85ca782144710b13e2 \
                    sha256  fcb317b65c69f1d6962057c5622a80980bc22ffadf25c1cc50b6d02ff6c2cf40


compilers.choose  cc cxx
compilers.setup   gcc 

default_variants  +${compilers.gcc_default}
use_parallel_build      no


prefix              /opt/local/libexec/eso/tcltk-8.4
destroot.destdir    INSTALL_ROOT=${destroot}
configure.args      --exec_prefix=${prefix} \
                    --mandir=${prefix}/share/man \
                    --with-tcl=${prefix}/lib \
                    --x-includes=/opt/local/include \
                    --x-libraries=/opt/local/lib \
                    --enable-shared
if { [gcc_variant_isset] && [compilers::get_current_gcc_version] >= 14 } {
  configure.cflags-append  \
          -Wno-error=implicit-int \
          -Wno-incompatible-library-redeclaration \
          -Wno-builtin-declaration-mismatch \
          -Wno-implicit-function-declaration \

}

depends_lib         port:eso-tcl84 \
                    port:xorg-server \

configure.cppflags-append \
  -I${workpath}/tcl${version}/generic

variant aqua {
    configure.args-append   --enable-aqua
}

post-patch {
    reinplace s|@TCL_SRC_DIR@|${worksrcpath}/../../tcl${version}/|g ${worksrcpath}/Makefile.in
}

post-destroot {
    ln -s ${prefix}/bin/wish8.4 ${destroot}${prefix}/bin/wish
    ln -s ${prefix}/lib/libtk8.4.dylib ${destroot}${prefix}/lib/libtk.dylib
    
    if {[variant_isset aqua]} {
        delete ${destroot}${prefix}/include/X11
    }
}
