summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
Diffstat (limited to 'eclass')
-rw-r--r--eclass/Manifest.gzbin39700 -> 39859 bytes
-rw-r--r--eclass/ecm-common.eclass376
-rw-r--r--eclass/ecm.eclass55
-rw-r--r--eclass/gear.kde.org.eclass3
4 files changed, 422 insertions, 12 deletions
diff --git a/eclass/Manifest.gz b/eclass/Manifest.gz
index 88ec2a265e09..4697eb3abff1 100644
--- a/eclass/Manifest.gz
+++ b/eclass/Manifest.gz
Binary files differ
diff --git a/eclass/ecm-common.eclass b/eclass/ecm-common.eclass
new file mode 100644
index 000000000000..460d702dea1f
--- /dev/null
+++ b/eclass/ecm-common.eclass
@@ -0,0 +1,376 @@
+# 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: KFMIN
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Minimum version of Frameworks to require. Default value for kde-frameworks
+# is ${PV} and 6.0.0 baseline for everything else.
+# If set to <5.240, it is assumed dependencies are fulfilled by KF5/Qt5
+# alternatively, thus a block of SLOT=5 shadow dependencies added.
+if [[ ${CATEGORY} = kde-frameworks ]]; then
+ : "${KFMIN:=$(ver_cut 1-2)}"
+fi
+: "${KFMIN:=6.0.0}"
+
+# @ECLASS_VARIABLE: _KFSLOT
+# @INTERNAL
+# @DESCRIPTION:
+# KDE Frameworks main slot dependency for consistently finding all KF5 or KF6
+# in CMakeLists.txt. Consistency over installed KF packages is established via
+# BDEPEND, then detected in pkg_setup().
+# Is passed as -DQT_MAJOR_VERSION=${_KFSLOT} in src_configure() too.
+_KFSLOT=6
+
+# @ECLASS_VARIABLE: KF5_BDEPEND
+# @PRE_INHERIT
+# @DESCRIPTION:
+# Dynamic KF5 dependency list.
+if [[ ${KF5_BDEPEND} ]]; then
+ [[ ${KF5_BDEPEND@a} == *a* ]] ||
+ die "KF5_BDEPEND must be an array"
+else
+ KF5_BDEPEND=( )
+fi
+
+# @ECLASS_VARIABLE: KF6_BDEPEND
+# @PRE_INHERIT
+# @DESCRIPTION:
+# Dynamic KF6 dependency list.
+if [[ ${KF6_BDEPEND} ]]; then
+ [[ ${KF6_BDEPEND@a} == *a* ]] ||
+ die "KF6_BDEPEND must be an array"
+else
+ KF6_BDEPEND=( )
+fi
+
+# @ECLASS_VARIABLE: ECM_I18N
+# @PRE_INHERIT
+# @DESCRIPTION:
+# Will accept "true" (default) or "false". If set to "false", do nothing.
+# Otherwise, add kde-frameworks/ki18n:* to BDEPEND, find KF[56]I18n and let
+# ki18n_install(po) generate and install translations.
+: "${ECM_I18N:=true}"
+
+# @ECLASS_VARIABLE: ECM_HANDBOOK
+# @PRE_INHERIT
+# @DESCRIPTION:
+# Will accept "true" or "false" (default). If set to "false", do nothing.
+# Otherwise, add "+handbook" to IUSE, add kde-frameworks/kdoctools:* to BDEPEND
+# find KF[56]DocTools in CMake, call add_subdirectory(ECM_HANDBOOK_DIRS)
+# and let let kdoctools_install(po) generate and install translated docbook
+# files.
+: "${ECM_HANDBOOK:=false}"
+
+# @ECLASS_VARIABLE: ECM_HANDBOOK_DIRS
+# @PRE_INHERIT
+# @DESCRIPTION:
+# Default is "doc" which is correct for the vast majority of packages. Specifies
+# one or more directories containing untranslated docbook file(s) relative to
+# ${S} to be added via add_subdirectory.
+if [[ ${ECM_HANDBOOK_DIRS} ]]; then
+ [[ ${ECM_HANDBOOK_DIRS@a} == *a* ]] ||
+ die "ECM_HANDBOOK_DIRS must be an array"
+else
+ ECM_HANDBOOK_DIRS=( doc )
+fi
+
+# @ECLASS_VARIABLE: ECM_INSTALL_FILES
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Array of <file>:<destination_path> tuples to install by CMake via
+# install(FILES <file> DESTINATION <destination_path>)
+if [[ ${ECM_INSTALL_FILES} ]]; then
+ [[ ${ECM_INSTALL_FILES@a} == *a* ]] ||
+ die "ECM_INSTALL_FILES must be an array"
+fi
+
+# @ECLASS_VARIABLE: ECM_INSTALL_ICONS
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Array of <icon>:<icon_install_dir> tuples to feed to ECMInstallIcons
+# via ecm_install_icons(ICONS <icon> DESTINATION <icon_install_dir)
+if [[ ${ECM_INSTALL_ICONS} ]]; then
+ [[ ${ECM_INSTALL_ICONS@a} == *a* ]] ||
+ die "ECM_INSTALL_ICONS must be an array"
+fi
+
+# @ECLASS_VARIABLE: ECM_KCM_TARGETS
+# @DEFAULT_UNSET
+# @PRE_INHERIT
+# @DESCRIPTION:
+# Array of <target>:<subdir> tuples to feed to ECMInstallIcons via
+# ecmcommon_generate_desktop_file(<target> <subdir>), which is this
+# eclass adaptation of kcmutils_generate_desktop_file.
+if [[ ${ECM_KCM_TARGETS} ]]; then
+ [[ ${ECM_KCM_TARGETS@a} == *a* ]] ||
+ die "ECM_KCM_TARGETS must be an array"
+fi
+
+DESCRIPTION="Common files for ${PN/-common/}"
+
+BDEPEND=">=kde-frameworks/extra-cmake-modules-${KFMIN}:*"
+
+case ${ECM_I18N} in
+ true)
+ KF5_BDEPEND+=( "kde-frameworks/ki18n:5" )
+ KF6_BDEPEND+=( "kde-frameworks/ki18n:6" )
+ ;;
+ false) ;;
+ *)
+ eerror "Unknown value for \${ECM_I18N}"
+ die "Value ${ECM_I18N} is not supported"
+ ;;
+esac
+
+case ${ECM_HANDBOOK} in
+ true)
+ IUSE+=" +handbook"
+ KF5_BDEPEND+=( "handbook? ( kde-frameworks/kdoctools:5 )" )
+ KF6_BDEPEND+=( "handbook? ( kde-frameworks/kdoctools:6 )" )
+ ;;
+ false) ;;
+ *)
+ eerror "Unknown value for \${ECM_HANDBOOK}"
+ die "Value ${ECM_HANDBOOK} is not supported"
+ ;;
+esac
+
+if [[ ${ECM_KCM_TARGETS} ]]; then
+ KF5_BDEPEND+=( "kde-frameworks/kcmutils:5" )
+ KF6_BDEPEND+=( "kde-frameworks/kcmutils:6" )
+fi
+
+if $(ver_test ${KFMIN} -lt 5.240) && [[ ${KF6_BDEPEND} && ${KF5_BDEPEND} ]]; then
+ BDEPEND+=" || ( ( ${KF6_BDEPEND[*]} ) ( ${KF5_BDEPEND[*]} ) )"
+else
+ BDEPEND+=" ${KF6_BDEPEND[*]}"
+fi
+
+# @FUNCTION: _ecm-common_preamble
+# @INTERNAL
+# @DESCRIPTION:
+# Create a CMakeLists.txt file with minimum ECM setup.
+_ecm-common_preamble() {
+ cat > CMakeLists.txt <<- _EOF_ || die
+ cmake_minimum_required(VERSION 3.16)
+ project(${PN} VERSION ${PV})
+
+ find_package(ECM "${KFMIN}" REQUIRED NO_MODULE)
+ set(CMAKE_MODULE_PATH \${ECM_MODULE_PATH})
+
+ # Set by pkg_setup(); Use this if need to differ between KF5 or KF6
+ set(KFSLOT ${_KFSLOT})
+ set(KDE_INSTALL_DOCBUNDLEDIR "${EPREFIX}/usr/share/help" CACHE PATH "")
+
+ include(KDEInstallDirs)
+ include(ECMOptionalAddSubdirectory) # commonly used
+ include(FeatureSummary)
+ _EOF_
+
+ if [[ ${ECM_INSTALL_ICONS} ]]; then
+ cat >> CMakeLists.txt <<- _EOF_ || die
+ include(ECMInstallIcons)
+ _EOF_
+ fi
+}
+
+# @FUNCTION: _ecm-common_i18n
+# @INTERNAL
+# @DESCRIPTION:
+# Find KF[56]I18n and call ki18n_install(po).
+_ecm-common_i18n() {
+ [[ ${ECM_I18N} == true ]] || return
+ cat >> CMakeLists.txt <<- _EOF_ || die
+ find_package(KF\${KFSLOT}I18n REQUIRED)
+ ki18n_install(po)
+ _EOF_
+}
+
+# @FUNCTION: _ecm-common_docs
+# @INTERNAL
+# @DESCRIPTION:
+# Find KF[56]DocTools, call kdoctools_install(po) and
+# add_subdirectory(${ECM_HANDBOOK_DIRS})
+_ecm-common_docs() {
+ { in_iuse handbook && use handbook; } || return
+
+ cat >> CMakeLists.txt <<- _EOF_ || die
+ find_package(KF\${KFSLOT}DocTools REQUIRED)
+ kdoctools_install(po)
+ _EOF_
+
+ local i
+ for i in "${ECM_HANDBOOK_DIRS[@]}"; do
+ if [[ -d ${i} ]]; then
+ cat >> CMakeLists.txt <<- _EOF_ || die
+ add_subdirectory(${i})
+ _EOF_
+ fi
+ done
+}
+
+# @FUNCTION: _ecm-common_generate_desktop_file
+# @INTERNAL
+# @DESCRIPTION:
+# Find KF[56]KCMUtils and iterate through ECM_KCM_TARGETS to generate
+# desktop files out of json.
+_ecm-common_generate_desktop_file() {
+ [[ ${ECM_KCM_TARGETS} ]] || return
+
+ cat >> CMakeLists.txt <<- _EOF_ || die
+ find_package(KF\${KFSLOT}KCMUtils REQUIRED)
+ # extracted from kcmutils_generate_desktop_file(kcm_target)
+ function(ecmcommon_generate_desktop_file kcm_target subdir)
+ set(IN_FILE \${CMAKE_CURRENT_SOURCE_DIR}/\${subdir}\${kcm_target}.json)
+ set(OUT_FILE \${CMAKE_CURRENT_BINARY_DIR}/\${kcm_target}.desktop)
+ add_custom_target(\${kcm_target}-kcm-desktop-gen ALL
+ COMMAND KF\${KFSLOT}::kcmdesktopfilegenerator \${IN_FILE} \${OUT_FILE}
+ DEPENDS \${IN_FILE})
+ install(FILES \${OUT_FILE} DESTINATION \${KDE_INSTALL_APPDIR})
+ endfunction()
+ _EOF_
+
+ local i
+ for i in "${ECM_KCM_TARGETS[@]}"; do
+ cat >> CMakeLists.txt <<- _EOF_ || die
+ ecmcommon_generate_desktop_file(${i%:*} ${i#*:})
+ _EOF_
+ done
+}
+
+# @FUNCTION: _ecm-common_ecm_install_icons
+# @INTERNAL
+# @DESCRIPTION:
+# Installs icons listed in ECM_INSTALL_ICONS using ecm_install_icons
+_ecm-common_ecm_install_icons() {
+ [[ ${ECM_INSTALL_ICONS} ]] || return
+ local i
+ for i in "${ECM_INSTALL_ICONS[@]}"; do
+ cat >> CMakeLists.txt <<- _EOF_ || die
+ ecm_install_icons(ICONS ${i%:*} DESTINATION ${i#*:})
+ _EOF_
+ done
+}
+
+# @FUNCTION: _ecm-common_ecm_install_files
+# @INTERNAL
+# @DESCRIPTION:
+# Installs files listed in ECM_INSTALL_FILES using install(FILES ...)
+_ecm-common_ecm_install_files() {
+ [[ ${ECM_INSTALL_FILES} ]] || return
+ local i
+ for i in "${ECM_INSTALL_FILES[@]}"; do
+ cat >> CMakeLists.txt <<- _EOF_ || die
+ install(FILES ${i%:*} DESTINATION ${i#*:})
+ _EOF_
+ done
+}
+
+# @FUNCTION: ecm-common_inject_heredoc
+# @DESCRIPTION:
+# Override this to inject custom Heredoc into the root CMakeLists.txt
+ecm-common_inject_heredoc() {
+ debug-print-function ${FUNCNAME} "$@"
+}
+
+# @FUNCTION: _ecm-common_summary
+# @INTERNAL
+# @DESCRIPTION:
+# Just calls feature_summary
+_ecm-common_summary() {
+ cat >> CMakeLists.txt <<- _EOF_ || die
+
+ feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
+ _EOF_
+}
+
+# @FUNCTION: ecm-common-check_deps
+# @DESCRIPTION:
+# Override this to add more KF6 has_version checks to pkg_setup(),
+# corresponding with any additional KF6_BDEPEND defined pre-inherit.
+# If false, we'll assume KF5 dependencies are fulfilled via BDEPEND.
+ecm-common-check_deps() {
+ return 0
+}
+
+# @FUNCTION: ecm-common_pkg_setup
+# @DESCRIPTION:
+# If KFMIN is not lower than 5.240 (default is 6.0.0), do nothing.
+# Otherwise, dDetermine which of KF5 or KF6-based depgraph is complete,
+# preferring KF6. The result is stored in _KFSLOT, which is then handed
+# to CMakeLists.txt as KFSLOT var for further use.
+ecm-common_pkg_setup() {
+ $(ver_test ${KFMIN} -lt 5.240) && return
+
+ if has_version -b "kde-frameworks/ki18n:6" && {
+ ! in_iuse handbook || {
+ in_iuse handbook && use handbook &&
+ has_version -b "kde-frameworks/kdoctools:6"
+ }
+ } && {
+ ! [[ ${ECM_KCM_TARGETS} ]] ||
+ has_version -b "kde-frameworks/kcmutils:6"
+ } && ecm-common-check_deps
+ then
+ _KFSLOT=6
+ else
+ _KFSLOT=5
+ fi
+}
+
+# @FUNCTION: ecm-common_src_prepare
+# @DESCRIPTION:
+# Wrapper for cmake_src_prepare with a Heredoc replacing the standard
+# root CMakeLists.txt file to only generate and install translations.
+ecm-common_src_prepare() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ _ecm-common_preamble
+ _ecm-common_i18n
+ _ecm-common_docs
+ _ecm-common_generate_desktop_file
+ _ecm-common_ecm_install_icons
+ _ecm-common_ecm_install_files
+ ecm-common_inject_heredoc
+ _ecm-common_summary
+
+ cmake_src_prepare
+}
+
+# @FUNCTION: ecm-common_src_configure
+# @DESCRIPTION:
+# Passes -DQT_MAJOR_VERSION=${_KFSLOT} only.
+ecm-common_src_configure() {
+ # necessary for at least KF6KCMUtils
+ local mycmakeargs=( -DQT_MAJOR_VERSION=${_KFSLOT} )
+ cmake_src_configure
+}
+
+fi
+
+EXPORT_FUNCTIONS pkg_setup src_prepare src_configure
diff --git a/eclass/ecm.eclass b/eclass/ecm.eclass
index c8731b8c0cff..fbe1a23cf205 100644
--- a/eclass/ecm.eclass
+++ b/eclass/ecm.eclass
@@ -84,8 +84,8 @@ fi
# @ECLASS_VARIABLE: ECM_HANDBOOK
# @DESCRIPTION:
-# Will accept "true", "false", "optional", "forceoptional". If set to "false",
-# do nothing.
+# Will accept "true", "false", "optional", "forceoptional", "forceoff".
+# If set to "false" (default), do nothing.
# Otherwise, add "+handbook" to IUSE, add the appropriate dependency, and let
# KF${_KFSLOT}DocTools generate and install the handbook from docbook file(s)
# found in ECM_HANDBOOK_DIR. However if !handbook, disable build of
@@ -122,6 +122,15 @@ if [[ ${CATEGORY} = kde-frameworks ]]; then
fi
: "${ECM_QTHELP:=false}"
+# @ECLASS_VARIABLE: ECM_REMOVE_FROM_INSTALL
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Array of <paths> to remove from install image.
+if [[ ${ECM_REMOVE_FROM_INSTALL} ]]; then
+ [[ ${ECM_REMOVE_FROM_INSTALL@a} == *a* ]] ||
+ die "ECM_REMOVE_FROM_INSTALL must be an array"
+fi
+
# @ECLASS_VARIABLE: ECM_TEST
# @DEFAULT_UNSET
# @DESCRIPTION:
@@ -233,7 +242,7 @@ case ${ECM_HANDBOOK} in
IUSE+=" +handbook"
BDEPEND+=" handbook? ( >=kde-frameworks/kdoctools-${KFMIN}:${_KFSLOT} )"
;;
- false) ;;
+ false|forceoff) ;;
*)
eerror "Unknown value for \${ECM_HANDBOOK}"
die "Value ${ECM_HANDBOOK} is not supported"
@@ -446,6 +455,25 @@ ecm_punt_bogus_dep() {
fi
}
+# @FUNCTION: _ecm_punt_kdoctools_install
+# @INTERNAL
+# @DESCRIPTION:
+# Disables kdoctools_install(po) call.
+_ecm_punt_kdoctools_install() {
+ sed -e "s/^ *kdoctools_install.*(po.*)/#& # disabled by ecm.eclass/" \
+ -i CMakeLists.txt || die
+}
+
+# @FUNCTION: ecm_punt_po_install
+# @DESCRIPTION:
+# Disables handling of po subdirectories, typically when the package
+# is outsourcing common files to a ${PN}-common split package.
+ecm_punt_po_install() {
+ _ecm_punt_kdoctools_install
+ sed -e "s/^ *ki18n_install.*(po.*)/#& # disabled by ecm.eclass/" \
+ -i CMakeLists.txt || die
+}
+
# @FUNCTION: ecm_pkg_pretend
# @DESCRIPTION:
# Checks if the active compiler meets the minimum version requirements.
@@ -478,13 +506,16 @@ ecm_src_prepare() {
fi
# only enable handbook when required
- if in_iuse handbook && ! use handbook ; then
+ if [[ ${ECM_HANDBOOK} == forceoff ]] ||
+ { [[ ${ECM_HANDBOOK} = forceoptional ]] && in_iuse handbook && ! use handbook; }
+ then
+ ecm_punt_kf_module DocTools
+ _ecm_punt_kdoctools_install
+ fi
+ if [[ ${ECM_HANDBOOK} == forceoff ]] ||
+ { in_iuse handbook && ! use handbook; }
+ then
cmake_comment_add_subdirectory ${ECM_HANDBOOK_DIR}
-
- if [[ ${ECM_HANDBOOK} = forceoptional ]] ; then
- ecm_punt_kf_module DocTools
- sed -i -e "/kdoctools_install/I s/^/#DONT/" CMakeLists.txt || die
- fi
fi
# drop translations when nls is not wanted
@@ -657,9 +688,9 @@ ecm_src_install() {
cmake_src_install
+ local f
# bug 621970
if [[ -d "${ED}"/usr/share/applications ]]; then
- local f
for f in "${ED}"/usr/share/applications/*.desktop; do
if [[ -x ${f} ]]; then
einfo "Removing executable bit from ${f#${ED}}"
@@ -694,6 +725,10 @@ ecm_src_install() {
popd > /dev/null || die
fi
fi
+
+ for f in "${ECM_REMOVE_FROM_INSTALL[@]}"; do
+ rm -r "${ED}"${f} || die
+ done
}
# @FUNCTION: ecm_pkg_preinst
diff --git a/eclass/gear.kde.org.eclass b/eclass/gear.kde.org.eclass
index 3f8126dd1c01..8089cbb53bf7 100644
--- a/eclass/gear.kde.org.eclass
+++ b/eclass/gear.kde.org.eclass
@@ -94,7 +94,6 @@ if $(ver_test -gt 24.01.75); then
dragon | \
elisa | \
eventviews | \
- ffmpegthumbs | \
filelight | \
granatier | \
grantlee-editor | \
@@ -256,6 +255,7 @@ if $(ver_test -gt 24.04.75); then
itinerary | \
kio-perldoc | \
kolourpaint | \
+ libkcompactdisc | \
signon-kwallet-extension)
RDEPEND+=" !${CATEGORY}/${PN}:5" ;;
*) ;;
@@ -267,7 +267,6 @@ if $(ver_test -gt 24.07.75); then
case ${PN} in
k3b | \
kde-dev-scripts | \
- kdesdk-thumbnailers | \
kdevelop | \
kdevelop-php | \
kdevelop-python | \