SUMMARY="Free reimplementation of Impulse Tracker"
DESCRIPTION="Schism Tracker is a free reimplementation of Impulse Tracker, a \
program used to create high quality music without the requirements of \
specialized, expensive equipment, and with a unique \"finger feel\" that is \
difficult to replicate in part. The player is based on a highly modified \
version of the Modplug engine, with a number of bugfixes and changes to \
improve IT playback.

Where Impulse Tracker was limited to i386-based systems running MS-DOS, Schism \
Tracker runs on almost any platform that SDL supports, and has been \
successfully built for Linux, Mac OS X, Windows, FreeBSD, AmigaOS, BeOS, and \
even the Wii. Most development is currently done on 64-bit Linux. Schism will \
most likely build on any architecture supported by GCC4 (e.g. alpha, m68k, \
arm, etc.) but it will probably not be as well-optimized on many systems."
HOMEPAGE="http://schismtracker.org/"
COPYRIGHT="2003-2019 Storlek Mrs. Brisby et al"
LICENSE="GNU GPL v2"
REVISION="1"
SOURCE_URI="https://github.com/schismtracker/schismtracker/archive/$portVersion.tar.gz"
CHECKSUM_SHA256="255a07cdcf4df818095c290be5cc7e291a09581d5ce2cb7088b45285f74ede3d"
PATCHES="schismtracker-$portVersion.patchset"
ADDITIONAL_FILES="schismtracker.rdef.in"

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

PROVIDES="
	schismtracker$secondaryArchSuffix = $portVersion
	cmd:schismtracker$secondaryArchSuffix
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libsdl$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libsdl$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:autoconf
	cmd:automake
	cmd:awk
	cmd:find
	cmd:gcc$secondaryArchSuffix
	cmd:make
	cmd:python3.7
	"

BUILD()
{
	autoreconf -vfi
	runConfigure ./configure
	make $jobArgs
}

INSTALL()
{
	make install

	# we are not linux
	rm -rf $dataDir/{applications,pixmaps}

	local APP_SIGNATURE="application/x-vnd.schismtracker"
	local MAJOR="`echo "$portVersion" | cut -d. -f1`"
	local LONG_INFO="$SUMMARY"
	sed \
		-e "s|@APP_SIGNATURE@|$APP_SIGNATURE|" \
		-e "s|@MAJOR@|$MAJOR|" \
		-e "s|@LONG_INFO@|$LONG_INFO|" \
		$portDir/additional-files/schismtracker.rdef.in > schismtracker.rdef
	addResourcesToBinaries schismtracker.rdef $binDir/schismtracker

	addAppDeskbarSymlink "$binDir"/schismtracker SchismTracker
}
