SUMMARY="Utility to apply diffs to files"
DESCRIPTION="Patch takes a patch file containing a difference listing produced \
by the diff program and applies those differences to one or more original \
files, producing patched versions."
HOMEPAGE="https://savannah.gnu.org/projects/patch/"
COPYRIGHT="2012-2018 Free Software Foundation, Inc."
LICENSE="GNU GPL v3"
REVISION="2"
SOURCE_URI="https://ftpmirror.gnu.org/patch/patch-$portVersion.tar.xz
	https://ftp.gnu.org/gnu/patch/patch-$portVersion.tar.xz"
CHECKSUM_SHA256="ac610bda97abe0d9f6b7c963255a11dcb196c25e337c61f94e4778d632f1d8fd"
PATCHES="patch-$portVersion.patchset"

ARCHITECTURES="all !x86_gcc2"
if [ "$targetArchitecture" = x86_gcc2 ]; then
SECONDARY_ARCHITECTURES="x86"
fi

PROVIDES="
	patch$secondaryArchSuffix = $portVersion
	cmd:patch = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	"
if [ -n "$secondaryArchSuffix" ]; then
CONFLICTS="
	patch
	"
REPLACES="
	patch
	"
fi

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	"
BUILD_PREREQUIRES="
	cmd:awk
	cmd:gcc$secondaryArchSuffix
	cmd:make
	"

TEST_REQUIRES="
	cmd:diff
	cmd:git
	"

BUILD()
{
	runConfigure --omit-dirs binDir ./configure --bindir="$prefix"/bin
	make
}

INSTALL()
{
	make install
	rm "$libDir"/charset.alias
}

TEST()
{
	make check
}
