SUMMARY="A set of libraries for the C++ programming language"
DESCRIPTION="Boost is a set of libraries for the C++ programming language \
that provide support for tasks and structures such as linear algebra, \
pseudorandom number generation, multithreading, image processing, regular \
expressions, and unit testing. It contains over eighty individual libraries."
HOMEPAGE="https://www.boost.org/"
SOURCE_URI="https://dl.bintray.com/boostorg/release/$portVersion/source/boost_${portVersion//./_}.tar.bz2"
CHECKSUM_SHA256="8f32d4617390d1c2d16f26a27ab60d97807b35440d45891fa340fc2648b04406"
REVISION="3"
LICENSE="Boost v1.0"
COPYRIGHT="1998-2018 Beman Dawes, David Abrahams, Rene Rivera, et al."
SOURCE_DIR="boost_${portVersion//./_}"
PATCHES="boost-$portVersion.patchset"

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

libVersion="$portVersion compat >= 1.69.0"

PROVIDES="
	boost169$secondaryArchSuffix = $portVersion
	lib:libboost_atomic$secondaryArchSuffix = $libVersion
	lib:libboost_chrono$secondaryArchSuffix = $libVersion
	lib:libboost_container$secondaryArchSuffix = $libVersion
	lib:libboost_context$secondaryArchSuffix = $libVersion
	lib:libboost_contract$secondaryArchSuffix = $libVersion
	lib:libboost_coroutine$secondaryArchSuffix = $libVersion
	lib:libboost_date_time$secondaryArchSuffix = $libVersion
	lib:libboost_filesystem$secondaryArchSuffix = $libVersion
	lib:libboost_graph$secondaryArchSuffix = $libVersion
	lib:libboost_iostreams$secondaryArchSuffix = $libVersion
	lib:libboost_locale$secondaryArchSuffix = $libVersion
	lib:libboost_log_setup$secondaryArchSuffix = $libVersion
	lib:libboost_log$secondaryArchSuffix = $libVersion
	lib:libboost_math_c99$secondaryArchSuffix = $libVersion
	lib:libboost_math_c99f$secondaryArchSuffix = $libVersion
	lib:libboost_math_tr1$secondaryArchSuffix = $libVersion
	lib:libboost_math_tr1f$secondaryArchSuffix = $libVersion
	lib:libboost_prg_exec_monitor$secondaryArchSuffix = $libVersion
	lib:libboost_program_options$secondaryArchSuffix = $libVersion
	lib:libboost_random$secondaryArchSuffix = $libVersion
	lib:libboost_regex$secondaryArchSuffix = $libVersion
	lib:libboost_serialization$secondaryArchSuffix = $libVersion
	lib:libboost_stacktrace_basic$secondaryArchSuffix = $libVersion
	lib:libboost_stacktrace_noop$secondaryArchSuffix = $libVersion
	lib:libboost_system$secondaryArchSuffix = $libVersion
	lib:libboost_thread$secondaryArchSuffix = $libVersion
	lib:libboost_timer$secondaryArchSuffix = $libVersion
	lib:libboost_type_erasure$secondaryArchSuffix = $libVersion
	lib:libboost_unit_test_framework$secondaryArchSuffix = $libVersion
	lib:libboost_wave$secondaryArchSuffix = $libVersion
	lib:libboost_wserialization$secondaryArchSuffix = $libVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libbz2$secondaryArchSuffix
	lib:libicudata$secondaryArchSuffix >= 66
	lib:libicui18n$secondaryArchSuffix >= 66
	lib:libicuuc$secondaryArchSuffix >= 66
	lib:libz$secondaryArchSuffix
	"

# List of devel entries matching an actual library (for use in prepareInstalledDevelLibs)
# Boost also provides header-only libraries (because templates)
devel_libs="
	devel:libboost_atomic$secondaryArchSuffix = $libVersion
	devel:libboost_chrono$secondaryArchSuffix = $libVersion
	devel:libboost_container$secondaryArchSuffix = $libVersion
	devel:libboost_context$secondaryArchSuffix = $libVersion
	devel:libboost_contract$secondaryArchSuffix = $libVersion
	devel:libboost_coroutine$secondaryArchSuffix = $libVersion
	devel:libboost_date_time$secondaryArchSuffix = $libVersion
	devel:libboost_exception$secondaryArchSuffix = $libVersion
	devel:libboost_filesystem$secondaryArchSuffix = $libVersion
	devel:libboost_graph$secondaryArchSuffix = $libVersion
	devel:libboost_iostreams$secondaryArchSuffix = $libVersion
	devel:libboost_locale$secondaryArchSuffix = $libVersion
	devel:libboost_log_setup$secondaryArchSuffix = $libVersion
	devel:libboost_log$secondaryArchSuffix = $libVersion
	devel:libboost_math_c99$secondaryArchSuffix = $libVersion
	devel:libboost_math_c99f$secondaryArchSuffix = $libVersion
	devel:libboost_math_tr1$secondaryArchSuffix = $libVersion
	devel:libboost_math_tr1f$secondaryArchSuffix = $libVersion
	devel:libboost_prg_exec_monitor$secondaryArchSuffix = $libVersion
	devel:libboost_program_options$secondaryArchSuffix = $libVersion
	devel:libboost_random$secondaryArchSuffix = $libVersion
	devel:libboost_regex$secondaryArchSuffix = $libVersion
	devel:libboost_serialization$secondaryArchSuffix = $libVersion
	devel:libboost_stacktrace_basic$secondaryArchSuffix = $libVersion
	devel:libboost_stacktrace_noop$secondaryArchSuffix = $libVersion
	devel:libboost_system$secondaryArchSuffix = $libVersion
	devel:libboost_test_exec_monitor$secondaryArchSuffix = $libVersion
	devel:libboost_thread$secondaryArchSuffix = $libVersion
	devel:libboost_timer$secondaryArchSuffix = $libVersion
	devel:libboost_type_erasure$secondaryArchSuffix = $libVersion
	devel:libboost_unit_test_framework$secondaryArchSuffix = $libVersion
	devel:libboost_wave$secondaryArchSuffix = $libVersion
	devel:libboost_wserialization$secondaryArchSuffix = $libVersion
	"

PROVIDES_devel="
	boost169${secondaryArchSuffix}_devel = $portVersion
	$devel_libs
	devel:libboost_config$secondaryArchSuffix = $libVersion
	"

REQUIRES_devel="
	boost169$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel >= r1~alpha4_pm_hrev51470
	devel:libbz2$secondaryArchSuffix
	devel:libicudata$secondaryArchSuffix >= 66
	devel:libicui18n$secondaryArchSuffix >= 66
	devel:libicuuc$secondaryArchSuffix >= 66
	devel:libz$secondaryArchSuffix
	"

BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:sed
	cmd:which
	"

defineDebugInfoPackage boost169$secondaryArchSuffix \
	"$libDir"/libboost_atomic.so.$portVersion \
	"$libDir"/libboost_chrono.so.$portVersion \
	"$libDir"/libboost_container.so.$portVersion \
	"$libDir"/libboost_context.so.$portVersion \
	"$libDir"/libboost_contract.so.$portVersion \
	"$libDir"/libboost_coroutine.so.$portVersion \
	"$libDir"/libboost_date_time.so.$portVersion \
	"$libDir"/libboost_filesystem.so.$portVersion \
	"$libDir"/libboost_graph.so.$portVersion \
	"$libDir"/libboost_iostreams.so.$portVersion \
	"$libDir"/libboost_locale.so.$portVersion \
	"$libDir"/libboost_log_setup.so.$portVersion \
	"$libDir"/libboost_log.so.$portVersion \
	"$libDir"/libboost_math_c99.so.$portVersion \
	"$libDir"/libboost_math_c99f.so.$portVersion \
	"$libDir"/libboost_math_tr1.so.$portVersion \
	"$libDir"/libboost_math_tr1f.so.$portVersion \
	"$libDir"/libboost_prg_exec_monitor.so.$portVersion \
	"$libDir"/libboost_program_options.so.$portVersion \
	"$libDir"/libboost_random.so.$portVersion \
	"$libDir"/libboost_regex.so.$portVersion \
	"$libDir"/libboost_serialization.so.$portVersion \
	"$libDir"/libboost_stacktrace_basic.so.$portVersion \
	"$libDir"/libboost_stacktrace_noop.so.$portVersion \
	"$libDir"/libboost_system.so.$portVersion \
	"$libDir"/libboost_thread.so.$portVersion \
	"$libDir"/libboost_timer.so.$portVersion \
	"$libDir"/libboost_type_erasure.so.$portVersion \
	"$libDir"/libboost_unit_test_framework.so.$portVersion \
	"$libDir"/libboost_wave.so.$portVersion \
	"$libDir"/libboost_wserialization.so.$portVersion

BUILD()
{
	./bootstrap.sh \
		--prefix=$prefix \
		--exec-prefix=$binDir \
		--libdir=$libDir \
		--includedir=$includeDir

	./b2 -q $jobArgs \
		--without-mpi \
		--enable-threads=posix \
		--enable-thread-local-alloc \
		--enable-parallel-mark \
		inlining=on \
		threading=multi \
		variant=release \
		link=static,shared \
		runtime-link=shared \
		--without-python
}

INSTALL()
{
	./b2 -q $jobArgs \
		--without-mpi \
		--enable-threads=posix \
		--enable-thread-local-alloc \
		--enable-parallel-mark \
		inlining=on \
		threading=multi \
		variant=release \
		link=static,shared \
		runtime-link=shared \
		--without-python \
		install

	prepareInstalledDevelLibs `echo "$devel_libs" | sed -n \
		-e "s/devel:\(.*\)$secondaryArchSuffix =.*/\1/p"`

	packageEntries devel $developDir
}

TEST()
{
	cd status
	../bjam $jobArgs
}
