# $Id: Portfile 87064 2011-11-09 01:07:37Z mww@macports.org $

PortSystem 1.0

name          tcl
version       8.5.11
# Tk (x11/tk) port depends on this version
categories    lang
license       Tcl/Tk
maintainers   mww openmaintainer
platforms     darwin freebsd
description   Tool Command Language
long_description \
  Tcl (Tool Command Language) is a very powerful but easy to learn dynamic \
  programming language, suitable for a very wide range of uses, including web \
  and desktop applications, networking, administration, testing and many more. \
  Open source and business-friendly, Tcl is a mature yet evolving language \
  that is truly cross platform, easily deployed and highly extensible.

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

checksums           md5     b01a9691c83990b3db0ce62d1012ca67 \
                    sha1    cb70dcfb7625389afd774e0438a7ade3e7aa13c8 \
                    rmd160  36140b5e8365c190202132dd6f0dfeb831ea9bc8

dist_subdir     tcltk
distname        ${name}${version}-src
worksrcdir      ${name}${version}/unix
configure.args  --mandir=${prefix}/share/man --disable-corefoundation
configure.cppflags-delete  -I${prefix}/include
configure.ldflags-delete   -L${prefix}/lib

destroot.destdir  INSTALL_ROOT=${destroot}
post-destroot {
    ln -s tclsh8.5 ${destroot}${prefix}/bin/tclsh
    ln -s libtcl8.5.dylib ${destroot}${prefix}/lib/libtcl.dylib
}

# dont enable threads by default as Tcl uses thread-local storage which makes
# passing Tcl_Obj* around between threads fatal
variant threads description {add multithreading support} {
    configure.args-append --enable-threads
}

variant memdebug description {enable memory debugging support} {
    configure.args-append --enable-symbols=mem
}

platform darwin {
    configure.args-append tcl_cv_type_64bit="long long"
}

# Files with failing tests: socket.test
test.run      yes

livecheck.type  regex
livecheck.regex {Tcl/Tk (\d+(?:\.\d+)*)</a>}
