SUMMARY="Video editing library used by OpenShot"
DESCRIPTION="OpenShot Audio Library (libopenshot-audio) is a program that \
allows the high-quality editing and playback of audio, and is based on the \
amazing JUCE library."
HOMEPAGE="https://www.openshot.org/"
COPYRIGHT="2015 ROLI Ltd.
	2008-2021 OpenShot Studios, LLC"
LICENSE="GNU GPL v3
	GNU GPL v2
	GNU AGPL v3
	ISC"
REVISION="1"
SOURCE_URI="https://github.com/OpenShot/libopenshot-audio/archive/v$portVersion.tar.gz"
CHECKSUM_SHA256="66bedfda0d8d430598b21bc2dde6c0016a758a6c83467d0273a9d692de10baaf"
SOURCE_FILENAME="libopenshot-audio-$portVersion.tar.gz"
SOURCE_DIR="libopenshot-audio-$portVersion"
PATCHES="libopenshot_audio-$portVersion.patchset"

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

libVersion="8"

PROVIDES="
	libopenshot_audio$secondaryArchSuffix = $portVersion
	lib:libopenshot_audio$secondaryArchSuffix = $libVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libcurl$secondaryArchSuffix
	lib:libfreetype$secondaryArchSuffix
	lib:libpng16$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

PROVIDES_devel="
	libopenshot_audio${secondaryArchSuffix}_devel = $portVersion
	devel:libopenshot_audio$secondaryArchSuffix = $libVersion
	"
REQUIRES_devel="
	haiku$secondaryArchSuffix
	libopenshot_audio$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libcurl$secondaryArchSuffix
	devel:libfreetype$secondaryArchSuffix
	devel:libpng16$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:cmake
	cmd:find
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

defineDebugInfoPackage libopenshot_audio$secondaryArchSuffix \
	"$libDir/libopenshot-audio.so.$portVersion"

BUILD()
{
	export LDFLAGS="-Wl,--as-needed" # Trim unneeded links
	cmake . -DCMAKE_BUILD_TYPE=RelWithDebInfo $cmakeDirArgs
	make $jobArgs
}

INSTALL()
{
	make install

	prepareInstalledDevelLibs libopenshot-audio

	rm -rf $binDir $manDir

	# devel package
	packageEntries devel \
		$developDir

	find $prefix -type d -empty -delete
}
