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

EAPI=8

#ISTUTILS_EXT=1
#DISTUTILS_OPTIONAL=1
#DISTUTILS_USE_PEP517=setuptools
PYTHON_COMPAT=( python3_{10..13} )
inherit autotools python-any-r1

SRC_URI="https://sourceforge.net/projects/presage/files/presage/${PV}/presage-${PV}.tar.gz"
DESCRIPTION="An intelligent predictive text entry system"
HOMEPAGE="https://presage.sourceforge.io"
KEYWORDS="~amd64"

LICENSE="GPL-3"
SLOT="0"
RESTRICT="test"

DEPEND="
    dev-db/sqlite
    dev-libs/tinyxml
    dev-python/dbus-python
"

RDEPEND="
    ${DEPEND}
    ${PYTHON_DEPS}
    "

BDEPEND="
    ${RDEPEND}
    dev-build/automake-wrapper
    dev-build/automake
"

S="${WORKDIR}/presage-${PV}"

src_prepare() {
    eapply "${FILESDIR}"/001-gcc6.patch
    eapply "${FILESDIR}"/002-gcc11.patch
    eapply "${FILESDIR}"/003-configure-fix-python-check.patch
    eapply "${FILESDIR}"/004-remove-dbus-demo.patch
    eapply "${FILESDIR}"/005-fix-python-print.patch
    eapply_user

	eautoreconf
}

src_configure() {
    local myconf=(
        --disable-documentation
    )

	econf "${myconf[@]}"

}

src_compile() {
    emake
}