SUMMARY="A text mode interface for git"
DESCRIPTION="Tig is an ncurses-based text-mode interface for git. \
It functions mainly as a Git repository browser, but can also assist in \
staging changes for commit at chunk level and act as a pager for output from \
various Git commands."
HOMEPAGE="https://jonas.github.io/tig/"
COPYRIGHT="2006-2018 Jonas Fonseca"
LICENSE="GNU GPL v2"
REVISION="1"
SOURCE_URI="https://github.com/jonas/tig/releases/download/tig-$portVersion/tig-$portVersion.tar.gz"
CHECKSUM_SHA256="24ba2c8beae889e6002ea7ced0e29851dee57c27fde8480fb9c64d5eb8765313"

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

commandSuffix=$secondaryArchSuffix
commandBinDir=$binDir
if [ "$targetArchitecture" = x86_gcc2 ]; then
	commandSuffix=
	commandBinDir=$prefix/bin
fi

GLOBAL_WRITABLE_FILES="settings/tigrc keep-old"

PROVIDES="
	tig$secondaryArchSuffix = $portVersion
	cmd:tig$commandSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libiconv$secondaryArchSuffix
	lib:libncurses$secondaryArchSuffix
	lib:libreadline$secondaryArchSuffix
	cmd:git
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libiconv$secondaryArchSuffix
	devel:libncurses$secondaryArchSuffix
	devel:libreadline$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:asciidoc
	cmd:autoconf
	cmd:find
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

TEST_REQUIRES="
	cmd:git
	"

BUILD()
{
	autoreconf -fi -I tools
	runConfigure --omit-dirs binDir ./configure \
		--bindir=$commandBinDir
	make $jobArgs DIST_VERSION=$portVersion
}

INSTALL()
{
	make install

	# temporary solution because of xmlto deps failing
	mkdir -p $manDir/man{1,5,7}
	cp -af doc/tig.1 $manDir/man1
	cp -af doc/tigrc.5 $manDir/man5
	cp -af doc/tigmanual.7 $manDir/man7
}

TEST()
{
	make test
}
