SUMMARY="Fasttracker II inspired music tracker"
DESCRIPTION="MilkyTracker is an open source, multi-platform music application \
for creating .MOD and .XM module files. It attempts to recreate the module \
replay and user experience of the popular DOS program Fasttracker II, with \
special playback modes available for improved Amiga ProTracker 2/3 \
compatibility."
HOMEPAGE="http://www.milkytracker.org/"
COPYRIGHT="
	1994-2013
	Peter 'pailes' Barth,
	Christopher 'Deltafire' O'Neill,
	Antti S. Lankila,
	Varthall,
	Andrew Simper,
	David Ross,
	Stuart Caie,
	Claudio Matsuoka,
	Julian 'jua' Harnath
	"
LICENSE="GNU GPL v3
	New-BSD"
REVISION="1"
SOURCE_URI="https://github.com/milkytracker/MilkyTracker/archive/v$portVersion.tar.gz"
CHECKSUM_SHA256="72d5357e303380b52383b66b51f944a77cd77e2b3bfeb227d87cc0e72ab292f7"
SOURCE_DIR="MilkyTracker-$portVersion"
PATCHES="milkytracker-$portVersion-gcc2.patchset"
if [ $effectiveTargetArchitecture != "x86_gcc2" ]; then
	PATCHES="milkytracker-$portVersion.patchset"
fi

ARCHITECTURES="all"
SECONDARY_ARCHITECTURES="!x86" #crashes

PROVIDES="
	milkytracker$secondaryArchSuffix = $portVersion
	app:MilkyTracker = $portVersion
	app:MilkySettings = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libz$secondaryArchSuffix >= 1.2.3
	lib:libzzip_0$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libz$secondaryArchSuffix >= 1.2.3
	devel:libzzip_0$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:jam
	cmd:ld$secondaryArchSuffix
	"

BUILD()
{
	VER_X=1; VER_YY=03; VER_ZZ=00;
	echo "const int MILKYTRACKER_VERSION = 0x${VER_X}${VER_YY}${VER_ZZ};" \
		> src/tracker/version.h
	echo "const char MILKYTRACKER_VERSION_STRING[] = \"MilkyTracker ${VER_X}.${VER_YY}.${VER_ZZ}\";" \
		>> src/tracker/version.h

	pushd $sourceDir/platforms/haiku
	bash ./Add_Jamfiles.sh
	popd
	jam -q $jobArgs
}

INSTALL()
{
	TARGET_DIR=$appsDir/MilkyTracker
	mkdir -p $TARGET_DIR
	cp -af src/tracker/MilkyTracker $TARGET_DIR/
	cp -af src/tracker/haiku/MilkySettings/MilkySettings $TARGET_DIR/
	cp -af docs/ChangeLog.html $TARGET_DIR/
	cp -af docs/FAQ.html $TARGET_DIR/
	cp -af docs/MilkyTracker.html $TARGET_DIR/
	cp -af docs/TiTAN.nfo $TARGET_DIR/
	cp -af COPYING $TARGET_DIR/
	addAppDeskbarSymlink $TARGET_DIR/MilkyTracker MilkyTracker
}
