# $Id: Portfile 53537 2009-07-07 21:24:06Z macsforever2000@macports.org $

PortSystem 1.0

name            cc65
version         2.12.0
categories      lang
platforms       darwin
maintainers     nomaintainer

description     6502 C compiler
long_description \
                cc65 is a complete cross development package for 65(C)02 \
                systems, including a powerful macro assembler, a C compiler, \
                linker, librarian and several other tools.

homepage        http://www.cc65.org/
distfiles       cc65-sources-${version}.tar.bz2
worksrcdir      ${name}-${version}/src
use_bzip2       yes

master_sites    http://www.mirrorservice.org/sites/master.us.finkmirrors.net/distfiles/ \
                http://www.funet.fi/pub/cbm/programming/cc65/ \
                http://bj.spline.de/cc65/ \
                ftp://ftp.musoftware.de/pub/uz/cc65/ \
                ftp://ftp.musoftware.de/pub/uz/cc65/old/

patchfiles      patch-makefiles.diff

checksums       md5 bd6d194a489334164a0fc383d1e12acc


use_configure   no

build.args      -f make/gcc.mak
build.env       PREFIX=${prefix}

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"
}
