SUMMARY="A retargettable, optimizing ANSI-C compiler suite"
DESCRIPTION="SDCC is a retargettable, optimizing ANSI-C compiler suite that \
targets the Intel MCS51 based microprocessors (8031, 8032, 8051, 8052, etc.), \
Maxim (formerly Dallas) DS80C390 variants, Freescale (formerly Motorola) HC08 \
based (hc08, s08), Zilog Z80 based MCUs (z80, z180, gbz80, Rabbit 2000/3000, \
Rabbit 3000A, TLCS-90) and STMicroelectronics STM8. Work is in progress on \
supporting the Microchip PIC16 and PIC18 targets. It can be retargeted for \
other microprocessors.
"
HOMEPAGE="http://sdcc.sourceforge.net"
LICENSE="
	GNU GPL v2
	"
COPYRIGHT="
	1999-2013 Sandeep Dutta
	"
SOURCE_URI="http://sourceforge.net/projects/sdcc/files/sdcc/$portVersion/sdcc-src-$portVersion.tar.bz2"
CHECKSUM_SHA256="f82978d1614244b22e093402c0a4de1f688a07c807b2980126c964eb3df85fa9"
REVISION="1"
ARCHITECTURES="x86 x86_64"
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="
	sdcc$secondaryArchSuffix = $portVersion
	cmd:sdcc$secondaryArchSuffix = $portVersion
	cmd:as2gbmap$secondaryArchSuffix
	cmd:makebin$secondaryArchSuffix
	cmd:packihx$secondaryArchSuffix
	cmd:s51$secondaryArchSuffix
	cmd:savr$secondaryArchSuffix
	cmd:sdar$secondaryArchSuffix
	cmd:sdas390$secondaryArchSuffix
	cmd:sdas6808$secondaryArchSuffix
	cmd:sdas8051$secondaryArchSuffix
	cmd:sdasgb$secondaryArchSuffix
	cmd:sdasrab$secondaryArchSuffix
	cmd:sdasstm8$secondaryArchSuffix
	cmd:sdastlcs90$secondaryArchSuffix
	cmd:sdasz80$secondaryArchSuffix
	cmd:sdcclib$secondaryArchSuffix
	cmd:sdcdb$secondaryArchSuffix
	cmd:sdcdb.el$secondaryArchSuffix
	cmd:sdcdbsrc.el$secondaryArchSuffix
	cmd:sdcpp$secondaryArchSuffix
	cmd:sdld$secondaryArchSuffix
	cmd:sdld6808$secondaryArchSuffix
	cmd:sdldgb$secondaryArchSuffix
	cmd:sdldstm8$secondaryArchSuffix
	cmd:sdldz80$secondaryArchSuffix
	cmd:sdnm$secondaryArchSuffix
	cmd:sdobjcopy$secondaryArchSuffix
	cmd:sdranlib$secondaryArchSuffix
	cmd:shc08$secondaryArchSuffix
	cmd:sst7$secondaryArchSuffix
	cmd:sstm8$secondaryArchSuffix
	cmd:sz80$secondaryArchSuffix
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libstdc++$secondaryArchSuffix
	"
BUILD_REQUIRES="
	devel:libboost_graph$secondaryArchSuffix
	devel:libiconv$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	haiku${secondaryArchSuffix}_devel
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:automake
	cmd:autoconf
	cmd:bison
	cmd:flex
	cmd:make
	"

PATCHES="sdcc-3.4.0.patchset"

BUILD()
{
	# The PIC14/16 ports need gputils. Enable them when we have a recipe for it.
	CFLAGS="-DO_ASYNC=0" \
	runConfigure ./configure --disable-pic14-port --disable-pic16-port
	make $jobArgs
}

INSTALL()
{
	make install
}
