Portfile

# $Id: Portfile 20287 2006-11-01 16:42:52Z blair@macports.org $

PortSystem 1.0
name prc-tools
version 2.3
categories palm devel
maintainers css@macports.org
description C and C++ programming tools for Palm OS
long_description The prc-tools package is a collection of tools \
supporting C and C++ programming for Palm OS. It consists \
of: the GNU Compiler Collection, assembler, linker, and \
symbolic debugger, modifications to these tools to support \
functionality peculiar to the PalmOS, tools for dealing \
with PalmOS .prc executables, and finally, conveniently \
packaged documentation.

platforms darwin
homepage http://prc-tools.sourceforge.net/
master_sites sourceforge:${name} \
gnu:binutils:binutils \
gnu:gdb:gdb \
gnu:gcc/gcc-2.95.3:gcc295 \
gnu:gcc/gcc-3.3.1:gcc331

distfiles ${distname}${extract.suffix} \
binutils-2.14.tar.gz:binutils \
gdb-5.3.tar.gz:gdb \
gcc-2.95.3.tar.gz:gcc295 \
gcc-3.3.1.tar.gz:gcc331

checksums ${distname}${extract.suffix} md5 038a42a71a984fee6f906abc85a032ec \
binutils-2.14.tar.gz md5 ba665d0ddcc88313384b79e293ecbbab \
gdb-5.3.tar.gz md5 1e8566325f222edfbdd93e40c6ae921b \
gcc-2.95.3.tar.gz md5 f3ad4f32c2296fad758ed051b5ac8e28 \
gcc-3.3.1.tar.gz md5 46d58197212818b5f7c403267ff24e4e

# Patching, configuring, and building PRC-Tools is not trivial.
# See http://prc-tools.sourceforge.net/install/BUILDING.html

# Apply all included patches and create symbolic links.
post-extract {
ui_msg "Applying ${name} patches..."
system "cd ${workpath} && \
cat ${worksrcpath}/*.palmos.diff | patch -p0"
ui_msg "Creating symbolic links for build..."
system "cd ${worksrcpath} && \
ln -s ../binutils-2.14 binutils && \
ln -s ../gdb-5.3 gdb && \
ln -s ../gcc-2.95.3 gcc295 && \
ln -s ../gcc-3.3.1 gcc"
ui_msg "Custom ${name} pre-build steps complete."
}

use_configure yes
configure.args \
--disable-nls \
--enable-targets=m68k-palmos,arm-palmos \
--enable-languages=c,c++ \
--with-palmdev-prefix=${prefix}/share/palmdev \
--prefix=${prefix} \
--mandir=${prefix}/share/man \
--infodir=${prefix}/share/info

destroot.destdir prefix=${destroot}${prefix}

# Clean up junk left in place by the way that the install copies
# files within the destroot directory!
post-destroot {
file delete -force ${destroot}${prefix}/arm-palmos
file delete -force ${destroot}${prefix}/m68k-palmos
}

# Cannot use gcc 4, so need to set the environment to use gcc 3.3.
# Extra configurations occur during the build phase, so the
# environment variables should be set during that phase too.
platform darwin 8 {
configure.env-append CC=gcc-3.3 CXX=g++-3.3 CPP=cpp-3.3
build.cmd CC=gcc-3.3 CXX=g++-3.3 CPP=cpp-3.3 make
}