SUMMARY="Very fast, header-only/compiled, C++ logging library"
DESCRIPTION="The description is really “in a nut”:

Very fast, header only, C++ logging library.

Install: Just copy the files to your build tree and use a C++11 compiler

Features:

* Very fast – performance is the primary goal (see becnhmarks below)
* Headers only
* No dependencies
* Cross platform - Linux / Windows on 32/64 bits
* Mult/Single threaded loggers
* Rotating log files
* Daily log files
* Console logging
* Optional async logging
* Logging levels
* Custom formatting with user defined patterns"
COPYRIGHT="Gabi Melman"
HOMEPAGE="https://github.com/gabime/spdlog"
LICENSE="MIT"
REVISION="1"
SOURCE_URI="https://github.com/gabime/spdlog/archive/v$portVersion.tar.gz"
CHECKSUM_SHA256="944d0bd7c763ac721398dca2bb0f3b5ed16f67cef36810ede5061f35a543b4b8"
# Import patches from openSUSE
PATCHES="spdlog-1.8.5-fmt8_tests.patch
	spdlog-1.8.5-fmt8.patch"

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

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

PROVIDES="
	spdlog$secondaryArchSuffix = $portVersion
	lib:libspdlog$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libfmt$secondaryArchSuffix
	"

PROVIDES_devel="
	spdlog${secondaryArchSuffix}_devel = $portVersion
	devel:libspdlog$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES_devel="
	spdlog$secondaryArchSuffix == $portVersion base
	devel:libfmt$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libfmt$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:cmake
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

BUILD()
{
	cmake -B build -S . $cmakeDirArgs \
		-DSPDLOG_BUILD_BENCH=OFF \
		-DSPDLOG_BUILD_TESTS=OFF \
		-DSPDLOG_BUILD_SHARED=ON \
		-DSPDLOG_FMT_EXTERNAL=ON
	make -C build $jobArgs
}

INSTALL()
{
	make -C build install

	# prepare develop/lib
	prepareInstalledDevelLib libspdlog
	fixPkgconfig

	# devel package
	packageEntries devel \
		$developDir \
		$libDir/cmake
}

TEST()
{
	# enable tests in BUILD()
	make -C build test
}
