# Template file for 'qutebrowser'
pkgname=qutebrowser
version=1.14.0
revision=1
build_style=python3-module
hostmakedepends="python3-setuptools asciidoc"
depends="python3-PyQt5-quick python3-Jinja2 python3-Pygments python3-pyPEG2
 python3-yaml python3-attrs python3-PyQt5-opengl python3-PyQt5-sql
 qt5-plugin-sqlite python3-PyQt5-webkit"
short_desc="Keyboard-focused browser with a minimal GUI"
maintainer="Érico Nogueira <ericonr@disroot.org>"
license="GPL-3.0-or-later"
homepage="https://qutebrowser.org/"
changelog="https://raw.githubusercontent.com/qutebrowser/qutebrowser/master/doc/changelog.asciidoc"
distfiles="https://github.com/qutebrowser/qutebrowser/releases/download/v${version}/qutebrowser-${version}.tar.gz"
checksum=76eb14097bab873ffae73bb4d017b4d22aa5c4604d45f0b9570dfaed4720374a
nostrip=yes

# Liberation: Removed webengine related code

# Liberation
# Some code has been taken and modified from:
# https://git.parabola.nu/abslibre.git/tree/libre/qutebrowser/PKGBUILD
post_patch() {
	# Show warning related to webkit being old and it may contain vulnerabilities
	cp "$FILESDIR"/warning-webkit.html qutebrowser/html/

	# make sure webkit is the default backend
	sed -i 's/webengine/webkit/' qutebrowser/config/configdata.yml
}

pre_build() {
	a2x -f manpage doc/qutebrowser.1.asciidoc
}

post_install() {
	vman doc/qutebrowser.1
	vinstall misc/org.qutebrowser.qutebrowser.desktop 644 usr/share/applications

	vmkdir usr/share/qutebrowser
	vcopy misc/userscripts usr/share/qutebrowser
	vcopy scripts usr/share/qutebrowser

	local dim
	for dim in 16 24 32 48 64 96 128 256 512; do
		vinstall icons/qutebrowser-${dim}x${dim}.png 644 \
			usr/share/icons/hicolor/${dim}x${dim}/apps qutebrowser.png
	done

	vinstall icons/qutebrowser.svg 644 \
		usr/share/icons/hicolor/scalable/apps qutebrowser.svg
}
