# $Id: Portfile,v 1.5 2006/04/23 22:23:44 dluke Exp $

PortSystem 1.0

name		clearsilver
version 	0.10.3
revision	1
categories	www python perl
platforms	darwin
maintainers	dluke@geeklair.net
description 	Language-neutral template system.
long_description	Clearsilver is a fast, powerful, and language-neutral \
			HTML template system. In both  static content sites \
			and dynamic  HTML applications, it provides a \
			separation between  presentation code and application \
			logic which makes  working with your project easier.

homepage	http://www.clearsilver.net
master_sites	${homepage}/downloads
checksums md5	ff4104b0e58bca1b61d528edbd902769

patchfiles	patch-rules.mk.in

depends_lib	port:python24 port:perl5.8 port:zlib port:gettext

configure.args	--disable-apache --disable-java --disable-ruby \
		--disable-csharp \
		--with-python=${prefix}/bin/python \
		--with-perl=${prefix}/bin/perl \
		--enable-gettext

pre-configure	{
	set PYTHON_PATH [exec ${prefix}/bin/python -c "import sys; print (sys.prefix or sys.exec_prefix) + '/lib/python' + sys.version\[0:3\]"]

	reinplace "s|PYTHON_SITE=`.*|PYTHON_SITE=${PYTHON_PATH}/site-packages|g" \
		${worksrcpath}/configure

	reinplace "s|/usr/local/bin/python|${prefix}/bin/python|g" \
		${worksrcpath}/scripts/document.py
	reinplace "s|/usr/bin/python|${prefix}/bin/python|g" \
		${worksrcpath}/scripts/cs_lint.py
	reinplace "s|/neo/opt/bin/python|${prefix}/bin/python|g" \
		${worksrcpath}/scripts/ChangeLog.py
	reinplace "s|/usr/bin/python|${prefix}/bin/python|g" \
		${worksrcpath}/scripts/commitlog.py

	reinplace "s|\$(PERL) Makefile.PL|\$(PERL) Makefile.PL installdirs=vendor|g" \
		${worksrcpath}/Makefile
}

## stolen from perl5 group code
post-destroot {
                foreach packlist [exec find ${destroot} -name .packlist] {
                        ui_info "Fixing packlist ${packlist}"
                        reinplace "s|${destroot}||" ${packlist}
                }
		foreach badfile [exec find ${destroot} -name perllocal.pod] {
			ui_info "Removing ${badfile}"
			file delete ${badfile}
		}
        }
