SUMMARY="A library for handling page faults in user mode"
DESCRIPTION="GNU libsigsegv is a library for handling page faults in user mode. \
 A page fault occurs when a program tries to access to a region of memory that \
 is currently not available. Catching and handling a page fault is a useful \
 technique for implementing:
 * Pageable virtual memory
 * Memory-mapped access to persistent databases
 * Generational garbage collectors
 * Stack overflow handlers
 * Distributed shared memory
This library supports three sets of functions, all defined in <sigsegv.h>:
 * Global SIGSEGV handlers
 * Local SIGSEGV handlers (a handler per memory area)
 * Stack overflow handlers"
HOMEPAGE="https://www.gnu.org/software/libsigsegv"
COPYRIGHT="1998-2018 Bruno Haible
	2002-2009 Paolo Bonzini
	2008-2010 Eric Blake"
LICENSE="GNU GPL v2"
REVISION="1"
SOURCE_URI="https://ftp.gnu.org/pub/gnu/libsigsegv/libsigsegv-$portVersion.tar.gz"
CHECKSUM_SHA256="be78ee4176b05f7c75ff03298d84874db90f4b6c9d5503f0da1226b3a3c48119"
SOURCE_DIR="libsigsegv-$portVersion"

ARCHITECTURES="all"
SECONDARY_ARCHITECTURES="x86"

libVersion="2.0.6"
libVersionCompat="$libVersion compat >= ${libVersion%%.*}"

PROVIDES="
	libsigsegv$secondaryArchSuffix = $portVersion
	lib:libsigsegv$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	"

PROVIDES_devel="
	libsigsegv${secondaryArchSuffix}_devel = $portVersion
	devel:libsigsegv$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES_devel="
	libsigsegv$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoconf
	cmd:autoheader
	cmd:automake
	cmd:gcc$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	"

defineDebugInfoPackage libsigsegv$secondaryArchSuffix \
	$libDir/libsigsegv.so.$libVersion

BUILD()
{
	autoreconf -vfi
	runConfigure ./configure --enable-shared
	make $jobArgs
}

INSTALL()
{
	make install

	rm $libDir/libsigsegv*.la $libDir/libsigsegv*.a

	prepareInstalledDevelLibs \
		libsigsegv

	packageEntries devel \
		$developDir
}

TEST()
{
	make check
}
