SUMMARY="The ultimate 256-color painting program"
DESCRIPTION="GrafX2 is a bitmap paint program inspired by the Amiga programs \
Deluxe Paint and Brilliance. Specialized in 256-color drawing, it includes a \
very large number of tools and effects that make it particularly suitable for \
pixel art, game graphics, and generally any detailed graphics painted with a \
mouse."
HOMEPAGE="http://grafx2.tk"
COPYRIGHT="1995-2001 Sunset Design
	2007-2021 GrafX2 project team"
LICENSE="GNU GPL v2"
REVISION="2"
GITREV="8e2d28b5cfd0e3220ce4c5b38be8d0f3af650c89"
SOURCE_URI="https://gitlab.com/GrafX2/grafX2/-/archive/${GITREV}/grafX2-${GITREV}.tar.bz2"
SOURCE_FILENAME="grafx2-2.8-${GITREV}.tar.gz"
SOURCE_DIR="grafX2-${GITREV}"
CHECKSUM_SHA256="21320e7d82eb3c6881dc2a4e9ae37e579eecd703d31dbb172cc881220a115dd2"
PATCHES="grafx2-$portVersion.patchset"

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

PROVIDES="
	grafx2$secondaryArchSuffix
	cmd:grafx2
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libfreetype$secondaryArchSuffix
	lib:libiconv$secondaryArchSuffix
	lib:libjpeg$secondaryArchSuffix
	lib:liblua$secondaryArchSuffix
	lib:libpng16$secondaryArchSuffix
	lib:libSDL_1.2$secondaryArchSuffix
	lib:libSDL_image_1.2$secondaryArchSuffix
	lib:libSDL_ttf_2.0$secondaryArchSuffix
	lib:libtiff$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libfreetype$secondaryArchSuffix
	devel:libiconv$secondaryArchSuffix
	devel:libjpeg$secondaryArchSuffix
	devel:liblua$secondaryArchSuffix
	devel:libpng16$secondaryArchSuffix
	devel:libSDL_1.2$secondaryArchSuffix
	devel:libSDL_image_1.2$secondaryArchSuffix
	devel:libSDL_ttf_2.0$secondaryArchSuffix
	devel:libtiff$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:git
	cmd:make
	cmd:patch
	cmd:pkg_config$secondaryArchSuffix
	cmd:tar
	cmd:which
	cmd:xz
	"

BUILD()
{
	cd src
	make $jobArgs
}

INSTALL()
{
	cd src
	mkdir -p $dataDir
	make install DESTDIR=$prefix PREFIX=/ datarootdir=/$relativeDataRootDir

	rm -rf $dataDir/{applications,icons,metainfo}

	addAppDeskbarSymlink $prefix/bin/grafx2 GrafX2
}
