# $Id: Portfile 80454 2011-07-13 13:58:35Z jmr@macports.org $

PortSystem 1.0

name          tcl
version       8.5.9
# 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

checksums           md5     8512d8db3233041dd68a81476906012a \
                    sha1    ae87c5e58ba20760d9bc77117d219bbf1b6a5557 \
                    rmd160  d858c4fbe1a75bef9c4a4c03e50d8aa807a9d28b

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>}
