# Copyright 2026 Nadeŭka <me+oss@nadevko.cc>
# Distributed under the terms of the GNU General Public License v2
EAPI=8

PYTHON_COMPAT=( python3_{5..15} )
inherit git-r3 python-any-r1

DESCRIPTION='Linux console fonts from The ZAP Group Australia'
HOMEPAGE=https://www.zap.org.au/projects/console-fonts-zap
EGIT_REPO_URI=https://git.zap.org.au/git/console-fonts-zap.git

LICENSE=GPL-3+
SLOT=0

IUSE='doc +glyph256 +glyph512 +light +vga'
REQUIRED_USE='
	|| ( vga light )
	|| ( glyph256 glyph512 )
'

BDEPEND="
	${PYTHON_DEPS}
	doc? ( dev-python/reportlab )
"

DOCS=( README NEWS )

src_compile() {
	local targets=()

	for p in $(usev glyph256 zap-) $(usev glyph512 zap-ext-); do
		for s in $(usev vga) $(usev light); do
			for f in ${p}${s}*.psftx; do
				[[ -e ${f} ]] && targets+=( "${f%tx}" )
			done
		done
	done

	emake "${targets[@]}" $(usev doc pdfs)
}

src_install() {
	# standard installation
	insinto /usr/share/consolefonts
	doins *.psf
	docompress /usr/share/consolefonts

	# docs
	use doc && DOCS+=( *.pdf )
	einstalldocs
}