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

EAPI=8

inherit lomiri

if [[ ${PV} == 9999 ]]; then
    KEYWORDS=""
    EGIT_REPO_URI="https://gitlab.com/ubports/development/core/${PN}.git"
    inherit git-r3
else
    COMMIT="89b9f0974c85a3b63b731814a80d5616de4dd246"
    KEYWORDS="~amd64"
    SRC_URI="https://gitlab.com/ubports/development/core/${PN}/-/archive/${COMMIT}/${PN}-${COMMIT}.tar.gz -> ${P}.tar.gz"
    S="${WORKDIR}/${PN}-${COMMIT}"
fi

DESCRIPTION="Lomiri backend for xdg-desktop-portal"
HOMEPAGE="https://gitlab.com/ubports/development/core/${PN}"
LICENSE="GPL-3+"
SLOT="0"
RESTRICT="test mirror"

DEPEND="
    dev-qt/qtbase:6[dbus,gui]
"
RDEPEND="
    ${DEPEND}
    sys-apps/xdg-desktop-portal
"
BDEPEND="
    app-text/xmlstarlet
    dev-build/samurai
    sys-apps/xdg-desktop-portal
    virtual/pkgconfig
"

PATCHES=(
    "${FILESDIR}"/0001-locate-portal-interfaces-and-xmlstarlet-properly.patch
)