SUMMARY="A free, open source, cross-platform video editor"
DESCRIPTION="Major features include support for a wide range of formats."
HOMEPAGE="https://shotcut.org/"
COPYRIGHT="2011-2019 by Meltytech, LLC."
LICENSE="GNU GPL v3"
REVISION="1"
SOURCE_URI="https://github.com/mltframework/shotcut/archive/v$portVersion.tar.gz"
CHECKSUM_SHA256="e07a9f55d0d0c7f4795c34a56ad9e5f4ecb6317f29f477838eb83f1d790e2637"
SOURCE_DIR="shotcut-$portVersion"
PATCHES="shotcut-$portVersion.patchset"

ARCHITECTURES="?all"
SECONDARY_ARCHITECTURES="?x86"

PROVIDES="
	shotcut$secondaryArchSuffix = $portVersion
 	app:shotcut
	"
REQUIRES="
	haiku$secondaryArchSuffix
	cmd:ffmpeg
	cmd:melt
	frei0r$secondaryArchSuffix
	ladspa_sdk$secondaryArchSuffix
	lib:libGL$secondaryArchSuffix
	lib:libmlt++$secondaryArchSuffix
	lib:libmlt$secondaryArchSuffix
	lib:libQt5$secondaryArchSuffix
	lib:libQt5Core$secondaryArchSuffix
	lib:libQt5Designer$secondaryArchSuffix
	lib:libQt5Gui$secondaryArchSuffix
	lib:libQt5Network$secondaryArchSuffix
	lib:libQt5Quick$secondaryArchSuffix
	lib:libQt5Sql$secondaryArchSuffix
	lib:libQt5Test$secondaryArchSuffix
	lib:libQt5WebKitWidgets$secondaryArchSuffix
	lib:libQt5Xml$secondaryArchSuffix
	lib:libsdl2_2.0$secondaryArchSuffix
	lib:libsqlite3$secondaryArchSuffix
	lib:libwebm$secondaryArchSuffix
	lib:libx264$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	frei0r${secondaryArchSuffix}_devel
	ladspa_sdk${secondaryArchSuffix}_devel
	devel:libGL$secondaryArchSuffix
	devel:libmlt++$secondaryArchSuffix
	devel:libmlt$secondaryArchSuffix
	devel:libQt5$secondaryArchSuffix
	devel:libQt5Core$secondaryArchSuffix
	devel:libQt5Designer$secondaryArchSuffix
	devel:libQt5Gui$secondaryArchSuffix
	devel:libQt5Network$secondaryArchSuffix
	devel:libQt5Quick$secondaryArchSuffix
	devel:libQt5Sql$secondaryArchSuffix
	devel:libQt5Test$secondaryArchSuffix
	devel:libQt5WebKitWidgets$secondaryArchSuffix
	devel:libQt5Xml$secondaryArchSuffix
	devel:libwebm$secondaryArchSuffix
	devel:libx264$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:getconf
	cmd:lrelease$secondaryArchSuffix >= 5
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	cmd:qmake$secondaryArchSuffix >= 5
	"

BUILD()
{
	qmake PREFIX=$prefix SHOTCUT_VERSION=HAIKU-$portVersion \
		DEFINES+=SHOTCUT_NOUPGRADE
	make $jobArgs
}

INSTALL()
{
	make install

	mkdir -p $appsDir $dataDir $manDir
	mv $prefix/share/man/man1 $manDir
	mv $prefix/share/metainfo $dataDir
	mv $prefix/share/mime/packages $dataDir
	mv $prefix/share/shotcut $dataDir
	rm -rf $prefix/share

	mv $prefix/bin/shotcut $appsDir/Shotcut
	addAppDeskbarSymlink $appsDir/Shotcut
}
