SUMMARY="Cross-platform music production software"
DESCRIPTION="LMMS is a free cross-platform alternative to commercial \
programs like FL Studio®, which allow you to produce music with your \
computer. This includes the creation of melodies and beats, the \
synthesis and mixing of sounds, and arranging of samples. You can have fun \
with your MIDI-keyboard and much more; all in a user-friendly and modern \
interface."
HOMEPAGE="http://lmms.io/"
SOURCE_URI="https://github.com/LMMS/lmms/archive/07e422c66defdde88b3a8686ae1f0e6011fe387f.tar.gz"
CHECKSUM_SHA256="4a55299cf388c06d996e152353b1898cab457597d10cbbc77ce97777ae516d29"
SOURCE_DIR="lmms-07e422c66defdde88b3a8686ae1f0e6011fe387f"
PATCHES="lmms-1.2.0.patch"
REVISION="1"
LICENSE="GNU GPL v2"
COPYRIGHT="2004-2014 Tobias Doerffel et al."

ARCHITECTURES="x86"
if [ $effectiveTargetArchitecture != x86_gcc2 ]; then
	# x86_gcc2 is fine as primary target architecture as long as we're building
	# for a different secondary architecture.
	ARCHITECTURES="$ARCHITECTURES x86_gcc2"
fi
SECONDARY_ARCHITECTURES="x86"

PROVIDES="
	lmms$secondaryArchSuffix = $portVersion
	app:lmms$secondaryArchSuffix
	"
REQUIRES="
	haiku$secondaryArchSuffix
	libqt4$secondaryArchSuffix >= 4.8
	lib:libsndfile$secondaryArchSuffix
	lib:libvorbis$secondaryArchSuffix
	lib:libogg$secondaryArchSuffix
	lib:libsdl$secondaryArchSuffix
	lib:libfluidsynth$secondaryArchSuffix
	lib:libsamplerate$secondaryArchSuffix
	lib:libfftw3f$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	libqt4${secondaryArchSuffix}_devel >= 4.8
	devel:libsndfile$secondaryArchSuffix
	devel:libvorbis$secondaryArchSuffix
	devel:libogg$secondaryArchSuffix
	devel:libsdl$secondaryArchSuffix
	devel:libfluidsynth$secondaryArchSuffix
	devel:libsamplerate$secondaryArchSuffix
	devel:libfftw3f$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:cmake
	cmd:pkg_config$secondaryArchSuffix
	cmd:g++$secondaryArchSuffix
	cmd:ninja
	"

BUILD()
{
	mkdir -p build && cd build
	cmake -DCMAKE_INSTALL_PREFIX=$appsDir/LMMS/ -Wno-dev -GNinja ..
	ninja $jobArgs
}

INSTALL()
{
	cd build
	ninja install

	rm -rf $appsDir/LMMS/share/man
	mv $appsDir/LMMS/bin/lmms $appsDir/LMMS/bin/LMMS
	addResourcesToBinaries $portDir/additional-files/LMMS.rdef \
		$appsDir/LMMS/bin/LMMS

	addAppDeskbarSymlink $appsDir/LMMS/bin/LMMS "LMMS"
}
