SUMMARY="Cross-development tools for the Motorola 6809"
DESCRIPTION="LWTOOLS is a set of cross-development tools for the Motorola 6809 \
and Hitachi 6309 microprocessors. It supports assembling to raw binaries, CoCo \
LOADM binaries, and a proprietary object file format for later linking. It also \
supports macros and file inclusion among other things."
HOMEPAGE="http://lwtools.projects.l-w.ca/"
COPYRIGHT="2006-2014 William Astle"
LICENSE="GNU GPL v3"
REVISION="2"
SOURCE_URI="$HOMEPAGE/releases/lwtools/lwtools-$portVersion.tar.gz"
CHECKSUM_SHA256="42cf63d3964045a0ac4547a01b83e96cdba9ae8f021340d6809261f745bc0aa4"

ARCHITECTURES="!x86_gcc2"
SECONDARY_ARCHITECTURES="x86"

PROVIDES="
	lwtools$secondaryArchSuffix = $portVersion
	cmd:lwar
	cmd:lwasm
	cmd:lwlink
	cmd:lwobjdump
	cmd:m6809_unknown_ar
	cmd:m6809_unknown_as
	cmd:m6809_unknown_ld
	cmd:m6809_unknown_nm
	cmd:m6809_unknown_objdump
	cmd:m6809_unknown_ranlib
	cmd:m6809_unknown_strip
	"
REQUIRES="
	haiku$secondaryArchSuffix
	"

BUILD_PREREQUIRES="
	haiku${secondaryArchSuffix}_devel
	cmd:cc$secondaryArchSuffix
	cmd:make
	"

BUILD()
{
	make
}

INSTALL()
{
	make install INSTALLDIR=$prefix/bin

	# Install the binutil-like interfaces to the tools
	cp extra/as $prefix/bin/m6809-unknown-as
	cp extra/ar $prefix/bin/m6809-unknown-ar
	cp extra/ld $prefix/bin/m6809-unknown-ld

	ln -s /bin/true $prefix/bin/m6809-unknown-nm
	ln -s /bin/true $prefix/bin/m6809-unknown-objdump
	ln -s /bin/true $prefix/bin/m6809-unknown-ranlib
	ln -s /bin/true $prefix/bin/m6809-unknown-strip
}
