PortSystem 1.0

name			tclcl
version			1.16
revision		1
categories		lang
platforms		darwin
license			BSD-old
maintainers		nomaintainer
description             TclCL (Tcl with classes)
long_description        TclCL is a Tcl/C++ interface
homepage		http://otcl-tclcl.sourceforge.net/tclcl/
master_sites		sourceforge:otcl-tclcl:tclcl \
			sourceforge:tcl:tcl
set tclmaj		8.4
set tclmin		9
dist_subdir             tcltk
set tclv		${tclmaj}.${tclmin}
distfiles		${name}-src-${version}.tar.gz:tclcl \
			tcl${tclv}-src.tar.gz:tcl
checksums		${name}-src-${version}.tar.gz md5 2a25a4736c1bf4ec7f4e6343aa533bc6 \
                        tcl${tclv}-src.tar.gz md5 7e01b409925e4eb59ad44a4c12b9c681

depends_build		port:autoconf \
			port:automake

depends_lib		port:tcl \
			port:tk \
			port:otcl

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=${prefix} --with-tcl-ver=${tclmaj} \
			--with-tk=${prefix} --with-tk-ver=${tclmaj} \
			--with-otcl=${prefix} \
			--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|@V_TCLSH@|${prefix}/bin/tclsh8.4|g" \
				${worksrcpath}/Makefile
                        reinplace "s|@V_LIBRARY_TCL@|${prefix}/lib/tcl8.4|g" \
                                ${worksrcpath}/Makefile
                        reinplace "s|-ltk8.4|-ltcl8.4 -ltk8.4|g" \
                                ${worksrcpath}/Makefile
                        reinplace "s|http2.4|http2.5|g" \
                                ${worksrcpath}/Makefile
                        reinplace "s|@V_TCL_LIBRARY_FILES@|\$(TCL_84_LIBRARY_FILES)|g" \
                                ${worksrcpath}/Makefile
}

build.target		all

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

destroot		{
                        xinstall -m 0644 {*}[glob -directory ${worksrcpath} *.h] ${destroot}${prefix}/include
                        xinstall -m 0755 ${worksrcpath}/tcl2c++ ${destroot}${prefix}/bin
                        xinstall -m 0644 ${worksrcpath}/libtclcl.a ${destroot}${prefix}/lib
}
