# $Id: Portfile,v 1.2 2005/06/14 06:28:46 jkh Exp $

PortSystem 1.0
name			cc65
version			2.9.3
categories		lang
maintainers		darwinports@opendarwin.org
description		6502 C compiler
platforms		darwin
distfiles		cc65-sources-${version}.tar.bz2
use_bzip2		yes
master_sites		http://www.funet.fi/pub/cbm/programming/cc65/ \
			http://bj.spline.de/cc65/
checksums		md5 255a231cd475852545a5bad1d21e867d
worksrcdir		${name}-${version}/src
configure		{}
build.args		-f make/gcc.mak
build.env		PREFIX=${prefix}
patchfiles		patch-gcc.mak

post-build {
	system "cd ${worksrcpath}/../libsrc && make"
}

destroot {
	set _d ${destroot}${prefix}
	file delete ${_d}/man
	system "mkdir -p ${_d}/lib/cc65/{lib,include/geos}"
	system "install -s -m 755 ${worksrcpath}/ar65/ar65 ${_d}/bin"
	system "install -s -m 755 ${worksrcpath}/ca65/ca65 ${_d}/bin"
	system "install -s -m 755 ${worksrcpath}/cc65/cc65 ${_d}/bin"
	system "install -s -m 755 ${worksrcpath}/cl65/cl65 ${_d}/bin"
	system "install -s -m 755 ${worksrcpath}/da65/da65 ${_d}/bin"
	system "install -s -m 755 ${worksrcpath}/grc/grc ${_d}/bin"
	system "install -s -m 755 ${worksrcpath}/ld65/ld65 ${_d}/bin"
	system "install -m 644 ${worksrcpath}/../libsrc/*.{o,lib} ${_d}/lib/cc65/lib"
	system "install -m 644 ${worksrcpath}/../include/*.h ${_d}/lib/cc65/include"
	system "install -m 644 ${worksrcpath}/../include/geos/*.h ${_d}/lib/cc65/include/geos"
}
