# $Id$

PortSystem          1.0
PortGroup	    perl5 1.0

## name could be changed as there is also php/python/ruby/c++ bindings ?
name                perlchartdir
version             5.0.2
distname            chartdir_perl_mac
categories          graphics
platforms           darwin
maintainers         ports@
description         ChartDirector for Perl
long_description    Professional chart component for windows and web applications
license             commercial
homepage            http://www.advsofteng.com/
master_sites        http://download2.advsofteng.com/

checksums           md5     745d07eb75961abb004b5748d6813297 \
                    sha1    5a84d1d0ae8284b7fea2dbd68f130fbd1c62541f \
                    rmd160  24170a237112b2e0a4c50bec629cd9641bea33f9

depends_lib         path:bin/perl:perl5

worksrcdir          ChartDirector

use_configure       no
build               {
	foreach file [glob -directory ${worksrcpath}/perldemo *] {
		#reinplace "s|^#!/usr/bin/perl|#!${perl5.bin}\\\nuse lib \"${perl5.lib}\";|" \

		## lib supports only Apple perl for now as Macports seem to use different configure options
		reinplace "s|^#!/usr/bin/perl|#!/usr/bin/perl\\\nuse lib \"${perl5.lib}\";|" \
			${file}
	}
}

destroot	    {
	xinstall -d ${destroot}${perl5.lib}
	xinstall -m 644 -W ${worksrcpath}/lib FinanceChart.pm libchartdir.so perlchartdir.pm perlchartdir510.dylib perlchartdir510i64.dylib perlchartdir510i64mt.dylib perlchartdir510mt.dylib perlchartdir58.dylib perlchartdir58i64.dylib perlchartdir58i64mt.dylib perlchartdir58mt.dylib ${destroot}${perl5.lib}

	xinstall -d ${destroot}${prefix}/share/examples
	file copy ${worksrcpath}/perldemo ${destroot}${prefix}/share/examples/${name}
	xinstall -d ${destroot}${prefix}/share/doc/${name}
	xinstall -m 644 -W ${worksrcpath}/doc cdperl.htm ${destroot}${prefix}/share/doc/${name}
	file copy ${worksrcpath}/doc/cdperldoc ${destroot}${prefix}/share/doc/${name}
}

notes "
This port is binary only and is usable only with Apple perl (/usr/bin/perl) on Intel architecture.
Use ${perl5.lib} as Perl library to use it (either with 'perl -Ipath', PERL5LIB, or @INC).
"
