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

EAPI=8

inherit qmake-utils lomiri

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

DESCRIPTION="Lomiri settings Components"
HOMEPAGE="https://gitlab.com/ubports/development/core/${PN}"
LICENSE="GPL-3"
SLOT="0"
RESTRICT="test mirror"

DEPEND="
    dev-libs/glib
"
RDEPEND="${DEPEND}"

BDEPEND="
    dev-build/cmake
    dev-build/cmake-extras
    dev-build/samurai
    dev-qt/qtdeclarative:5
"

src_prepare() {
    # remove hard coded enabling of tests
    sed -i "/enable_testing()/d" CMakeLists.txt  || die
    cmake_comment_add_subdirectory tests

    # disable build of examples
    cmake_comment_add_subdirectory examples

    lomiri_src_prepare
}


src_configure() {
    # add 'qmlplugindump' to PATH
    export PATH="$(qt5_get_bindir):${PATH}"

    lomiri_src_configure
}