SUMMARY="A GUI based installer for FPC and Lazarus"
DESCRIPTION="Fpcup, fpclazup and fpcupdeluxe are basically wrappers around svn/make on steroids.
They try to use the FPC/Lazarus build process as much as possible.
Fcpupdeluxe is the latest addition that adds a GUI to ease its use.

Meant to be used side by side with other FPC/Lazarus installations. It creates a separate primary \
config path directory for the new Lazarus installation, so it doesn't interfere with existing \
Lazarus installs.

It's open source software released under the LGPL with linking exception (same as FreePascal), \
and contains some open source libraries with their own license.
See source files for details. All use permitted, also commercial, but no warranties, express or \
implied."
HOMEPAGE="https://github.com/LongDirtyAnimAlf/fpcupdeluxe/"
COPYRIGHT="2014 Reinier Olislagers / DonAlfredo"
LICENSE="GNU LGPL v3
	MIT"
REVISION="1"
if [ "$targetArchitecture" = x86_gcc2 ]; then
	BINARY_ARCH=i386
	CHECKSUM_SHA256="366f23278c5365f9eaf703d127e2f0bc0af0eaa52cb475d60505545182d74d01"
else
	BINARY_ARCH=x86_64
	CHECKSUM_SHA256="c15f52b9363b1949bbf62723174d37daa5d938e10c50e9753990559239c52d41"
fi
SOURCE_URI="$HOMEPAGE/releases/download/v${portVersion/\~/}/fpcupdeluxe-$BINARY_ARCH-haiku-qt5.zip"
SOURCE_DIR="fpcupdeluxe-$BINARY_ARCH-haiku-qt5"
ADDITIONAL_FILES="fpcupdeluxe.rdef.in
	install_fpcupdeluxe.sh
	"

ARCHITECTURES="x86_64"
SECONDARY_ARCHITECTURES="x86"

POST_INSTALL_SCRIPTS="$relativePostInstallDir/install_fpcupdeluxe.sh"

PROVIDES="
	fpcupdeluxe$secondaryArchSuffix = $portVersion
	cmd:fpcupdeluxe = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libQt5pas$secondaryArchSuffix >= 1.2.9	"

INSTALL()
{
	mkdir -p $prefix/bin $postInstallDir

	cp $sourceDir/fpcupdeluxe-$BINARY_ARCH-haiku-qt5 $prefix/bin/fpcupdeluxe
	chmod +x $prefix/bin/fpcupdeluxe

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

	addResourcesToBinaries fpcupdeluxe.rdef \
		$prefix/bin/fpcupdeluxe

	cp $portDir/additional-files/install_fpcupdeluxe.sh $postInstallDir

	installDir="$(finddir B_USER_NONPACKAGED_DIRECTORY)/bin/"
	addAppDeskbarSymlink $installDir/FPCUPdeluxe 
}
