• [gentoo-dev] RFC: ecm-common.eclass: New eclass for easy outsourcing of

    From Andreas Sturmlechner@21:1/5 to All on Mon Aug 12 22:09:23 2024
    ECM = extra-cmake-modules, used basically everywhere in kde.org

    What does it do?
    - Work with KF5 or KF6 in the background, so BDEPENDs are defined as :*
    - Create a very simple root CMakeLists.txt in place of upstream's
    - KDE projects are *very* standardised, so a few lines of CMake will
    already provide us with translations, docs, translated docs for 95%
    of packages.
    - On top of that, ebuild consumers can define icons and files to install
    - ... or inject their own Heredoc when ecm-common.eclass is not enough

    What's the goal?
    - Easily create ${PN}-common packages for other split ${PN} to depend upon
    - Be able to depend on ${PN}-common:0 packages from e.g. both SLOT 5 and 6
    - ... cause less friction with not having to set compatibility USE flags
    and dropping many blockers

    When thought through to the end, it would enable us move *all* docs
    (currently USE=handbook in KDE packages) and translations into separate packages.


    Ongoing development and model revdep usage in: https://github.com/gentoo/kde/pull/999


    --- /dev/null
    +++ b/eclass/ecm-common.eclass
    @@ -0,0 +1,188 @@
    +# Copyright 2024 Gentoo Authors
    +# Distributed under the terms of the GNU General Public License v2
    +
    +# @ECLASS: ecm-common.eclass
    +# @MAINTAINER:
    +# kde@gentoo.org
    +# @SUPPORTED_EAPIS: 8
    +# @PROVIDES: cmake
    +# @BLURB: Standalone CMake calling std. ECM macros to install common files only.
    +# @DESCRIPTION:
    +# This eclass is used for installing common files of packages using ECM macros,
    +# most of the time translations, but optionally also icons and kcfg files. This
    +# is mainly useful for packages split from a single upstream tarball, or for +# collision handling of slotted package versions, which need to share a
    common
    +# files package.
    +# Conventionally we will use ${PN}-common for these split packages.
    +
    +case ${EAPI} in
    + 8) ;;
    + *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
    +esac
    +
    +if [[ -z ${_ECM_COMMON_ECLASS} ]]; then
    +_ECM_COMMON_ECLASS=1
    +
    +inherit cmake
    +
    +# @ECLASS_VARIABLE: ECM_I1