SUMMARY="The friendly interactive shell"
DESCRIPTION="Fish is a shell geared towards interactive use. Its features are \
focused on user friendliness and discoverability. The language syntax \
is simple but incompatible with other shell languages."
HOMEPAGE="https://ridiculousfish.com/shell/"
COPYRIGHT="2005-2018 Axel Liljencrantz"
LICENSE="GNU GPL v2"
REVISION="3"
SOURCE_URI="https://github.com/fish-shell/fish-shell/releases/download/$portVersion/fish-$portVersion.tar.gz"
CHECKSUM_SHA256="e42bb19c7586356905a58578190be792df960fa81de35effb1ca5a5a981f0c5a"
PATCHES="fish-$portVersion.patchset"

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

GLOBAL_WRITABLE_FILES="
	settings/fish/config.fish keep-old
	"

PROVIDES="
	fish$secondaryArchSuffix = $portVersion
	cmd:fish$secondaryArchSuffix = $portVersion
	cmd:fish_indent$secondaryArchSuffix = $portVersion
	cmd:fish_key_reader$secondaryArchSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	cmd:gettext$secondaryArchSuffix
	cmd:python
	cmd:ul
	lib:libexecinfo$secondaryArchSuffix
	lib:libiconv$secondaryArchSuffix
	lib:libintl$secondaryArchSuffix
	lib:libncursesw$secondaryArchSuffix
	lib:libpcre2_32$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel >= r1~alpha4_pm_hrev51519-1
	devel:libexecinfo$secondaryArchSuffix
	devel:libgettextlib$secondaryArchSuffix
	devel:libiconv$secondaryArchSuffix
	devel:libncursesw$secondaryArchSuffix
	devel:libpcre2_32$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:awk
	cmd:gcc$secondaryArchSuffix
	cmd:make
	"

defineDebugInfoPackage fish$secondaryArchSuffix \
	"$binDir"/fish \
	"$binDir"/fish_indent \
	"$binDir"/fish_key_reader

BUILD()
{
	export CFLAGS="-D_BSD_SOURCE"
	export CXXFLAGS=$CFLAGS
	export LIBS="-lnetwork -lexecinfo"

	runConfigure ./configure \
		--without-included-pcre2

	make $jobArgs
}

INSTALL()
{
	make install
}

TEST()
{
	make test
}
