SUMMARY="Customer Relations Management for Freelancers and Individual Contractors"
DESCRIPTION="The application is dead simple, with just the complexity and feature
 a high value Freelancer needs to do a brilliant job with sales and customer
 relations.
Features:
* Contact management (companies or private persons).
* Contact-person management at the companies.
* Intents (pipelines) - some mini-projects with clear defined goals that you want to achieve.
  For example , sell something to, or get the attention from, a prospect.
* Actions - Steps / tasks to perform to move an intent forward against completion.
  For example - send a follow-up mail at a specific date.
* Document management documents and mails are linked to customers, persons, intents or actions.
* Journal - a list of all the relevant things that has happened within the relation with a contact.
  This is updated automatically when you add or change information.
* Data is stored locally in a sqlite database."
COPYRIGHT="1999-2019 Jarle Aase"
HOMEPAGE="https://github.com/jgaa/f-crm"
LICENSE="GNU GPL v3"
REVISION="1"
SOURCE_URI="https://github.com/jgaa/f-crm/archive/v${portVersion/\~beta/-beta}.tar.gz"
CHECKSUM_SHA256="ac404cdcf7f5413f744a780299717790397bfc59017cbb043997d66b5af63d10"
SOURCE_FILENAME="f-crm-${portVersion/\~beta/-beta}.tar.gz"
SOURCE_DIR="f-crm-${portVersion/\~beta/-beta}"
ADDITIONAL_FILES="fcrm.rdef.in"

ARCHITECTURES="all !x86_gcc2"
if [ "$targetArchitecture" = x86_gcc2 ]; then
	SECONDARY_ARCHITECTURES="x86"
fi

PROVIDES="
	fcrm$secondaryArchSuffix = $portVersion
	app:Fcrm = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libGL$secondaryArchSuffix
	lib:libQt5Core$secondaryArchSuffix
	lib:libQt5Gui$secondaryArchSuffix
	lib:libQt5Network$secondaryArchSuffix
	lib:libQt5PrintSupport$secondaryArchSuffix
	lib:libQt5Svg$secondaryArchSuffix
	lib:libQt5Xml$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libQt5Core$secondaryArchSuffix
	devel:libQt5Gui$secondaryArchSuffix
	devel:libQt5Network$secondaryArchSuffix
	devel:libQt5PrintSupport$secondaryArchSuffix
	devel:libQt5Svg$secondaryArchSuffix
	devel:libQt5Xml$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	cmd:qmake$secondaryArchSuffix >= 5
	"

BUILD()
{
	qmake
	make $jobArgs
}

INSTALL()
{
	install -d $appsDir
	install -T ./f-crm $appsDir/F-CRM

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

	addResourcesToBinaries fcrm.rdef $appsDir/F-CRM
	addAppDeskbarSymlink $appsDir/F-CRM
}
