# 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
    KEYWORDS="~amd64"
    SRC_URI="https://gitlab.com/ubports/development/core/${PN}/-/archive/${PV}/${P}.tar.gz"
fi

DESCRIPTION="Suru style for QtQuick Controls 2"
HOMEPAGE="https://gitlab.com/ubports/development/core/${PN}"
LICENSE="GPL-2 LGPL-3"
SLOT="6"
RESTRICT="test mirror"

DEPEND="
    dev-qt/qtbase:6[gui]
    dev-qt/qtdeclarative:6
"

RDEPEND="
    ${DEPEND}
    dev-qt/qt5compat:6[qml]
"

BDEPEND="
    dev-build/samurai
"

PATCHES=(
    "${FILESDIR}"/0001-qt6-fix-ElevationEffect-path-in-qmldir.patch
    "${FILESDIR}"/0002-qt6-make-ApplicationWindow-and-Popup-qt-version-specific.patch
    "${FILESDIR}"/0003-qt6-move-overlay-rectangles-to-Popup.patch
    "${FILESDIR}"/0004-qt6-compile-assets-into-the-plugin.patch
)

src_configure() {
    local mycmakeargs=(
        -DQT_MAJOR_VERSION=6
    )

    lomiri_src_configure
}