# Template file for 'alacritty'
pkgname=alacritty
version=0.15.0
revision=1
build_style=cargo
make_install_args="--path alacritty"
hostmakedepends="pkg-config python3 scdoc"
makedepends="freetype-devel fontconfig-devel libxcb-devel libxkbcommon-devel"
depends="libXcursor libXrandr libXi libXxf86vm ncurses
 alacritty-terminfo-${version}_${revision} libxkbcommon-x11"
short_desc="Cross-platform, GPU-accelerated terminal emulator"
maintainer="Andrea Brancaleoni <abc@pompel.me>"
license="Apache-2.0"
homepage="https://github.com/alacritty/alacritty"
changelog="https://raw.githubusercontent.com/alacritty/alacritty/master/CHANGELOG.md"
distfiles="https://github.com/alacritty/alacritty/archive/refs/tags/v${version}.tar.gz"
checksum=aa4479c99547c0b6860760b5b704865f629ffe1f1ec374153c2cd84e53ce5412

case "$XBPS_TARGET_MACHINE" in
	ppc64*) ;;
	ppc*) broken="ftbfs: thread 'main' panicked at 'slice index starts at 4289555962 but ends at 114', /builddir/rustc-1.46.0-src/src/libstd/io/mod.rs:396:27" ;;
	# disable doctests on i686
	i686*) make_check_args="--tests" ;;
esac

post_install() {
	vcompletion extra/completions/alacritty.bash bash
	vcompletion extra/completions/alacritty.fish fish
	vcompletion extra/completions/_alacritty zsh
	vinstall extra/linux/Alacritty.desktop 644 usr/share/applications
	vinstall extra/logo/alacritty-term.svg 644 usr/share/icons/hicolor/scalable/apps Alacritty.svg

	scdoc < "extra/man/alacritty.1.scd" > "extra/man/alacritty.1.man"
	scdoc < "extra/man/alacritty.5.scd" > "extra/man/alacritty.5.man"
	scdoc < "extra/man/alacritty-msg.1.scd" > "extra/man/alacritty-msg.1.man"
	scdoc < "extra/man/alacritty-bindings.5.scd" > "extra/man/alacritty-bindings.5.man"
	vman "extra/man/alacritty.1.man" alacritty.1
	vman "extra/man/alacritty.5.man" alacritty.5
	vman "extra/man/alacritty-msg.1.man" alacritty-msg.1
	vman "extra/man/alacritty-bindings.5.man" alacritty-bindings.5

	tic -o ${DESTDIR}/usr/share/terminfo -xe alacritty,alacritty-direct extra/alacritty.info
}

alacritty-terminfo_package() {
	short_desc+=" - terminfo data"
	pkg_install() {
		vmove usr/share/terminfo
	}
}
