SUMMARY="Paladin is a open source integrated development environment (IDE)"
DESCRIPTION="
Paladin is an open source integrated development environment (IDE) modeled \
after BeOS' BeIDE.
"
HOMEPAGE="http://paladin.sourceforge.net"
SOURCE_URI="http://sourceforge.net/projects/paladin/files/Paladin-1.3.src.zip/download"
CHECKSUM_SHA256="5f804544f9cc489697d08eee5795b22de76961c62c3882af2cc15d095d7766f4"
REVISION="2"
LICENSE="MIT"
COPYRIGHT="2008-2010 DarkWyrm"

ARCHITECTURES="x86_gcc2 x86 x86_64"
SECONDARY_ARCHITECTURES="x86_gcc2 x86"

PROVIDES="
	paladin = $portVersion
	app:paladin = $portVersion
	paledit = $portVersion
	app:paledit = $portVersion
	symbolfinder = $portVersion
	app:symbolfinder = $portVersion
	libhekkel = $portVersion
	lib:libhekkel = $portVersion
	rez = $portVersion
	cmd:rez = $portVersion
"
REQUIRES="
	haiku
	lib:libpcre
	cmd:fastdep
	cmd:ccache
"
BUILD_REQUIRES="
	devel:libpcre
"
BUILD_PREREQUIRES="
	haiku_devel
	cmd:make
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
"

USER_SETTINGS_FILE="settings/Paladin_settings"

SOURCE_DIR="Paladin-1.3.src"

PATCHES="
	paladin-1.3.patch
	LibWindow.patch
"

BUILD()
{
	#Paladin
	cd Paladin
	./build.sh
	cd ..

	#Rez
	cd PalEdit/rez/Sources
	g++ -o rez *.cpp -I. -lbe
	cd ../../..

	#PalEdit
	cd PalEdit/Sources
	g++ -shared -fPIC -o libhekkel.so HAppResFile.cpp HButtonBar.cpp HColorControl.cpp \
		HColorPicker2.cpp HColorUtils.cpp HDialog.cpp HDialogViews.cpp HError.cpp \
		HHelpWindow.cpp HLazyObject.cpp HPreferences.cpp HStream.cpp HTabSheet.cpp \
		MAlert.cpp MTextAddOn.cpp MThread.cpp -lbe
	g++ -o PalEdit -fPIC -o PalEdit AboutWindow.cpp Benaphore.cpp CCharObject.cpp CDiff.cpp \
		CDiffWindow.cpp CDoc.cpp CDocIO.cpp CDocWindow.cpp CFilterChoiceDialog.cpp CFindDialog.cpp \
		CGoToLine.cpp CGrepBox.cpp CInfoDialog.cpp CKeyCapturer.cpp CKeyMapper.cpp CLanguageInterface.cpp \
		CLanguageAddOn.cpp CLineObject.cpp CListBox.cpp CLogin.cpp CMessageItem.cpp \
		CMimeBox.cpp COpenSelection.cpp CPathsBox.cpp CPrefsDialog.cpp CProjectFile.cpp \
		CProjectJamFile.cpp CProjectMakeFile.cpp CProjectRoster.cpp CRegex.cpp CStdErrBox.cpp \
		CStdErrParser.cpp CFontStyle.cpp MTextAddOnImpl.cpp PAddOn.cpp PApp.cpp	PCmd.cpp \
		PDoc.cpp PErrorWindow.cpp PFindFunctionDialog.cpp PGroupWindow.cpp PItalicMenuItem.cpp \
		PKeyDownFilter.cpp PLongAction.cpp PMessageWindow.cpp PProjectWindow.cpp PScrollBar.cpp \
		PSplitter.cpp PStatus.cpp PText.cpp PTextBuffer.cpp PToolBar.cpp PTypeAHeadList.cpp Sstdio.cpp \
		utf-support.cpp Utils.cpp libhekkel.so -lpcre -lbe -ltracker -lmail -ltextencoding -ltranslation \
		-lnetwork
	cd ../..

	#SymbolFinder
	cd SymbolFinder
	g++ -o SymbolFinder *.cpp -lbe -lroot
	cd ..
}

INSTALL()
{
	mkdir -p $appsDir/Paladin
	mkdir -p $libDir
	mkdir -p $binDir

	#Paladin
	cp Paladin/Paladin $appsDir/Paladin
	cp Paladin/README $appsDir/Paladin
	cp -r Templates $appsDir/Paladin
	cp -r Paladin/Licenses $appsDir/Paladin

	#Rez
	cp PalEdit/rez/Sources/rez $binDir

	#PalEdit
	cp PalEdit/Sources/PalEdit $appsDir/Paladin/PalEdit
	cp PalEdit/Sources/libhekkel.so $libDir

	#SymbolFinder
	cp SymbolFinder/SymbolFinder $appsDir/Paladin

	addAppDeskbarSymlink $appsDir/Paladin/Paladin Paladin
	addAppDeskbarSymlink $appsDir/Paladin/PalEdit PalEdit
	addAppDeskbarSymlink $appsDir/Paladin/SymbolFinder "Symbol Finder"
}
