SUMMARY="A library implementing getblocktemplate"
DESCRIPTION="libblkmaker provides an implementation of getblocktemplate, the \
current Bitcoin mining protocol."
HOMEPAGE="https://github.com/bitcoin/libblkmaker"
COPYRIGHT="2014-2017 Luke Dashjr"
LICENSE="MIT"
REVISION="1"
SOURCE_URI="https://github.com/bitcoin/libblkmaker/archive/v$portVersion.tar.gz"
CHECKSUM_SHA256="549193640d4cc7022725754833d9d8a7639c41e1a7d2c5f2588be65857cc0970"

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

libVersion="6.1.0"
libVersionCompat="$libVersion compat >= 6"

PROVIDES="
	libblkmaker$secondaryArchSuffix = $portVersion
	lib:libblkmaker_0.1$secondaryArchSuffix = $libVersionCompat
	lib:libblkmaker_jansson_0.1$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libbase58$secondaryArchSuffix
	lib:libjansson$secondaryArchSuffix
	"

PROVIDES_devel="
	libblkmaker${secondaryArchSuffix}_devel = $portVersion
	devel:libblkmaker_0.1$secondaryArchSuffix = $libVersion
	devel:libblkmaker_jansson_0.1$secondaryArchSuffix = $libVersion
	"
REQUIRES_devel="
	libblkmaker$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libbase58$secondaryArchSuffix
	devel:libjansson$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoreconf
	cmd:gcc$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

BUILD()
{
	./autogen.sh
	runConfigure ./configure libbase58_LIBS="-lbase58"
	make $jobArgs
}

INSTALL()
{
	make install
	rm -f $libDir/libblkmaker*.la
	prepareInstalledDevelLibs libblkmaker-0.1 libblkmaker_jansson-0.1
	#mv $includeDir/libblkmaker-0.1/* $includeDir/
	#rmdir $includeDir/libblkmaker-0.1
	fixPkgconfig
	packageEntries devel \
		$developDir
}

TEST()
{
	# Test suite is present but currently has no tests.
	make check
}
