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

EAPI=8

LOMIRI_PACKAGING_COMMIT="5ef19197c26f81166f973a1dfd2b6215e2df9c61"
inherit lomiri

KEYWORDS="~amd64"

SRC_URI="https://releases.ayatana-indicators.org/source/${PN}/${P}.tar.gz
         https://github.com/AyatanaIndicators/${PN}/archive/refs/tags/${PV}.tar.gz -> ${P}.tar.gz
         ${LOMIRI_PACKAGING_URI}"

DESCRIPTION="Ayatana Indicator Keyboard Applet"
HOMEPAGE="https://github.com/AyatanaIndicators/${PN}"
LICENSE="GPL-3"
SLOT="0"
RESTRICT="test mirror"

DEPEND="
    dev-libs/glib
    >=gui-libs/libayatana-common-0.9.9
    sys-apps/accountsservice
    x11-libs/libX11
    x11-libs/libxkbcommon
    x11-libs/libxklavier
"
RDEPEND="${DEPEND}"

BDEPEND="
    dev-build/cmake
    dev-build/cmake-extras
"

src_configure() {
    local mycmakeargs=(
        -DENABLE_WERROR="ON"
        -DENABLE_UBUNTU_ACCOUNTSSERVICE="ON"
    )

    lomiri_src_configure
}

src_install() {
    lomiri_src_install

    # create 'service,wants' symlinks
    dosym /usr/lib/systemd/user/ayatana-indicator-keyboard.service \
        /usr/lib/systemd/user/lomiri-indicators.target.wants/ayatana-indicator-keyboard.service
    dosym /usr/lib/systemd/user/ayatana-indicator-keyboard.service \
        /usr/lib/systemd/user/ayatana-indicators.target.wants/ayatana-indicator-keyboard.service
}