SUMMARY="A command-line todo list manager"
DESCRIPTION="Taskwarrior is a command line task list management utility with \
a multitude of features, developed as a portable open source project with an \
active and quite vast ecosystem of tools, hooks and extensions."
HOMEPAGE="https://taskwarrior.org"
COPYRIGHT="20008-2021 Paul Beckingham
  Federico Hernandez
  Tomas Babej
  David J Patrick
  John Florian
  Cory Donnelly
  Johannes Schlatow
  Dirk Deimeke
  Wim Schuermann
  Owen Clarke
  Louis-Claude Canon
  Scott Kostyshak
  Renato Alves"
LICENSE="MIT"
REVISION="1"
srcGitRev="4fff27f4bc9f0274caaef2e124eba61300a26f69"
SOURCE_URI="https://github.com/GothenburgBitFactory/taskwarrior/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="fda110c31d3061c756987e45e8e0be4dc315a947d0622a07abdeb5f3b4d131c7"
srcGitRev_2="9a5f24e2acb38d05afb8f8e316a966dee196a42a"
SOURCE_URI_2="https://github.com/GothenburgBitFactory/libshared/archive/$srcGitRev_2.tar.gz"
CHECKSUM_SHA256_2="2abc6e862c83f12138e1d736f13f503b726587eae350dd42594c7ad83d7463bf"
SOURCE_FILENAME="task-v$portVersion-$srcGitRev.tar.gz"
SOURCE_FILENAME_2="libshared-$srcGitRev_2.tar.gz"
SOURCE_DIR="taskwarrior-$srcGitRev"
PATCHES="task-$portVersion.patchset"
PATCHES_2="task-$portVersion-source2.patchset"

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

PROVIDES="
	task$secondaryArchSuffix = $portVersion
	cmd:task = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libgnutls$secondaryArchSuffix
	lib:libuuid$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libgnutls$secondaryArchSuffix
	devel:libuuid$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:cmake
	cmd:gcc$secondaryArchSuffix
	cmd:make
	"

TEST_REQUIRES="
	cmd:python3
	"

BUILD()
{
	cp -rf $sourceDir2/libshared-$srcGitRev_2/* $sourceDir/src/libshared

	mkdir -p build && cd build
	cmake -DCMAKE_BUILD_TYPE=debug \
		-DTASK_BINDIR=$prefix/bin \
		-DTASK_DOCDIR=$docDir/ \
		-DTASK_MAN1DIR=$manDir/man1 \
		-DTASK_MAN5DIR=$manDir/man5 \
		-DTASK_RCDIR=$docDir/rc \
		-DBUILD_SHARED_LIBS=off ..
	make $jobArgs
}

INSTALL()
{
	make -C build install
}

TEST()
{
	# produces a few crashes
	# 2712 tests OK, 1 test FAILED on 32bit
	# 2713 tests OK, 0 test FAILED on 64bit
	cd build/test
	make $jobArgs && ./run_all && ./problems
}
