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/"
SOURCE_URI="$HOMEPAGE/releases/lwtools/lwtools-$portVersion.tar.gz"
CHECKSUM_SHA256="06ee27c597798bbfb064a8d9471e5cd91074ff22fa8eb4f7d276a8809d35622c"
REVISION="2"
COPYRIGHT="2006-2014 William Astle"
LICENSE="GNU GPL v3"

ARCHITECTURES=""
if [ $effectiveTargetArchitecture != x86_gcc2 ]; then
	# x86_gcc2 is fine as primary target architecture as long as we're building
	# for a different secondary architecture.
	ARCHITECTURES="$ARCHITECTURES x86_gcc2"
fi
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
}
