SUMMARY="libdwarf and dwarfdump for working with DWARF"
DESCRIPTION="DWARF is a widely used, standardized debugging data format. \
DWARF was originally designed along with Executable and Linkable Format (ELF),\
although it is independent of object file formats. The name is a medieval \
fantasy complement to ELF that has no official meaning, although the \
backronym 'Debugging With Attributed Record Formats' was later proposed.

The DWARF Debugging Information Format is of interest to programmers working \
on compilers and debuggers (and anyone interested in reading or writing DWARF \
information). DWARF uses a data structure called a Debugging Information Entry \
(DIE) to represent each variable, type, procedure, etc. It was developed by a \
committee (known as the PLSIG at the time) starting around 1991. Starting \
around 1991 SGI developed the libdwarf and dwarfdump tools for internal use and \
as part of SGI IRIX developer tools. Since that time dwarfdump and libdwarf \
have been shipped (as an executable and archive respectively, not source) with \
every release of the SGI MIPS/IRIX C compiler. In 1994 (I think the correct \
year) SGI agreed to open-source libdwarf (and in 1999 to open-source dwarfdump) \
so anyone could use them.

libdwarf allows reading, creation and manipulation of dwarf data.  dwarfdump \
(written in C) and dwarfdump2 (written in C++) do the same job, they let you \
dump out, in readable form, the DWARF2, DWARF3, or DWARF4 data from an object \
file, but dwarfdump2 does a better job in some respects.

This package includes dwarfdump2 and libdwarf, although the source package has \
been patched to make dwarfdump and dwarfgen Haiku compatible as well."
HOMEPAGE="http://www.prevanders.net/dwarf.html"
SOURCE_URI="http://www.prevanders.net/libdwarf-20130729.tar.gz"
CHECKSUM_SHA256="b6455d8616baf2883e2af91f006d6cbd583128fdfff46e3d1fae460bc223bb7b"
LICENSE="
	GNU GPL v2
	GNU LGPL v2.1
	"
COPYRIGHT="
	2000,2002,2004,2005 Silicon Graphics, Inc.  All Rights Reserved.
	2007-2010 David Anderson. All Rights Reserved.
	2007-2010 Sun Microsystems, Inc. All rights reserved
	"
REVISION="1"
ARCHITECTURES="x86 x86_gcc2"
SECONDARY_ARCHITECTURES="x86_gcc2 x86"
SOURCE_DIR="dwarf-$portVersion"
PATCHES="libdwarf-20130729.patch"

PROVIDES="
	lib:libdwarf$secondaryArchSuffix = $portVersion
	cmd:dwarfdump = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libelf$secondaryArchSuffix
	"
PROVIDES_devel="
	libdwarf${secondaryArchSuffix}_devel = $portVersion
	devel:libdwarf$secondaryArchSuffix = $portVersion
	"
REQUIRES_devel="
	lib:libdwarf$secondaryArchSuffix == $portVersion base
	"
BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libelf$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:make
	"
	
BUILD()
{
	cd libdwarf
	runConfigure ./configure --enable-shared
	make
	cd ../dwarfdump2
	LDFLAGS="-L../libdwarf" ./configure $configureDirArgs 
	LIBRARY_PATH=$LIBRARY_PATH:%A/../libdwarf make
}

INSTALL()
{
	cd libdwarf
	make install bindir=$binDir libdir=$libDir incdir=$includeDir
	cd ../dwarfdump2
	make install mandir=$manDir 
	packageEntries devel $developDir
}
