SUMMARY="A cross platform IDE written in C++/Qt"
DESCRIPTION="MonkeyStudio's primary goal was to be a Qt only IDE, but it \
evolved to be a way to support any kind of project. It supports Qt \
project management and embeds Designer and Assistant to form a complete, \
fast and powerful Qt-based IDE. It's based upon a flexible plugin system \
that allows extending it in a near-infinite manner.

Among MonkeyStudio's features:

- Advanced, customizable code editor, based on QScintilla.
- Syntax highlighting for more than 22 programming languages.
- Automatic detection of End Of Line mode (∕n, ∕r∕n). You can work with \
files that have Windows/Unix EOL symbols at the same time and save its \
original mode.
- Automatic detection of indentation mode. Choose your preferred mode, or \
activate automatic detection to save the original indentation of your files.
- Templates wizard allows you to create files or projects from templates, \
provided by the MkS Team, or from your own templates.
- With code restyling you can quickly fix/update the style of your code \
using embedded AStyle code beautifier.
- Automatic completion based on contents of the current file, or on .api \
files for your language/libraries if available.
- Search and replace engine allows you to search and replace text in the \
current file, or in a directory.
- Navigator shows a list of classes, methods, functions, variables... in \
the file and allows you to jump to the line in the code where the object \
is located. Navigation based on Exuberant Ctags supports 31 programming \
languages."
HOMEPAGE="https://monkeystudio.pasnox.com/"
COPYRIGHT="2005-2016 Azevedo Filipe & The Monkey Studio Team"
LICENSE="GNU GPL v2"
REVISION="11"
srcGitRev="01256a61395ae92e25d65c97b23a76212d8754a5"
SOURCE_URI="https://github.com/pasnox/monkeystudio2/archive/$srcGitRev.zip"
CHECKSUM_SHA256="ebb9cecef699c097dd12e567e8fca1d037a1fd020263fa5d5bf44b92343b5323"
SOURCE_DIR="monkeystudio2-$srcGitRev"
PATCHES="monkeystudio-$portVersion.patchset"
ADDITIONAL_FILES="monkeystudio.rdef.in"

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

PROVIDES="
	monkeystudio$secondaryArchSuffix = $portVersion
	app:MonkeyStudio$secondaryArchSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libqscintilla2_qt5$secondaryArchSuffix
	lib:libQt5Core$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libqscintilla2_qt5$secondaryArchSuffix
	devel:libqt5Core$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:g++$secondaryArchSuffix
	cmd:make
	cmd:qmake$secondaryArchSuffix >= 5
	"

BUILD()
{
	qmake -set SYSTEM_QSCINTILLA 0
	qmake -r monkeystudio.pro prefix=$appsDir/MonkeyStudio
	make $jobArgs
}

INSTALL()
{
	monkeyDir=$appsDir/MonkeyStudio
	mkdir -p $monkeyDir
	make install
	mv $monkeyDir/bin/monkeystudio $monkeyDir/bin/MonkeyStudio

	rm -rf $monkeyDir/share/{applications,doc,pixmaps}

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

	addResourcesToBinaries monkeystudio.rdef $monkeyDir/bin/MonkeyStudio
	addAppDeskbarSymlink $monkeyDir/bin/MonkeyStudio
}
