# $Id: Portfile,v 1.31 2006/03/28 08:55:43 blb Exp $

PortSystem		1.0
name			tk
version			8.4.12
categories		x11
maintainers		landonf@opendarwin.org
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
dist_subdir		tcltk
distname		${name}${version}-src
worksrcdir		${name}${version}/unix
checksums		${distname}${extract.suffix} md5 316491cb82d898b434842353aed1f0d6
# 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 7480432d8730263f267952788eb4839b
destroot.destdir	INSTALL_ROOT=${destroot}
configure.args		--mandir=${prefix}/share/man --with-tcl=${prefix}/lib
# force usage of DP Tcl
depends_lib		port:tcl lib:libX11.6:XFree86

configure.env		CFLAGS=-I${worksrcpath}/../../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 {
	cd ${destroot}${prefix}/bin
	system "ln -s ${prefix}/bin/wish8.4 wish"
	cd ${destroot}${prefix}/lib
	system "ln -s ${prefix}/lib/libtk8.4.dylib libtk.dylib"
}
