# Template file for 'bookworm'
pkgname=bookworm
version=1.1.2
revision=7
build_style=meson
hostmakedepends="pkg-config glib-devel gettext vala"
makedepends="gtk+3-devel libgee08-devel granite-devel
 libwebkit2gtk41-devel sqlite-devel poppler-glib-devel
 libxml2-devel glib-devel"
depends="poppler unzip"
short_desc="Simple, focused eBook reader"
maintainer="Giuseppe Fierro <gspe@ae-design.ws>"
license="GPL-3.0-or-later"
homepage="https://babluboy.github.io/bookworm"
distfiles="https://github.com/babluboy/bookworm/archive/${version}.tar.gz
 https://github.com/babluboy/bookworm/commit/c7c3643760caea4bd26b1d56ed033a52f6e34124.patch>python3.patch"
checksum="6d27e55697debfa08f7cc15805413b74c94c55111cdf2d333b306228eccad824
 ac3981fc515380a8a6d34707ca404a9b8ce16174a51520f1e9f41ee54b044e4b"
skip_extraction="python3.patch"
python_version=3

post_patch() {
	# remove the binary pyc files and file that needs to be patched separately
	# also apply https://github.com/babluboy/bookworm/commit/5719d4367c2bded1c3660238465857d5d6f7f8fc
	patch -Np1 < <(sed 's,#! /usr/bin/python,#!usr/bin/env python,; /^diff --git .*\.pyc$/,/^diff --git/d; /^--- .*constants.vala.in$/q' \
		"${XBPS_SRCDISTDIR}/${pkgname}-${version}/python3.patch")
}

post_install() {
	ln -s com.github.babluboy.bookworm ${DESTDIR}/usr/bin/bookworm
}
