SUMMARY="Original Bitcoin client"
DESCRIPTION="BitCoin Core is the backbone of the network. It downloads and, \
by default, stores the entire history of Bitcoin transactions (which is \
currently more than 100 GBs); depending on the speed of your computer and \
network connection, the synchronization process can take anywhere from a few \
hours to a day or more."
HOMEPAGE="https://bitcoincore.org/"
COPYRIGHT="2009-2017, Bitcoin Core Developers"
LICENSE="MIT"
REVISION="2"
SOURCE_URI="https://github.com/bitcoin/bitcoin/archive/v$portVersion.tar.gz"
CHECKSUM_SHA256="98b3a98a67054123bef6714e4035e18f9250a1b6d63829258ad057906e75d8b1"
SOURCE_DIR="bitcoin-$portVersion"

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

PROVIDES="
	libbitcoinconsensus$secondaryArchSuffix = $portVersion
	app:bitcoind = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libboost_chrono$secondaryArchSuffix
	lib:libboost_filesystem$secondaryArchSuffix
	lib:libboost_program_options$secondaryArchSuffix
	lib:libboost_system$secondaryArchSuffix
	lib:libboost_thread$secondaryArchSuffix
	lib:libboost_unit_test_framework$secondaryArchSuffix
	lib:libdb$secondaryArchSuffix
	lib:libevent$secondaryArchSuffix
	lib:libexpat$secondaryArchSuffix
	lib:libminiupnpc$secondaryArchSuffix
	lib:libssl$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	lib:libzmq$secondaryArchSuffix
	"

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

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libboost_chrono$secondaryArchSuffix
	devel:libboost_filesystem$secondaryArchSuffix
	devel:libboost_program_options$secondaryArchSuffix
	devel:libboost_system$secondaryArchSuffix
	devel:libboost_thread$secondaryArchSuffix
	devel:libboost_unit_test_framework$secondaryArchSuffix
	devel:libdb$secondaryArchSuffix
	devel:libevent$secondaryArchSuffix
	devel:libexpat$secondaryArchSuffix
	devel:libssl$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	devel:libzmq$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoreconf
	cmd:g++$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	#cmd:protobuf
	cmd:which
	"

BUILD()
{
	autoreconf -vfi
	runConfigure ./configure \
		--disable-wallet \
		--without-gui \
		--disable-tests \
		--with-boost-libdir=`finddir B_SYSTEM_DIRECTORY`/$relativeDevelopLibDir \
		--with-boost=`finddir B_SYSTEM_DIRECTORY`/$relativeIncludeDir/boost
	make $jobArgs
}

INSTALL()
{
	#install -t $appsDir objects/bitcoind
	#addAppDeskbarSymlink $appsDir/bitcoind
	make install

	rm -f $libDir/*.la

	prepareInstalledDevelLib libbitcoinconsensus
	fixPkgconfig

	packageEntries devel \
		$developDir
}
