SUMMARY="The GNU debugger"
DESCRIPTION="GDB is the GNU debugger. It 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="https://sourceware.org/gdb/"
LICENSE="GNU GPL v2"
COPYRIGHT="2004 Free Software Foundation, Inc."
SOURCE_URI="https://ftp.gnu.org/gnu/gdb/gdb-6.3a.tar.bz2"
CHECKSUM_SHA256="f89b8f7bdddc7d9f111a1a1968b231165b8f1ff09843e4201076d0b77e0be244"
REVISION="1"

PATCHES="gdb-6.3.patch"
ARCHITECTURES="x86_gcc2 x86 x86_64"

PROVIDES="
	gdb = $portVersion
	cmd:gdb = $portVersion
	cmd:gdbtui = $portVersion
	devel:libbfd = $portVersion
	devel:libopcodes = $portVersion
	devel:libiberty = $portVersion
	"
REQUIRES="
	haiku
	lib:libiconv
	lib:libncurses
	"

BUILD_REQUIRES="
	devel:libiconv
	devel:libncurses
	"
BUILD_PREREQUIRES="
	haiku_devel
	cmd:awk
	cmd:bison
	cmd:yacc
	cmd:m4
	cmd:flex
	cmd:make
	cmd:gcc
	cmd:ld
	"

BUILD()
{
	if [ $targetArchitecture = x86_gcc2 ] || [ $targetArchitecture = x86 ]; then
    	TARGET=i586-pc-haiku
	elif [ $targetArchitecture = x86_64 ]; then
		TARGET=x86_64-pc-haiku
	fi
	runConfigure --omit-dirs "docDir dataRootDir" ./configure \
		--host=$TARGET --target=$TARGET --disable-nls
	make configure-host
	make configure-target

	make $jobArgs
}

INSTALL()
{
	make install

	prepareInstalledDevelLibs \
		libbfd \
		libopcodes \
		libiberty
}
