# Maintainer: Kyle Keen <keenerd@gmail.com>
# Contributor: Maarten Baert

pkgname=simplescreenrecorder
pkgver=0.4.4
pkgrel=6
pkgdesc="A feature-rich screen recorder that supports X11 and OpenGL."
arch=("x86_64")
url="https://www.maartenbaert.be/${pkgname}"
license=("GPL-3.0-or-later")
depends=("qt5-base" "qt5-x11extras"
	"ffmpeg" "alsa-lib" "libpulse" "jack" "libgl" "glu"
	"libx11" "libxext" "libxfixes" "libxi" "libxinerama"
	"desktop-file-utils" "gtk-update-icon-cache")
optdepends=("lib32-simplescreenrecorder: OpenGL recording of 32-bit applications")
makedepends=("cmake" "qt5-tools")
source=("${pkgname}-${pkgver}.tar.gz::https://github.com/MaartenBaert/ssr/archive/refs/tags/${pkgver}.tar.gz"
	"ffmpeg7.patch::https://patch-diff.githubusercontent.com/raw/MaartenBaert/ssr/pull/1036.patch")
sha256sums=('69fccf8df6e7285d4df5033eed8748f4eae13b407488906dcf4810a277d557b8'
            'a1d4a2c1d5cfcf6a327cc98e47e6cd76dd2fd03b33ca9e7fcaba971570fae914')

prepare() {
	patch -d "ssr-${pkgver}" -p1 -i ../ffmpeg7.patch # Fix build with ffmpeg 7
}

build() {
	cmake -B build \
		-S "ssr-${pkgver}" \
		-D CMAKE_INSTALL_PREFIX=/usr \
		-D CMAKE_BUILD_TYPE=Release \
		-D CMAKE_POLICY_VERSION_MINIMUM=3.5 \
		-D WITH_QT5=on

	cmake --build build
}

package() {
	DESTDIR="${pkgdir}" cmake --install build
}
