PortSystem 1.0

name			otcl
version			1.9
revision		1
categories		lang
license			MIT Tcl/Tk
platforms		darwin
maintainers		nomaintainer
description		MIT Object Tcl
long_description	OTcl, short for MIT Object Tcl, is an extension to \
			Tcl/Tk for object-oriented programming.
homepage		http://otcl-tclcl.sourceforge.net/otcl/
master_sites		sourceforge:otcl-tclcl:otcl \
			sourceforge:tcl:tcl
set tclmaj		8.4
set tclmin		9
dist_subdir		tcltk
set tclv		${tclmaj}.${tclmin}
distfiles		${name}-${version}.tar.gz:otcl \
			tcl${tclv}-src.tar.gz:tcl
checksums		${name}-${version}.tar.gz md5 d17331ef65912f43c530c57565f85600 \
                        tcl${tclv}-src.tar.gz md5 7e01b409925e4eb59ad44a4c12b9c681

depends_build		port:autoconf \
			port:automake

depends_lib		port:tcl \
			port:tk

patchfiles		conf_configure.in.fns.patch \
			conf_configure.in.Tcl.patch

pre-configure		{
			system "cd ${worksrcpath} && ${prefix}/bin/aclocal && ${prefix}/bin/autoconf"
}

configure.args		--with-Tcl=${prefix} --with-Tcl-ver=${tclmaj} \
			--with-tk=${prefix} --with-tk-ver=${tclmaj} \
			--prefix=${prefix} \
			CPPFLAGS='-I${prefix}/include -I${workpath}/tcl${tclv}/generic/' \
			CFLAGS='-I${prefix}/include -I${workpath}/tcl${tclv}/generic/' \
			LDFLAGS='-L${prefix}/lib'

post-configure          {
                        reinplace "s|-ltk8.4|-ltcl8.4 -ltk8.4|g" \
                                ${worksrcpath}/Makefile
}

build.target		all

post-build		{
			system "/usr/bin/ranlib ${worksrcpath}/libotcl.a"
}

destroot		{
			xinstall -m 0755 -W ${worksrcpath} owish otclsh ${destroot}${prefix}/bin
			xinstall -m 0644 ${worksrcpath}/libotcl.a ${destroot}${prefix}/lib
			xinstall -m 0644 ${worksrcpath}/otcl.h ${destroot}${prefix}/include
}
