SUMMARY="The Boehm-Demers-Weiser conservative garbage collector"
DESCRIPTION="The Boehm-Demers-Weiser conservative garbage collector can be \
used as a garbage collecting replacement for C malloc or C++ new. It allows \
you to allocate memory basically as you normally would, without explicitly \
deallocating memory that is no longer useful. The collector automatically \
recycles memory when it determines that it can no longer be otherwise \
accessed."
HOMEPAGE="https://www.hboehm.info/gc/"
COPYRIGHT="1988, 1989 Hans-J. Boehm, Alan J. Demers
	1991-1996 Xerox Corporation
	1996-1999 Silicon Graphics
	1998 Fergus Henderson
	1999-2011 Hewlett-Packard Development Company, L.P.
	2001 Red Hat, Inc.
	2004-2005 Andrei Polushin
	2007 Free Software Foundation, Inc.
	2008-2019 Ivan Maidanski
	2011 Ludovic Courtes
	2018 Petter A. Urkedal"
LICENSE="Boehm"
REVISION="1"
SOURCE_URI="https://github.com/ivmai/bdwgc/releases/download/v$portVersion/gc-$portVersion.tar.gz"
CHECKSUM_SHA256="3b4914abc9fa76593596773e4da671d7ed4d5390e3d46fbf2e5f155e121bea11"
SOURCE_DIR="gc-$portVersion"

ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"

libcordVersion=1.4.0
libgcVersion=1.4.4
libcordVersionCompat="$libcordVersion compat >= ${libcordVersion%%.*}"
libgcVersionCompat="$libgcVersion compat >= ${libgcVersion%%.*}"
portVersionCompat="$portVersion compat >= ${portVersion%%.*}"

PROVIDES="
	boehm_gc$secondaryArchSuffix = $portVersionCompat
	lib:libcord$secondaryArchSuffix = $libcordVersionCompat
	lib:libgc$secondaryArchSuffix = $libgcVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libatomic_ops$secondaryArchSuffix
	"

PROVIDES_devel="
	boehm_gc${secondaryArchSuffix}_devel = $portVersionCompat
	devel:libcord$secondaryArchSuffix = $libcordVersionCompat
	devel:libgc$secondaryArchSuffix = $libgcVersionCompat
	"
REQUIRES_devel="
	boehm_gc$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libatomic_ops$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	haiku${secondaryArchSuffix}_devel
	cmd:autoreconf
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

defineDebugInfoPackage boehm_gc$secondaryArchSuffix \
	"$libDir"/libcord.so.$libcordVersion \
	"$libDir"/libgc.so.$libgcVersion

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

INSTALL()
{
	make install
	rm -f "$libDir"/lib*.la
	prepareInstalledDevelLibs libgc libcord
	fixPkgconfig
	packageEntries devel $developDir
}

TEST()
{
	make check
}
