# Copyright 1999-2026 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # Build a Lomiri package for Qt5 AND Qt6 in parallel from one source tree, via # the multibuild eclass. Use when upstream provides an ENABLE_QT6 switch (the # same source builds either Qt version). Reference ebuilds: # - lomiri-base/gsettings-qt (builds a QML plugin -> needs qmlplugindump) # - lomiri-base/lomiri-download-manager (no QML plugin; Qt6 adds dev-qt/qtscxml:6) # - lomiri-base/lomiri-content-hub (consumes other packages as [qt5]/[qt6]) # # Do NOT use multibuild_copy_sources: the cmake eclass builds out-of-source and # multibuild_foreach_variant gives each variant its own BUILD_DIR (${S}-qt5 / # ${S}-qt6) -- two out-of-source builds from one tree. An in-source build (which # copy_sources produces) breaks cmake-extras' qmldir copy ("copy file onto itself"). # # Parallel install only works if upstream names the Qt6 artifacts distinctly # (lib/.pc suffix, usually QT_SUFFIX="-qt6", and QML/includes under qt${MAJOR}/...). # Verify with `qlist`/the install image before trusting it. EAPI=8 inherit lomiri multibuild qmake-utils ######## core #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" # # only if the release tarball extracts to a non-default dir (git-r3 uses ${P}): # #S="${WORKDIR}/${PN}-v${PV}" #fi ######## lib-cpp #if [[ ${PV} == 9999 ]]; then # KEYWORDS="" # EGIT_REPO_URI="https://gitlab.com/ubports/development/core/lib-cpp/${PN}.git" # inherit git-r3 #else # KEYWORDS="~amd64" # SRC_URI="https://gitlab.com/ubports/development/core/lib-cpp/${PN}/-/archive/${PV}/${P}.tar.gz" #fi DESCRIPTION="" HOMEPAGE="https://gitlab.com/ubports/development/core/${PN}" LICENSE="GPL-3" SLOT="0" RESTRICT="test mirror" IUSE="+qt5 +qt6" REQUIRED_USE="|| ( qt5 qt6 )" # Qt-version-specific deps go under qt5?()/qt6?(). For Lomiri packages this one # consumes, propagate the variant with a USE-dep, e.g. lomiri-base/foo[qt6]. # Verify the real dep set against find_package/pkg_check_modules + debian/control, # not the old ebuild (stale/phantom deps are common). COMMON_DEPEND=" dev-libs/glib qt5? ( dev-qt/qtcore:5 dev-qt/qtdeclarative:5 ) qt6? ( dev-qt/qtbase:6 dev-qt/qtdeclarative:6 ) " DEPEND="${COMMON_DEPEND}" RDEPEND="${COMMON_DEPEND}" BDEPEND=" dev-build/cmake dev-build/cmake-extras dev-build/samurai " #PATCHES=( # "${FILESDIR}"/ #) # src_prepare runs ONCE on the shared source (builds are out-of-source), so keep # it single -- do not wrap it in multibuild. #src_prepare() { # sed -i '/include(CTest)/d' CMakeLists.txt || die # lomiri_src_prepare #} _set_multibuild_variants() { MULTIBUILD_VARIANTS=() use qt5 && MULTIBUILD_VARIANTS+=( qt5 ) use qt6 && MULTIBUILD_VARIANTS+=( qt6 ) } src_configure() { local MULTIBUILD_VARIANTS _set_multibuild_variants my_configure() { local mycmakeargs=( -DENABLE_TESTS="OFF" ) # qmlplugindump (only if the package builds a QML plugin) is found via # PATH; Gentoo installs it under /usr/lib64/qt{5,6}/bin, which upstream's # hardcoded hint misses. Harmless to set even without a QML plugin. if [[ ${MULTIBUILD_VARIANT} == qt6 ]]; then local -x PATH="$(qt6_get_bindir):${PATH}" mycmakeargs+=( -DENABLE_QT6="ON" ) else local -x PATH="$(qt5_get_bindir):${PATH}" mycmakeargs+=( -DENABLE_QT6="OFF" ) fi cmake_src_configure } multibuild_foreach_variant my_configure } src_compile() { local MULTIBUILD_VARIANTS _set_multibuild_variants multibuild_foreach_variant cmake_src_compile } src_install() { local MULTIBUILD_VARIANTS _set_multibuild_variants multibuild_foreach_variant cmake_src_install }