# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit autotools desktop git-r3 xdg

DESCRIPTION="Man Page Editor"
HOMEPAGE="https://github.com/KeithDHedger/ManPageEditor"
EGIT_REPO_URI="https://github.com/KeithDHedger/ManPageEditor.git"

LICENSE="GPL-3"
SLOT="0"
IUSE="spell"

# Runtime subprocesses require man, gzip, and groff. Keep ps2pdf and lp optional
# because only PDF-export and print actions use them. verified 2026-07-27
RDEPEND="
	app-arch/gzip
	sys-apps/groff
	virtual/man
	x11-libs/gtk+:3
	x11-libs/gtksourceview:3.0
	x11-misc/xdg-utils
	spell? ( app-text/aspell )
"
DEPEND="${RDEPEND}"

src_prepare() {
	default
	eautoreconf
}

src_configure() {
	econf \
		--enable-gtk3 \
		$(use_enable spell aspell)
}

src_install() {
	emake DESTDIR="${D}" install
	doicon --size 256 ManPageEditor/resources/documenticons/256/maneditdoc.png
	doicon --size 128 ManPageEditor/resources/documenticons/128/maneditdoc.png
	doicon --size 48 ManPageEditor/resources/documenticons/48/maneditdoc.png
}