SUMMARY="Configurable speaking/thinking cow (and a bit more)"
DESCRIPTION="Configurable talking ASCII cow and other characters. \
Invoking it as cowthink will make it think instead of speak."
HOMEPAGE="https://github.com/tnalpgge/rank-amateur-cowsay"
COPYRIGHT="1999-2000 Tony Monroe"
LICENSE="GNU GPL v3"
REVISION="1"
SOURCE_URI="$HOMEPAGE/archive/cowsay-$portVersion.tar.gz"
CHECKSUM_SHA256="d8b871332cfc1f0b6c16832ecca413ca0ac14d58626491a6733829e3d655878b"
SOURCE_DIR="rank-amateur-cowsay-cowsay-$portVersion"

ARCHITECTURES="any"

PROVIDES="
	$portName = $portVersion
	cmd:cowsay
	cmd:cowthink
	"
REQUIRES="
	haiku
	perl
	"

INSTALL()
{
	mkdir -p $binDir $manDir/man1 $dataDir $docDir
	cp cowsay $binDir
	ln -s cowsay $binDir/cowthink
	sed -i \
		-e 's|%BANGPERL%|!/usr/bin/env perl|' \
		-e "s|%PREFIX%/share/cows|$dataDir/cows|" \
		"$binDir"/cowsay

	cp cowsay.1 $manDir/man1
	ln -s cowsay.1 $manDir/man1/cowthink.1
	cowsDir="`finddir B_SYSTEM_DATA_DIRECTORY`/cows"
	sed -i -e "s|[^[:space:]]*/share/cows|$cowsDir|" "$manDir"/man1/cowsay.1

	cp -r cows $dataDir
	rm $dataDir/cows/mech-and-cow

	cp CONTRIBUTING.md ChangeLog README* $docDir
}
