# $Id: Portfile,v 1.5 2006/08/04 23:39:16 markd Exp $
PortSystem      1.0

name                    blt
version                 2.4z
revision		1
categories              x11
maintainers             markd@opendarwin.org
description             BLT is an extension to the Tk toolkit, adding new widgets, \
			geometry managers, and miscellaneous commands.
long_description        ${description}
  
homepage                http://blt.sourceforge.net/
platforms               darwin

master_sites            sourceforge
distname		BLT${version}
checksums               md5 aa2ed73080f3005d9c2a3b5e57ab1eff

depends_build           lib:libX11.6:XFree86 \
			port:tcl \
			port:tk

configure.env		CPPFLAGS="-L${prefix}/lib" \
			CFLAGS="-O3 -fno-common" \
			LDFLAGS="-L${prefix}/lib"

configure.args		--prefix=${prefix} \
			--exec_prefix=${prefix} \
			--bindir=${prefix}/bin \
			--includedir=${prefix}/include \
			--libdir=${prefix}/lib \
			--with-tcllibs=${prefix}/lib \
			--with-tklibs=${prefix}/lib \
			--with-tclincls=${prefix}/include \
			--with-tkincls=${prefix}/include \
                        --with-tcl=${prefix} \
                        --with-tk=${prefix}

patchfiles		patch-configure \
			patch-Makefile.in \
			patch-library-Makefile.in \
			patch-src-Makefile.in \
			patch-src-shared-Makefile.in \
			patch-library-pkgIndex.tcl.in \
			patch-demos-Makefile.in

post-patch {
        reinplace "s|__DESTROOT__|${destroot}|g" \
                ${worksrcpath}/Makefile.in \
		${worksrcpath}/src/Makefile.in \
		${worksrcpath}/src/shared/Makefile.in \
		${worksrcpath}/demos/Makefile.in

	eval reinplace "s|../src/bltwish|${prefix}/bin/bltwish|g" \
                [glob ${worksrcpath}/demos/*.tcl] \
		[glob ${worksrcpath}/demos/scripts/*.tcl]
}

post-destroot {
	system "cd ${destroot}${prefix}/lib && ln -sf libBLT.2.4.dylib libBLT.2.dylib"
	system "cd ${destroot}${prefix}/lib && ln -sf libBLT.2.4.dylib libBLT.dylib"
	system "cd ${destroot}${prefix}/lib && ln -sf libBLTlite.2.4.dylib libBLTlite.2.dylib"
	system "cd ${destroot}${prefix}/lib && ln -sf libBLTlite.2.4.dylib libBLTlite.dylib"
}
