SUMMARY="FFmpeg and SDL2 based library for audio and video playback"
DESCRIPTION="SDL_kitchensink is a FFmpeg and SDL2 based library for audio and video playback, \
written in C99."
HOMEPAGE="https://github.com/katajakasa/SDL_kitchensink"
COPYRIGHT="Tuomas Virtanen"
LICENSE="MIT"
REVISION="1"
SOURCE_URI="https://github.com/katajakasa/SDL_kitchensink/archive/refs/tags/$portVersion.tar.gz"
CHECKSUM_SHA256="cb92976adc75523c6c1ee086e2e1f1ffd9df99b7d51b0667b68164f2063adf09"
SOURCE_FILENAME="SDL_kitchensink-$portVersion.tar.gz"
SOURCE_DIR="SDL_kitchensink-$portVersion"

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

libVersion="$portVersion"
libVersionCompat="$libVersion compat >= ${libVersion%%.*}"

PROVIDES="
	sdl_kitchensink$secondaryArchSuffix = $portVersion
	lib:libSDL_kitchensink$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libass$secondaryArchSuffix
	lib:libavcodec$secondaryArchSuffix
	lib:libavformat$secondaryArchSuffix
	lib:libavutil$secondaryArchSuffix
	lib:libSDL2_2.0$secondaryArchSuffix
	lib:libswresample$secondaryArchSuffix
	lib:libswscale$secondaryArchSuffix
	"

PROVIDES_devel="
	sdl_kitchensink${secondaryArchSuffix}_devel = $portVersion
	devel:libSDL_kitchensink$secondaryArchSuffix = $libVersionCompat
	devel:libSDL_kitchensink_static$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES_devel="
	sdl_kitchensink$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libass$secondaryArchSuffix
	devel:libavcodec$secondaryArchSuffix
	devel:libavformat$secondaryArchSuffix
	devel:libavutil$secondaryArchSuffix
	devel:libSDL2_2.0$secondaryArchSuffix
	devel:libswresample$secondaryArchSuffix
	devel:libswscale$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:cmake
	cmd:gcc$secondaryArchSuffix
	cmd:make
	"


BUILD() {
	cmake -B build -S.\
		 -DCMAKE_BUILD_TYPE=Release\
		 $cmakeDirArgs
	make -C build $jobArgs
}

INSTALL() {
	make -C build install
	
	prepareInstalledDevelLibs libSDL_kitchensink libSDL_kitchensink_static
	fixPkgconfig
	
	packageEntries devel \
		$developDir
}
