SUMMARY="A GIF image manipulator"
DESCRIPTION="Gifsicle manipulates GIF image files. Depending on command line \
options, it can merge several GIFs into a GIF animation; explode an animation \
into its component frames; change individual frames in an animation; turn \
interlacing on and off; add transparency; add delays, disposals, and looping \
to animations; add and remove comments; flip and rotate; optimize animations \
for space; change images' colormaps; and other things."
HOMEPAGE="http://www.lcdf.org/gifsicle/"
COPYRIGHT="1997-2018 Eddie Kohler"
LICENSE="GNU GPL v2"
REVISION="1"
SOURCE_URI="http://www.lcdf.org/gifsicle/gifsicle-$portVersion.tar.gz"
CHECKSUM_SHA256="92f67079732bf4c1da087e6ae0905205846e5ac777ba5caa66d12a73aa943447"

ARCHITECTURES="all"

PROVIDES="
	gifsicle = $portVersion
	cmd:gifdiff = $portVersion
	cmd:gifsicle = $portVersion
	"
REQUIRES="
	haiku
	"

BUILD_REQUIRES="
	haiku_devel
	"
BUILD_PREREQUIRES="
	cmd:awk
	cmd:gcc
	cmd:make
	cmd:perl
	cmd:sed
	"

PATCH()
{
	sed -i -e '1 s|/usr\(/bin/perl\)|\1|' test/testie
}

BUILD()
{
	runConfigure ./configure
	if [ "$effectiveTargetArchitecture" = x86_gcc2 ]; then
		# avoid undefined reference to __sync_add_and_fetch
		# from function scale_image_threaded in src/xform.c
		sed -i -e "/HAVE___SYNC_ADD_AND_FETCH/ s/1/0/" config.h
	fi
	make
}

INSTALL()
{
	make install-strip
}

TEST()
{
	make check
}
