# Copyright 1999-2026 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=" A collection of UI components that for various reasons can't be included in the main Lomiri UI toolkit."
HOMEPAGE="https://gitlab.com/ubports/development/core/${PN}"
LICENSE="GPL-3"
SLOT="0"
RESTRICT="test mirror"

DEPEND="
    dev-libs/glib
    dev-qt/qtprintsupport:5
    dev-qt/qtconcurrent:5
    lomiri-base/lomiri-ui-toolkit
    media-gfx/exiv2
"

RDEPEND="${DEPEND}"

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

PATCHES=(
    "${FILESDIR}"/002-remove-copy-files-for-qtcreator.patch
)

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

    local mycmakeargs=(
        -DENABLE_TESTS="OFF"
        -DENABLE_WERROR="OFF"
        -DENABLE_QT6="OFF"
    )

    lomiri_src_configure
}