# Contributor: prspkt <prspkt@protonmail.com>
# Maintainer: prspkt <prspkt@protonmail.com>
pkgname=scrcpy
pkgver=2.6.1
pkgrel=0
pkgdesc="Display and control your Android device"
url="https://github.com/Genymobile/scrcpy"
arch="all !s390x !ppc64le !loongarch64" # limited by android-tools
license="Apache-2.0"
options="!check" # no test suite
depends="android-tools"
makedepends="ffmpeg-dev mesa-dev meson sdl2-dev libusb-dev"
subpackages="$pkgname-doc
	$pkgname-bash-completion
	$pkgname-zsh-completion"
source="scrcpy-$pkgver.tar.gz::https://github.com/Genymobile/scrcpy/archive/v$pkgver.tar.gz
	https://github.com/Genymobile/scrcpy/releases/download/v$pkgver/scrcpy-server-v$pkgver"

build() {
	abuild-meson \
		-Dcompile_server=false \
		-Dprebuilt_server=/usr/share/scrcpy/scrcpy-server-v$pkgver \
		. output
	meson compile -C output
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output
	install -Dm644 "$srcdir"/scrcpy-server-v$pkgver \
		"$pkgdir"/usr/share/scrcpy/scrcpy-server
}

sha512sums="
bea16a4b38a8044c4a6cc9135f1d261194d9d6ca5cea70eff77d92e706bbfa6cdd0a394790b69bbb3b05eb87e206ee0fc40d2afc52b554cda7d15c6e78485641  scrcpy-2.6.1.tar.gz
7ae266670c84eced334af4c980e4d35f0ccf17d26d26d529ec977fd6f747c6a3086de5abaa7e1b88a71bb60648b124bf5e5969ab54f8ba05f00c940ab6424134  scrcpy-server-v2.6.1
"
