SUMMARY="The GNU debugger for embedded ARM"
DESCRIPTION="
GDB, the GNU Project debugger, allows you to see what is going on \`inside' \
another program while it executes -- or what another program was doing at the \
moment it crashed.

GDB can do four main kinds of things (plus other things in support of these) \
to help you catch bugs in the act:
 * Start your program, specifying anything that might affect its behavior.
 * Make your program stop on specified conditions.
 * Examine what has happened, when your program has stopped.
 * Change things in your program, so you can experiment with correcting the \
effects of one bug and go on to learn about another.

The program being debugged can be written in Ada, C, C++, Objective-C, Pascal \
(and many other languages). Those programs might be executing on the same \
machine as GDB (native) or on another machine (remote). GDB can run on most \
popular UNIX and Microsoft Windows variants.
"

HOMEPAGE="http://sourceware.org/gdb/"
LICENSE="GNU GPL v3"
COPYRIGHT="Free Software Foundation"

SOURCE_URI="http://ftp.gnu.org/gnu/gdb/gdb-7.7.tar.bz2"
CHECKSUM_SHA256="0404d1c6ee6b3ddd811722b5197944758d37b4591c216030effbac204f5a6c23"
SOURCE_DIR="gdb-7.7"
REVISION="1"

PATCHES="gdb-7.7.patchset"

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="
	arm_none_eabi_gdb$secondaryArchSuffix = $portVersion
	cmd:arm_none_eabi_gdb$secondaryArchSuffix
	cmd:arm_none_eabi_run$secondaryArchSuffix
	devel:libarm_none_eabi_sim$secondaryArchSuffix
	"

REQUIRES="
	haiku$secondaryArchSuffix
	lib:libiconv$secondaryArchSuffix
	lib:libintl$secondaryArchSuffix
	lib:libncurses$secondaryArchSuffix
	lib:libexpat$secondaryArchSuffix
	"

BUILD_REQUIRES="
	gettext$secondaryArchSuffix
	devel:libiconv$secondaryArchSuffix
	devel:libncurses$secondaryArchSuffix
	devel:libexpat$secondaryArchSuffix
	"

BUILD_PREREQUIRES="
	haiku${secondaryArchSuffix}_devel
	cmd:aclocal
	cmd:autoconf
	cmd:automake
	cmd:autoreconf
	cmd:awk
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

BUILD()
{
	cd gdb && autoreconf; cd ..
	runConfigure ./configure --target=arm-none-eabi --disable-werror --with-expat
	make $jobArgs
}

INSTALL()
{
	make install
	mkdir -p /packaging/gdb/develop/lib
	prepareInstalledDevelLib libarm-none-eabi-sim
	rm -r $prefix/share # Locales end up there for some reason?
}
