From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 5482013997D for ; Sun, 10 Nov 2019 16:27:01 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id BDA1FE09EC; Sun, 10 Nov 2019 16:26:56 +0000 (UTC) Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 595F3E09E4 for ; Sun, 10 Nov 2019 16:26:56 +0000 (UTC) Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id D804B21583 for ; Sun, 10 Nov 2019 11:26:55 -0500 (EST) Received: from imap2 ([10.202.2.52]) by compute6.internal (MEProxy); Sun, 10 Nov 2019 11:26:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=rSM0kn dFRlVVQOgTi6QTpwqocZoFajA6+VnDU6AXo1M=; b=YIDbRFAGs/0cR9l/Wjzv2r 4iW30l9XY7r9wb4y1bRAPHoaPhxXBZ2r1My6BQCPWo8fA8j3vWlbzUlpHXZ0SF/c NwpS4Ln0fdacXOHMVLLyjnlfIxtBX9BRHeCK9iMCsUliuB911vYB3gaxP1BZkG9r FSvjZTGvzA7Tms+HKzzWS98lgfFwiw+DczWb+/9Q3JBnX8k//j03VO2L90GXWHx6 IJuElzQJcadkwxIaSOy6LR29ddrK892gfCL6CR41PBBW4QRvbe5Kcx9UkqruMPSd N2QzqqC8mlWws9P5vUiVxP4JgLwJ9BMETf1To7LkhGKGfUK0H7mgxHyDbRq/fzyw == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedruddvhedgledvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefofgggkfgjfhffhffvufgtsegrtd erreerredtnecuhfhrohhmpedfifhokhhtuhhrkhcujghukhhsvghkfdcuoehgohhkthhu rhhksehgvghnthhoohdrohhrgheqnecuffhomhgrihhnpehgvghnthhoohdrohhrghenuc frrghrrghmpehmrghilhhfrhhomhepghhokhhtuhhrkhesghgvnhhtohhordhorhhgnecu vehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id 7624DE00A3; Sun, 10 Nov 2019 11:26:55 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.1.7-509-ge3ec61c-fmstable-20191030v1 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply Mime-Version: 1.0 Message-Id: <9c2c3ff2-4332-488c-955e-d2c4e726a590@www.fastmail.com> In-Reply-To: <17486305.dnObLhtpFU@tuxk10> References: <9898161.uzqcMZjEFU@tuxk10> <4949294.KT39OxLedd@tuxbrain> <17486305.dnObLhtpFU@tuxk10> Date: Sun, 10 Nov 2019 11:26:34 -0500 From: "Gokturk Yuksek" To: gentoo-dev@lists.gentoo.org Subject: Re: [gentoo-dev] [PATCH v2 1/3] ecm.eclass: New eclass Content-Type: multipart/alternative; boundary=1425828ac439486cb96f36ec1d6b20a8 X-Archives-Salt: 2d531abd-7ce2-4b8a-bfaf-45b75a8083df X-Archives-Hash: aa2aa51b539d395c01419f6ada1e9493 --1425828ac439486cb96f36ec1d6b20a8 Content-Type: text/plain > > --- /dev/null > +++ b/eclass/ecm.eclass > @@ -0,0 +1,639 @@ > +# Copyright 1999-2019 Gentoo Authors > +# Distributed under the terms of the GNU General Public License v2 > + > +# @ECLASS: ecm.eclass > +# @MAINTAINER: > +# kde@gentoo.org > +# @SUPPORTED_EAPIS: 7 > +# @BLURB: Support eclass for packages that use KDE Frameworks with ECM. > +# @DESCRIPTION: > +# This eclass is intended to streamline the creation of ebuilds for packages > +# that use cmake and KDE Frameworks' extra-cmake-modules, thereby following > +# some of their packaging conventions. It is primarily intended for the tree s/tree/three/ > +# upstream release groups (Frameworks, Plasma, Applications) but also for any > +# other package that follows similar conventions. > +# > +# This eclass unconditionally inherits cmake-utils.eclass and all its public > +# variables and helper functions (not phase functions) may be considered as part > +# of this eclass's API. > +# > +# This eclass's phase functions are not intended to be mixed and matched, so if > +# any phase functions are overridden the version here should also be called. > +# > +# Porting from kde5.class > +# - Convert all add_*_dep dependency functions to regular dependencies > +# - Manually set LICENSE > +# - Manually set SLOT > +# - Rename vars and function names as needed, see kde5.eclass PORTING comments > +# - Instead of FRAMEWORKS_MINIMAL, define KFMIN in ebuilds and use it for deps > + > +if [[ -z ${_ECM_UTILS_ECLASS} ]]; then > +_ECM_UTILS_ECLASS=1 > + > +# @ECLASS-VARIABLE: VIRTUALX_REQUIRED > +# @DESCRIPTION: > +# For proper description see virtualx.eclass manpage. > +# Here we redefine default value to be manual, if your package needs virtualx > +# for tests you should proceed with setting VIRTUALX_REQUIRED=test. > +: ${VIRTUALX_REQUIRED:=manual} > + > +inherit cmake-utils flag-o-matic toolchain-funcs virtualx xdg > + > +case ${EAPI} in > + 7) ;; > + *) die "EAPI=${EAPI:-0} is not supported" ;; > +esac > + > +if [[ -v KDE_GCC_MINIMAL ]]; then > + EXPORT_FUNCTIONS pkg_pretend > +fi > + > +EXPORT_FUNCTIONS pkg_setup src_prepare src_configure src_test pkg_preinst pkg_postinst pkg_postrm > + > +# @ECLASS-VARIABLE: ECM_KDEINSTALLDIRS > +# @DESCRIPTION: > +# Assume the package is using KDEInstallDirs macro and switch > +# KDE_INSTALL_USE_QT_SYS_PATHS to ON. If set to "false", do nothing. > +: ${ECM_KDEINSTALLDIRS:=true} > + > +# @ECLASS-VARIABLE: ECM_NONGUI > +# @DEFAULT_UNSET > +# @DESCRIPTION: > +# By default, for all CATEGORIES except kde-frameworks, assume we are building > +# a GUI application. Add dependency on kde-frameworks/breeze-icons or > +# kde-frameworks/oxygen-icons and run the xdg.eclass routines for pkg_preinst, > +# pkg_postinst and pkg_postrm. If set to "true", do nothing. > +if [[ ${CATEGORY} = kde-frameworks ]]; then > + : ${ECM_NONGUI:=true} > +fi > +: ${ECM_NONGUI:=false} > + > +# @ECLASS-VARIABLE: ECM_DEBUG > +# @DESCRIPTION: > +# Add "debug" to IUSE. If !debug, add -DNDEBUG (via cmake-utils_src_configure) > +# and -DQT_NO_DEBUG to CPPFLAGS. If set to "false", do nothing. > +: ${ECM_DEBUG:=true} > + > +# @ECLASS-VARIABLE: ECM_DESIGNERPLUGIN > +# @DESCRIPTION: > +# If set to "true", add "designer" to IUSE to toggle build of designer plugins > +# and add the necessary BDEPEND. If set to "false", do nothing. > +: ${ECM_DESIGNERPLUGIN:=false} > + > +# @ECLASS-VARIABLE: ECM_EXAMPLES > +# @DESCRIPTION: > +# By default unconditionally ignore a top-level examples subdirectory. > +# If set to "true", add "examples" to IUSE to toggle adding that subdirectory. > +: ${ECM_EXAMPLES:=false} > + > +# @ECLASS-VARIABLE: ECM_HANDBOOK > +# @DESCRIPTION: > +# Will accept "true", "false", "optional", "forceoptional". If set to "false", > +# do nothing. > +# Otherwise, add "+handbook" to IUSE, add the appropriate dependency, and let > +# KF5DocTools generate and install the handbook from docbook file(s) found in > +# ECM_HANDBOOK_DIR. However if !handbook, disable build of ECM_HANDBOOK_DIR > +# in CMakeLists.txt. > +# If set to "optional", build with -DCMAKE_DISABLE_FIND_PACKAGE_KF5DocTools=ON > +# when !handbook. In case package requires KF5KDELibs4Support, see next: > +# If set to "forceoptional", remove a KF5DocTools dependency from the root > +# CMakeLists.txt in addition to the above. > +: ${ECM_HANDBOOK:=false} > + > +# @ECLASS-VARIABLE: ECM_HANDBOOK_DIR > +# @DESCRIPTION: > +# Specifies the directory containing the docbook file(s) relative to ${S} to > +# be processed by KF5DocTools (kdoctools_install). > +: ${ECM_HANDBOOK_DIR:=doc} > + > +# @ECLASS-VARIABLE: ECM_PO_DIRS > +# @DESCRIPTION: > +# Specifies directories of l10n files relative to ${S} to be processed by > +# KF5I18n (ki18n_install). If IUSE nls exists and is disabled then disable > +# build of these directories in CMakeLists.txt. > +: ${ECM_PO_DIRS:="po poqm"} > + > +# @ECLASS-VARIABLE: ECM_QTHELP > +# @DEFAULT_UNSET > +# @DESCRIPTION: > +# Default value for all CATEGORIES except kde-frameworks is "false". > +# If set to "true", add "doc" to IUSE, add the appropriate dependency, let > +# -DBUILD_QCH=ON generate and install Qt compressed help files when USE=doc. > +# If set to "false", do nothing. > +if [[ ${CATEGORY} = kde-frameworks ]]; then > + : ${ECM_QTHELP:=true} > +fi > +: ${ECM_QTHELP:=false} > + > +# @ECLASS-VARIABLE: ECM_TEST > +# @DEFAULT_UNSET > +# @DESCRIPTION: > +# Will accept "true", "false", "optional", "forceoptional", > +# "forceoptional-recursive". > +# Default value is "false", except for CATEGORY=kde-frameworks where it is > +# set to "true". If set to "false", do nothing. > +# For any other value, add "test" to IUSE and DEPEND on dev-qt/qttest:5. > +# If set to "optional", build with -DCMAKE_DISABLE_FIND_PACKAGE_Qt5Test=ON > +# when USE=!test. > +# If set to "forceoptional", punt Qt5Test dependency and ignore "autotests", > +# "test", "tests" subdirs from top-level CMakeLists.txt when USE=!test. > +# If set to "forceoptional-recursive", punt Qt5Test dependencies and make > +# autotest(s), unittest(s) and test(s) subdirs from *any* CMakeLists.txt in > +# ${S} and below conditional on BUILD_TESTING when USE=!test. This is always > +# meant as a short-term fix and creates ${T}/${P}-tests-optional.patch to > +# refine and submit upstream. > +if [[ ${CATEGORY} = kde-frameworks ]]; then > + : ${ECM_TEST:=true} > +fi > +: ${ECM_TEST:=false} > + > +# @ECLASS-VARIABLE: KFMIN > +# @DESCRIPTION: > +# Minimum version of Frameworks to require. The default value is not going to > +# be changed unless we also bump EAPI, which usually implies (rev-)bumping. > +# Version will later be used to differentiate between KF5/Qt5 and KF6/Qt6. > +: ${KFMIN:=5.64.0} > + > +# @ECLASS-VARIABLE: KFSLOT > +# @INTERNAL > +# @DESCRIPTION: > +# KDE Frameworks and Qt slot dependency, implied by KFMIN version. > +: ${KFSLOT:=5} > + > +case ${ECM_NONGUI} in > + true) ;; > + false) > + # gui applications need breeze or oxygen for basic iconset, bug #564838 > + if [[ -n ${_KDE5_ECLASS} ]] ; then > + RDEPEND+=" || ( > + >=kde-frameworks/breeze-icons-${KFMIN}:${KFSLOT} > + kde-frameworks/oxygen-icons:* > + )" > + else > + RDEPEND+=" || ( > + kde-frameworks/breeze-icons:* > + kde-frameworks/oxygen-icons:* > + )" > + fi > + ;; > + *) > + eerror "Unknown value for \${ECM_NONGUI}" > + die "Value ${ECM_NONGUI} is not supported" > + ;; > +esac > + > +case ${ECM_DEBUG} in > + true) > + IUSE+=" debug" > + ;; > + false) ;; > + *) > + eerror "Unknown value for \${ECM_DEBUG}" > + die "Value ${ECM_DEBUG} is not supported" > + ;; > +esac > + > +case ${ECM_DESIGNERPLUGIN} in > + true) > + IUSE+=" designer" > + if [[ -n ${_KDE5_ECLASS} ]] ; then > + BDEPEND+=" designer? ( >=dev-qt/designer-5.12.3:${KFSLOT} )" > + else > + BDEPEND+=" designer? ( dev-qt/designer:${KFSLOT} )" > + fi > + ;; > + false) ;; > + *) > + eerror "Unknown value for \${ECM_DESIGNERPLUGIN}" > + die "Value ${ECM_DESIGNERPLUGIN} is not supported" > + ;; > +esac > + > +# @ECLASS-VARIABLE: KDE_DESIGNERPLUGIN > +# @DESCRIPTION: > +# If set to "false", do nothing. > +# Otherwise, add "designer" to IUSE to toggle build of designer plugins > +# and add the necessary BDEPEND. > +# TODO: drop after KDE Applications 19.08.3 removal > +: ${KDE_DESIGNERPLUGIN:=false} > +case ${KDE_DESIGNERPLUGIN} in > + true) > + IUSE+=" designer" > + BDEPEND+=" > + designer? ( >=kde-frameworks/kdesignerplugin-${KFMIN}:${KFSLOT} ) > + " > + ;; > + false) ;; > + *) > + eerror "Unknown value for \${KDE_DESIGNERPLUGIN}" > + die "Value ${KDE_DESIGNERPLUGIN} is not supported" > + ;; > +esac > + > +case ${ECM_EXAMPLES} in > + true) > + IUSE+=" examples" > + ;; > + false) ;; > + *) > + eerror "Unknown value for \${ECM_EXAMPLES}" > + die "Value ${ECM_EXAMPLES} is not supported" > + ;; > +esac > + > +case ${ECM_HANDBOOK} in > + true|optional|forceoptional) > + IUSE+=" +handbook" > + BDEPEND+=" handbook? ( >=kde-frameworks/kdoctools-${KFMIN}:${KFSLOT} )" > + ;; > + false) ;; > + *) > + eerror "Unknown value for \${ECM_HANDBOOK}" > + die "Value ${ECM_HANDBOOK} is not supported" > + ;; > +esac > + > +case ${ECM_QTHELP} in > + true) > + IUSE+=" doc" > + if [[ -n ${_KDE5_ECLASS} ]] ; then > + COMMONDEPEND+=" doc? ( >=dev-qt/qt-docs-5.12.3:${KFSLOT} )" > + BDEPEND+=" >=dev-qt/qthelp-5.12.3:${KFSLOT} )" > + else > + COMMONDEPEND+=" doc? ( dev-qt/qt-docs:${KFSLOT} )" > + BDEPEND+=" dev-qt/qthelp:${KFSLOT} )" > + fi > + BDEPEND+=" doc? ( >=app-doc/doxygen-1.8.13-r1 )" > + ;; > + false) ;; > + *) > + eerror "Unknown value for \${ECM_QTHELP}" > + die "Value ${ECM_QTHELP} is not supported" > + ;; > +esac > + > +case ${ECM_TEST} in > + true|optional|forceoptional|forceoptional-recursive) > + IUSE+=" test" > + if [[ -n ${_KDE5_ECLASS} ]] ; then > + DEPEND+=" test? ( >=dev-qt/qttest-5.12.3:${KFSLOT} )" > + else > + DEPEND+=" test? ( dev-qt/qttest:${KFSLOT} )" > + fi > + RESTRICT+=" !test? ( test )" > + ;; > + false) ;; > + *) > + eerror "Unknown value for \${ECM_TEST}" > + die "Value ${ECM_TEST} is not supported" > + ;; > +esac > + > +BDEPEND+=" >=kde-frameworks/extra-cmake-modules-${KFMIN}:${KFSLOT}" > +RDEPEND+=" >=kde-frameworks/kf-env-4" > +if [[ -n ${_KDE5_ECLASS} ]] ; then > + COMMONDEPEND+=" >=dev-qt/qtcore-5.12.3:${KFSLOT}" > +else > + COMMONDEPEND+=" dev-qt/qtcore:${KFSLOT}" > +fi > + > +DEPEND+=" ${COMMONDEPEND}" > +RDEPEND+=" ${COMMONDEPEND}" > +unset COMMONDEPEND > + > +# @ECLASS-VARIABLE: KDE_GCC_MINIMAL > +# @DEFAULT_UNSET > +# @DESCRIPTION: > +# Minimum version of active GCC to require. This is checked in > +# ecm_pkg_pretend and ecm_pkg_setup. > + > +# @FUNCTION: _ecm_check_gcc_version > +# @INTERNAL > +# @DESCRIPTION: > +# Determine if the current GCC version is acceptable, otherwise die. > +_ecm_check_gcc_version() { > + if [[ ${MERGE_TYPE} != binary && -v KDE_GCC_MINIMAL ]] && tc-is-gcc; then > + > + local version=$(gcc-version) > + > + debug-print "GCC version check activated" > + debug-print "Version detected: ${version}" > + debug-print "Version required: ${KDE_GCC_MINIMAL}" > + > + ver_test ${version} -lt ${KDE_GCC_MINIMAL} && > + die "Sorry, but gcc-${KDE_GCC_MINIMAL} or later is required for this package (found ${version})." > + fi > +} > + > +# @FUNCTION: _ecm_strip_handbook_translations > +# @INTERNAL > +# @DESCRIPTION: > +# If LINGUAS is defined, enable only the requested translations when required. > +_ecm_strip_handbook_translations() { > + if ! [[ -v LINGUAS ]]; then > + return > + fi > + > + local lang po > + for po in ${ECM_PO_DIRS}; do > + if [[ -d ${po} ]] ; then > + pushd ${po} > /dev/null || die > + local lang > + for lang in *; do > + if [[ -e ${lang} ]] && ! has ${lang/.po/} ${LINGUAS} ; then > + case ${lang} in > + cmake_modules | \ > + CMakeLists.txt | \ > + ${PN}.pot) ;; > + *) rm -r ${lang} || die ;; > + esac > + if [[ -e CMakeLists.txt ]] ; then > + cmake_comment_add_subdirectory ${lang} > + sed -e "/add_subdirectory([[:space:]]*${lang}\/.*[[:space:]]*)/d" \ > + -i CMakeLists.txt || die > + fi > + fi > + done > + popd > /dev/null || die > + fi > + done > +} > + > +# @FUNCTION: ecm_punt_bogus_dep > +# @USAGE: > +# @DESCRIPTION: > +# Removes a specified dependency from a find_package call with multiple > +# components. > +ecm_punt_bogus_dep() { > + local prefix=${1} > + local dep=${2} > + > + if [[ ! -e "CMakeLists.txt" ]]; then > + return > + fi > + > + pcregrep -Mni "(?s)find_package\s*\(\s*${prefix}[^)]*?${dep}.*?\)" CMakeLists.txt > "${T}/bogus${dep}" > + > + # pcregrep returns non-zero on no matches/error > + if [[ $? -ne 0 ]] ; then > + return > + fi > + > + local length=$(wc -l "${T}/bogus${dep}" | cut -d " " -f 1) > + local first=$(head -n 1 "${T}/bogus${dep}" | cut -d ":" -f 1) > + local last=$(( length + first - 1)) > + > + sed -e "${first},${last}s/${dep}//" -i CMakeLists.txt || die > + > + if [[ ${length} -eq 1 ]] ; then > + sed -e "/find_package\s*(\s*${prefix}\(\s\+\(REQUIRED\|CONFIG\|COMPONENTS\|\${[A-Z0-9_]*}\)\)\+\s*)/Is/^/# removed by ecm.eclass - /" -i CMakeLists.txt || die > + fi > +} > + > +# @FUNCTION: ecm_pkg_pretend > +# @DESCRIPTION: > +# Checks if the active compiler meets the minimum version requirements. > +# phase function is only exported if KDE_GCC_MINIMAL is defined. > +ecm_pkg_pretend() { > + debug-print-function ${FUNCNAME} "$@" > + _ecm_check_gcc_version > +} > + > +# @FUNCTION: ecm_pkg_setup > +# @DESCRIPTION: > +# Checks if the active compiler meets the minimum version requirements. > +ecm_pkg_setup() { > + debug-print-function ${FUNCNAME} "$@" > + _ecm_check_gcc_version > +} > + > +# @FUNCTION: ecm_src_prepare > +# @DESCRIPTION: > +# Wrapper for cmake-utils_src_prepare with lots of extra logic for magic > +# handling of linguas, tests, handbook etc. > +ecm_src_prepare() { > + debug-print-function ${FUNCNAME} "$@" > + > + cmake-utils_src_prepare > + > + # only build examples when required > + if ! { in_iuse examples && use examples; } ; then > + cmake_comment_add_subdirectory examples > + fi > + > + # only enable handbook when required > + if in_iuse handbook && ! use handbook ; then > + cmake_comment_add_subdirectory ${ECM_HANDBOOK_DIR} > + > + if [[ ${ECM_HANDBOOK} = forceoptional ]] ; then > + punt_bogus_dep KF5 DocTools > + sed -i -e "/kdoctools_install/ s/^/#DONT/" CMakeLists.txt || die > + fi > + fi > + > + # drop translations when nls is not wanted > + if in_iuse nls && ! use nls ; then > + local po > + for po in ${ECM_PO_DIRS}; do > + rm -rf ${po} || die > + done > + fi > + > + # don't change behaviour for kde5.eclass consumers > + # for ported ebuilds, limit playing field of this to kde-*/ categories > + if [[ -n ${_KDE5_ECLASS} ]] ; then > + _ecm_strip_handbook_translations # TODO: kde5.eclass cleanup > + elif [[ ${CATEGORY} = kde-* ]] ; then > + # always install unconditionally for kconfigwidgets - if you use > + # language X as system language, and there is a combobox with language > + # names, the translated language name for language Y is taken from > + # /usr/share/locale/Y/kf5_entry.desktop > + [[ ${PN} != kconfigwidgets ]] && _ecm_strip_handbook_translations > + fi > + > + # only build unit tests when required > + if ! { in_iuse test && use test; } ; then > + if [[ ${ECM_TEST} = forceoptional ]] ; then > + punt_bogus_dep Qt5 Test > + # if forceoptional, also cover non-kde categories > + cmake_comment_add_subdirectory autotests test tests > + elif [[ ${ECM_TEST} = forceoptional-recursive ]] ; then > + punt_bogus_dep Qt5 Test > + local f pf="${T}/${P}"-tests-optional.patch > + touch ${pf} || die "Failed to touch patch file" > + for f in $(find . -type f -name "CMakeLists.txt" -exec \ > + grep -l "^\s*add_subdirectory\s*\(\s*.*\(auto|unit\)\?tests\?\s*)\s*\)" {} \;); do > + cp ${f} ${f}.old || die "Failed to prepare patch origfile" > + pushd ${f%/*} > /dev/null || die > + punt_bogus_dep Qt5 Test > + sed -i CMakeLists.txt -e \ > + "/^#/! s/add_subdirectory\s*\(\s*.*\(auto|unit\)\?tests\?\s*)\s*\)/if(BUILD_TESTING)\n&\nendif()/" \ > + || die > + popd > /dev/null || die > + diff -Naur ${f}.old ${f} 1>>${pf} > + rm ${f}.old || die "Failed to clean up" > + done > + eqawarn "Build system was modified by ECM_TEST=forceoptional-recursive." > + eqawarn "Unified diff file ready for pickup in:" > + eqawarn " ${pf}" > + eqawarn "Push it upstream to make this message go away." > + elif [[ ${CATEGORY} = kde-frameworks || ${CATEGORY} = kde-plasma || ${CATEGORY} = kde-apps ]] ; then > + cmake_comment_add_subdirectory autotests test tests > + fi > + fi > + > + # in frameworks, tests = manual tests so never build them > + if [[ ${CATEGORY} = kde-frameworks ]] && [[ ${PN} != extra-cmake-modules ]]; then > + cmake_comment_add_subdirectory tests > + fi > +} > + > +# @FUNCTION: ecm_src_configure > +# @DESCRIPTION: > +# Wrapper for cmake-utils_src_configure with extra logic for magic handling of > +# handbook, tests etc. > +ecm_src_configure() { > + debug-print-function ${FUNCNAME} "$@" > + > + # we rely on cmake-utils.eclass to append -DNDEBUG too > + if in_iuse debug && ! use debug; then > + append-cppflags -DQT_NO_DEBUG > + fi > + > + local cmakeargs > + > + if in_iuse test && ! use test ; then > + cmakeargs+=( -DBUILD_TESTING=OFF ) > + > + if [[ ${ECM_TEST} = optional ]] ; then > + cmakeargs+=( -DCMAKE_DISABLE_FIND_PACKAGE_Qt5Test=ON ) > + fi > + fi > + > + if [[ ${ECM_HANDBOOK} = optional ]] ; then > + cmakeargs+=( -DCMAKE_DISABLE_FIND_PACKAGE_KF5DocTools=$(usex handbook) ) > + fi > + > + if in_iuse designer && [[ ${ECM_DESIGNERPLUGIN} = true ]]; then > + cmakeargs+=( -DBUILD_DESIGNERPLUGIN=$(usex designer) ) > + fi > + > + # TODO: drop after KDE Applications 19.08.3 removal > + if in_iuse designer && [[ ${KDE_DESIGNERPLUGIN} != false ]] ; then > + cmakeargs+=( $(cmake-utils_use_find_package designer KF5DesignerPlugin) ) > + fi > + > + if [[ ${ECM_QTHELP} = true ]]; then > + cmakeargs+=( -DBUILD_QCH=$(usex doc) ) > + fi > + > + if [[ ${ECM_KDEINSTALLDIRS} = true ]] ; then > + cmakeargs+=( > + # install mkspecs in the same directory as Qt stuff > + -DKDE_INSTALL_USE_QT_SYS_PATHS=ON > + # move handbook outside of doc dir, bug 667138 > + -DKDE_INSTALL_DOCBUNDLEDIR="${EPREFIX}/usr/share/help" > + ) > + fi > + > + # allow the ebuild to override what we set here > + mycmakeargs=("${cmakeargs[@]}" "${mycmakeargs[@]}") > + > + cmake-utils_src_configure > +} > + > +# @FUNCTION: ecm_src_compile > +# @DESCRIPTION: > +# Wrapper for cmake-utils_src_compile. Currently doesn't do anything extra, but > +# is included as part of the API just in case it's needed in the future. > +ecm_src_compile() { > + debug-print-function ${FUNCNAME} "$@" > + > + cmake-utils_src_compile "$@" > +} > + > +# @FUNCTION: ecm_src_test > +# @DESCRIPTION: > +# Wrapper for cmake-utils_src_test with extra logic for magic handling of dbus > +# and virtualx. > +ecm_src_test() { > + debug-print-function ${FUNCNAME} "$@" > + > + _test_runner() { > + if [[ -n "${VIRTUALDBUS_TEST}" ]]; then > + export $(dbus-launch) > + fi > + > + cmake-utils_src_test > + } > + > + # When run as normal user during ebuild development with the ebuild command, > + # tests tend to access the session DBUS. This however is not possible in a > + # real emerge or on the tinderbox. > + # make sure it does not happen, so bad tests can be recognized and disabled > + unset DBUS_SESSION_BUS_ADDRESS DBUS_SESSION_BUS_PID > + > + if [[ ${VIRTUALX_REQUIRED} = always || ${VIRTUALX_REQUIRED} = test ]]; then > + virtx _test_runner > + else > + _test_runner > + fi > + > + if [[ -n "${DBUS_SESSION_BUS_PID}" ]] ; then > + kill ${DBUS_SESSION_BUS_PID} > + fi > +} > + > +# @FUNCTION: ecm_src_install > +# @DESCRIPTION: > +# Wrapper for cmake-utils_src_install. Currently doesn't do anything extra, but > +# is included as part of the API just in case it's needed in the future. > +ecm_src_install() { > + debug-print-function ${FUNCNAME} "$@" > + > + cmake-utils_src_install > +} > + > +# @FUNCTION: ecm_pkg_preinst > +# @DESCRIPTION: > +# Sets up environment variables required in ecm_pkg_postinst. > +ecm_pkg_preinst() { > + debug-print-function ${FUNCNAME} "$@" > + > + case ${ECM_NONGUI} in > + false) xdg_pkg_preinst ;; > + *) ;; > + esac > +} > + > +# @FUNCTION: ecm_pkg_postinst > +# @DESCRIPTION: > +# Updates the various XDG caches (icon, desktop, mime) if necessary. > +ecm_pkg_postinst() { > + debug-print-function ${FUNCNAME} "$@" > + > + case ${ECM_NONGUI} in > + false) xdg_pkg_postinst ;; > + *) ;; > + esac > + > + if [[ -n ${_KDE_ORG_ECLASS} ]] && [[ -z ${I_KNOW_WHAT_I_AM_DOING} ]] && [[ ${KDE_BUILD_TYPE} = live ]]; then > + einfo "WARNING! This is an experimental live ebuild of ${CATEGORY}/${PN}" > + einfo "Use it at your own risk." > + einfo "Do _NOT_ file bugs at bugs.gentoo.org because of this ebuild!" > + fi > +} > + > +# @FUNCTION: ecm_pkg_postrm > +# @DESCRIPTION: > +# Updates the various XDG caches (icon, desktop, mime) if necessary. > +ecm_pkg_postrm() { > + debug-print-function ${FUNCNAME} "$@" > + > + case ${ECM_NONGUI} in > + false) xdg_pkg_postrm ;; > + *) ;; > + esac > +} > + > +fi > > > *Attachments:* > * signature.asc --1425828ac439486cb96f36ec1d6b20a8 Content-Type: text/html Content-Transfer-Encoding: quoted-printable
>
<= blockquote type=3D"cite" id=3D"qt">
---= /dev/null
+++ b/eclass/ecm.e= class
@@ -0,0 +1,639 @@
+# Copyright 1999-2019 Gentoo Auth= ors
+# Distributed under the = terms of the GNU General Public License v2
+
+# @ECLASS: e= cm.eclass
+# @MAINTAINER:
=
+# kde@gentoo.org
+# @SUPPORTED_EAPIS: 7
+# @BLURB: Support eclass for packages that use KDE= Frameworks with ECM.
+# @DES= CRIPTION:
+# This eclass is i= ntended to streamline the creation of ebuilds for packages
+# that use cmake and KDE Frameworks' extr= a-cmake-modules, thereby following
+# some of their packaging conventions. It is primarily intended f= or the tree

=
s/tree/three/

+# upstream release groups (Frameworks, Pla= sma, Applications) but also for any
+# other package that follows similar conventions.
+#
+# This eclass unconditionally inherits cmake-utils.eclass and all it= s public
+# variables and hel= per functions (not phase functions) may be considered as part
<= div style=3D"font-family:Arial;">+# of this eclass's API.
+#
+# This eclass's phase functions are not intended to be mixed and mat= ched, so if
+# any phase func= tions are overridden the version here should also be called.
+#
+# Porting from kde5.class
+# - Convert all add_*_dep dependency functions to regular dependenc= ies
+# - Manually set LICENSE=
+# - Manually set SLOT
+# - Rename vars and function name= s as needed, see kde5.eclass PORTING comments
+# - Instead of FRAMEWORKS_MINIMAL, define KFMIN in ebu= ilds and use it for deps
+
+if [[ -z ${_ECM_UTILS_ECLASS} = ]]; then
+_ECM_UTILS_ECLASS=3D= 1
+
+# @ECLASS-VARIABLE: VIRTUALX_REQUIRED
+# @DESCRIPTION:
+# For proper description see virtualx.eclass manpage.
+# Here we redefine default va= lue to be manual, if your package needs virtualx
+# for tests you should proceed with setting VIRTUAL= X_REQUIRED=3Dtest.
+: ${VIRTU= ALX_REQUIRED:=3Dmanual}
+
=
+inherit cmake-utils flag-o-mati= c toolchain-funcs virtualx xdg
+
+case ${EAPI} in
+ 7) ;;
+ *) die "EAPI=3D${EAPI:-0} is not supported" ;;
=
+esac
+
+if [[ -v KDE_GC= C_MINIMAL ]]; then
+ EXPORT_F= UNCTIONS pkg_pretend
+fi
<= /div>
+
+EXPORT_FUNCTIONS pkg_setup src_prepare src_configure src_te= st pkg_preinst pkg_postinst pkg_postrm
+
+# @ECLASS-VARIAB= LE: ECM_KDEINSTALLDIRS
+# @DE= SCRIPTION:
+# Assume the pack= age is using KDEInstallDirs macro and switch
+# KDE_INSTALL_USE_QT_SYS_PATHS to ON. If set to "false"= , do nothing.
+: ${ECM_KDEINS= TALLDIRS:=3Dtrue}
+
=
+# @ECLASS-VARIABLE: ECM_NONGUI
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# By default, for all CATEGORIES except kde-frameworks, a= ssume we are building
+# a GU= I application. Add dependency on kde-frameworks/breeze-icons or
+# kde-frameworks/oxygen-icons and ru= n the xdg.eclass routines for pkg_preinst,
+# pkg_postinst and pkg_postrm. If set to "true", do nothi= ng.
+if [[ ${CATEGORY} =3D kd= e-frameworks ]]; then
+ : ${E= CM_NONGUI:=3Dtrue}
+fi
+: ${ECM_NONGUI:=3Dfalse}
=
+
+# @ECLASS-VARIABLE: ECM_DEBUG
+# @DESCRIPTION:
+# = Add "debug" to IUSE. If !debug, add -DNDEBUG (via cmake-utils_src_config= ure)
+# and -DQT_NO_DEBUG to = CPPFLAGS. If set to "false", do nothing.
+: ${ECM_DEBUG:=3Dtrue}
+
+# @ECLASS-VARIABLE:= ECM_DESIGNERPLUGIN
+# @DESCR= IPTION:
+# If set to "true", = add "designer" to IUSE to toggle build of designer plugins
+# and add the necessary BDEPEND. If set t= o "false", do nothing.
+: ${E= CM_DESIGNERPLUGIN:=3Dfalse}
+=
+# @ECLASS-VARIABLE: ECM_EXA= MPLES
+# @DESCRIPTION:
+# By default unconditionally ignor= e a top-level examples subdirectory.
+# If set to "true", add "examples" to IUSE to toggle adding tha= t subdirectory.
+: ${ECM_EXAM= PLES:=3Dfalse}
+
+# @ECLASS-VARIABLE: ECM_HANDBOOK
+# @DESCRIPTION:
+# Will accept "true", "false", "optional", "for= ceoptional". If set to "false",
+# do nothing.
+# Otherwis= e, add "+handbook" to IUSE, add the appropriate dependency, and let
<= /div>
+# KF5DocTools generate and insta= ll the handbook from docbook file(s) found in
+# ECM_HANDBOOK_DIR. However if !handbook, disable buil= d of ECM_HANDBOOK_DIR
+# in C= MakeLists.txt.
+# If set to "= optional", build with -DCMAKE_DISABLE_FIND_PACKAGE_KF5DocTools=3DON
<= /div>
+# when !handbook. In case packag= e requires KF5KDELibs4Support, see next:
+# If set to "forceoptional", remove a KF5DocTools dependenc= y from the root
+# CMakeLists= .txt in addition to the above.
+: ${ECM_HANDBOOK:=3Dfalse}
+
+# @ECLASS-VARIABLE: ECM_H= ANDBOOK_DIR
+# @DESCRIPTION:<= br>
+# Specifies the directory co= ntaining the docbook file(s) relative to ${S} to
+# be processed by KF5DocTools (kdoctools_install).<= br>
+: ${ECM_HANDBOOK_DIR:=3Ddoc}=
+
+# @ECLASS-VARIABLE: ECM_PO_DIRS
+# @DESCRIPTION:
+# Specifies directories of l10n files relative to ${S} to be p= rocessed by
+# KF5I18n (ki18n= _install). If IUSE nls exists and is disabled then disable
+# build of these directories in CMakeList= s.txt.
+: ${ECM_PO_DIRS:=3D"p= o poqm"}
+
+# @ECLASS-VARIABLE: ECM_QTHELP
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Default value for all CATEGORIES except kde-frameworks is "false= ".
+# If set to "true", add "= doc" to IUSE, add the appropriate dependency, let
+# -DBUILD_QCH=3DON generate and install Qt compres= sed help files when USE=3Ddoc.
+# If set to "false", do nothing.
+if [[ ${CATEGORY} =3D kde-frameworks ]]; then
+ : ${ECM_QTHELP:=3Dtrue}
+fi
+: $= {ECM_QTHELP:=3Dfalse}
+
+# @ECLASS-VARIABLE: ECM_TEST
<= /div>
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Will accept "true", "false", "optional", "forceoption= al",
+# "forceoptional-recurs= ive".
+# Default value is "fa= lse", except for CATEGORY=3Dkde-frameworks where it is
+# set to "true". If set to "false", do nothin= g.
+# For any other value, ad= d "test" to IUSE and DEPEND on dev-qt/qttest:5.
+# If set to "optional", build with -DCMAKE_DISABLE_F= IND_PACKAGE_Qt5Test=3DON
+# w= hen USE=3D!test.
+# If set to= "forceoptional", punt Qt5Test dependency and ignore "autotests",
+# "test", "tests" subdirs from top= -level CMakeLists.txt when USE=3D!test.
+# If set to "forceoptional-recursive", punt Qt5Test dependen= cies and make
+# autotest(s),= unittest(s) and test(s) subdirs from *any* CMakeLists.txt in
<= div style=3D"font-family:Arial;">+# ${S} and below conditional on BUILD_= TESTING when USE=3D!test. This is always
+# meant as a short-term fix and creates ${T}/${P}-tests-opt= ional.patch to
+# refine and = submit upstream.
+if [[ ${CAT= EGORY} =3D kde-frameworks ]]; then
+ : ${ECM_TEST:=3Dtrue}
+fi
+: ${ECM_TEST:=3Dfalse}<= br>
+
+# @ECLASS-VARIABLE: KFMIN
+# @DESCRIPTION:
+# Minimum version of Frameworks to require. The default value is not = going to
+# be changed unless= we also bump EAPI, which usually implies (rev-)bumping.
+# Version will later be used to differentia= te between KF5/Qt5 and KF6/Qt6.
+: ${KFMIN:=3D5.64.0}
+
+# @ECLASS-VARIABLE: KFSLOT
=
+# @INTERNAL
+# @DESCRIPTION:
+# KDE Frameworks and Qt slot dependency, implied by KFMIN v= ersion.
+: ${KFSLOT:=3D5}
=
+
+case ${ECM_NONGUI} in
+ true) ;;
+ false)
+ # gui applications need bree= ze or oxygen for basic iconset, bug #564838
+ if [[ -n ${_KDE5_ECLASS} ]] ; then
+ RDEPEND+=3D" || (
+ >=3Dkde-frameworks/breeze-icons-${KFMIN}:${KFSL= OT}
+ kde-frameworks/oxyge= n-icons:*
+ )"
+ else
+ RDEPEND+=3D" || (
+ kde-frameworks/breeze-icons:*
+ kde-frameworks/oxygen-icons:*
+ )"
+ fi
+ ;;
+ *)
+ ee= rror "Unknown value for \${ECM_NONGUI}"
+ die "Value ${ECM_NONGUI} is not supported"
+ ;;
+esac
+
+case ${ECM_DEBUG} in
+ true)
+= IUSE+=3D" debug"
+ ;;
<= /div>
+ false) ;;
+ *)
+ = eerror "Unknown value for \${ECM_DEBUG}"
+ die "Value ${ECM_DEBUG} is not supported"
+ ;;
+esac
+
+case ${ECM_DESIGNERPLUGIN} in
+ true)
+ IUSE+=3D" designer"
+ if [[ -n ${_KDE5_ECLASS} ]] ; then
+ BDEPEND+=3D" designer? ( >=3Ddev-qt/designer-5.12.3:${= KFSLOT} )"
+ else
<= div style=3D"font-family:Arial;">+ BDEPEND+=3D" designer? ( dev-qt/des= igner:${KFSLOT} )"
+ fi
<= /div>
+ ;;
+ false) ;;
+= *)
+ eerror "Unknown value = for \${ECM_DESIGNERPLUGIN}"
+= die "Value ${ECM_DESIGNERPLUGIN} is not supported"
+ ;;
+esac
+
+# @ECLASS-VARIABLE: KDE_DESIGNERPLUGIN
+# @DESCRIPTION:
+# If set to "false", do nothing.
+# Otherwise, add "designer" to IUSE to toggle = build of designer plugins
+# = and add the necessary BDEPEND.
+# TODO: drop after KDE Applications 19.08.3 removal
+: ${KDE_DESIGNERPLUGIN:=3Dfalse}
+case ${KDE_DESIGNERPLUGIN} in
<= div style=3D"font-family:Arial;">+ true)
+ IUSE+=3D" designer"
+ BDEPEND+=3D"
+ des= igner? ( >=3Dkde-frameworks/kdesignerplugin-${KFMIN}:${KFSLOT} )
<= /div>
+ "
+ ;;
+ false)= ;;
+ *)
+ eerror "Unknown value for \${KDE_DESIGNERPLUGIN}= "
+ die "Value ${KDE_DESIGNE= RPLUGIN} is not supported"
+ = ;;
+esac
+
+ca= se ${ECM_EXAMPLES} in
+ true)=
+ IUSE+=3D" examples"
+ ;;
+ false) ;;
+ = *)
+ eerror "Unknown value f= or \${ECM_EXAMPLES}"
+ die "= Value ${ECM_EXAMPLES} is not supported"
+ ;;
+esac
+
+case ${ECM_HANDBOOK} in
+ true|optional|forceoptional)
+ IUSE+=3D" +handbook"
+ BDEPEND+=3D" handbook? ( >=3Dkde-frameworks/kdoctools-${KFMIN}:= ${KFSLOT} )"
+ ;;
<= div style=3D"font-family:Arial;">+ false) ;;
+ *)
+ eerro= r "Unknown value for \${ECM_HANDBOOK}"
+ die "Value ${ECM_HANDBOOK} is not supported"
+ ;;
+esac
+
+case ${ECM_QTHELP} in
+ true)
= + IUSE+=3D" doc"
+ if [[ -n= ${_KDE5_ECLASS} ]] ; then
+ = COMMONDEPEND+=3D" doc? ( >=3Ddev-qt/qt-docs-5.12.3:${KFSLOT} )"
=
+ BDEPEND+=3D" >=3Ddev-qt/q= thelp-5.12.3:${KFSLOT} )"
+ = else
+ COMMONDEPEND+=3D" do= c? ( dev-qt/qt-docs:${KFSLOT} )"
+ BDEPEND+=3D" dev-qt/qthelp:${KFSLOT} )"
+ fi
+ B= DEPEND+=3D" doc? ( >=3Dapp-doc/doxygen-1.8.13-r1 )"
+ ;;
+ false) ;;
+ *)
=
+ eerror "Unknown value for \${ECM_QT= HELP}"
+ die "Value ${ECM_QT= HELP} is not supported"
+ ;;=
+esac
+
+case = ${ECM_TEST} in
+ true|optiona= l|forceoptional|forceoptional-recursive)
+ IUSE+=3D" test"
+ if [[ -n ${_KDE5_ECLASS} ]] ; then
+ DEPEND+=3D" test? ( >=3Ddev-qt/qttest-5.12.3:${KFSLOT}= )"
+ else
+ DEPEND+=3D" test? ( dev-qt/qttest:${KFSLOT= } )"
+ fi
+ RESTRICT+=3D" !test? ( test )"
+ ;;
+ false) ;;
+ *)
+ eerror "Unknown value for \${EC= M_TEST}"
+ die "Value ${ECM_= TEST} is not supported"
+ ;;=
+esac
+
+BDEPE= ND+=3D" >=3Dkde-frameworks/extra-cmake-modules-${KFMIN}:${KFSLOT}"
+RDEPEND+=3D" >=3Dkde-framew= orks/kf-env-4"
+if [[ -n ${_K= DE5_ECLASS} ]] ; then
+ COMMO= NDEPEND+=3D" >=3Ddev-qt/qtcore-5.12.3:${KFSLOT}"
+else
+ = COMMONDEPEND+=3D" dev-qt/qtcore:${KFSLOT}"
+fi
+
=
+DEPEND+=3D" ${COMMONDEPEND}"
+RDEPEND+=3D" ${COMMONDEPEND}"
+unset COMMONDEPEND
+
+# @ECLASS-VARIABLE: KDE_GCC_MINIMAL
+# @DEFAULT_UNSET
+#= @DESCRIPTION:
+# Minimum ver= sion of active GCC to require. This is checked in
+# ecm_pkg_pretend and ecm_pkg_setup.
+
+# @FUNCTION: _ecm_check_gcc_version
+# @INTERNAL
+# @D= ESCRIPTION:
+# Determine if t= he current GCC version is acceptable, otherwise die.
+_ecm_check_gcc_version() {
+ if [[ ${MERGE_TYPE} !=3D binary && -v KDE= _GCC_MINIMAL ]] && tc-is-gcc; then
+
+ local vers= ion=3D$(gcc-version)
+
+ debug-print "GCC version check a= ctivated"
+ debug-print "Ver= sion detected: ${version}"
+ = debug-print "Version required: ${KDE_GCC_MINIMAL}"
+
+ ver= _test ${version} -lt ${KDE_GCC_MINIMAL} &&
+ die "Sorry, but gcc-${KDE_GCC_MINIMAL} or later= is required for this package (found ${version})."
+ fi
+}<= br>
+
+# @FUNCTION: _ecm_strip_handbook_translations
=
+# @INTERNAL
+# @DESCRIPTION:
+# If LINGUAS is defined, enable only the requested translations w= hen required.
+_ecm_strip_han= dbook_translations() {
+ if != [[ -v LINGUAS ]]; then
+ re= turn
+ fi
+
+ l= ocal lang po
+ for po in ${EC= M_PO_DIRS}; do
+ if [[ -d ${= po} ]] ; then
+ pushd ${po}= > /dev/null || die
+ lo= cal lang
+ for lang in *; d= o
+ if [[ -e ${lang} ]] &a= mp;& ! has ${lang/.po/} ${LINGUAS} ; then
+ case ${lang} in
+ cmake_modules | \
+ CMakeLists.txt | \
+ ${PN}.pot) ;;
+ = *) rm -r ${lang} || die ;;
= + esac
+ if [[ -e CMa= keLists.txt ]] ; then
+ = cmake_comment_add_subdirectory ${lang}
+ sed -e "/add_subdirectory([[:space:]]*${lang}\/.*[[:spa= ce:]]*)/d" \
+ -i CMake= Lists.txt || die
+ fi
=
+ fi
+ done
+= popd > /dev/null || die
+ fi
+ done
+}
+
+# @FUNCTION: ecm_punt_bo= gus_dep
+# @USAGE: <prefix= > <dependency>
+# @D= ESCRIPTION:
+# Removes a spec= ified dependency from a find_package call with multiple
+# components.
+ecm_punt_bogus_dep() {
+ local prefix=3D${1}
+ local dep=3D${2}
+
+ if [[ ! -e "CMakeLists.txt" ]]; th= en
+ return
+ fi
+
+ pcregrep -Mni "(?s)fin= d_package\s*\(\s*${prefix}[^)]*?${dep}.*?\)" CMakeLists.txt > "${T}/b= ogus${dep}"
+
+ # pcregrep returns non-zero on no matches/= error
+ if [[ $? -ne 0 ]] ; t= hen
+ return
+ fi
+
+ local length=3D$(wc -= l "${T}/bogus${dep}" | cut -d " " -f 1)
+ local first=3D$(head -n 1 "${T}/bogus${dep}" | cut -d ":" -= f 1)
+ local last=3D$(( lengt= h + first - 1))
+
+ sed -e "${first},${last}s/${dep}//" -i= CMakeLists.txt || die
+
<= /div>
+ if [[ ${length} -eq 1 ]] ; then=
+ sed -e "/find_package\s*(= \s*${prefix}\(\s\+\(REQUIRED\|CONFIG\|COMPONENTS\|\${[A-Z0-9_]*}\)\)\+\s= *)/Is/^/# removed by ecm.eclass - /" -i CMakeLists.txt || die
<= div style=3D"font-family:Arial;">+ fi
+}
+
+# @FUNCTION: ecm_pkg_pretend
+# @DESCRIPTION:
+# Checks if the active compiler meets the minimum vers= ion requirements.
+# phase fu= nction is only exported if KDE_GCC_MINIMAL is defined.
+ecm_pkg_pretend() {
+ debug-print-function ${FUNCNAME} "$@"
+ _ecm_check_gcc_version
+}
+=
+# @FUNCTION: ecm_pkg_setup<= br>
+# @DESCRIPTION:
+# Checks if the active compiler meets th= e minimum version requirements.
+ecm_pkg_setup() {
+ debug= -print-function ${FUNCNAME} "$@"
+ _ecm_check_gcc_version
= +}
+
+# @FUNCTION: ecm_src_prepare
+# @DESCRIPTION:
+# Wrapper for cmake-utils_src_prepare with lots of extra logic = for magic
+# handling of ling= uas, tests, handbook etc.
+ec= m_src_prepare() {
+ debug-pri= nt-function ${FUNCNAME} "$@"
= +
+ cmake-utils_src_prepare
+
+ # only build examples when required
+ if ! { in_iuse examples && use example= s; } ; then
+ cmake_comment_= add_subdirectory examples
+ f= i
+
+ # only enable handbook when required
+ if in_iuse handbook && ! use handb= ook ; then
+ cmake_comment_a= dd_subdirectory ${ECM_HANDBOOK_DIR}
+
+ if [[ ${ECM_HANDB= OOK} =3D forceoptional ]] ; then
+ punt_bogus_dep KF5 DocTools
+ sed -i -e "/kdoctools_install/ s/^/#DONT/" CMakeLists.txt || = die
+ fi
+ fi
= +
+ # drop translations when = nls is not wanted
+ if in_ius= e nls && ! use nls ; then
+ local po
+ for po in= ${ECM_PO_DIRS}; do
+ rm -r= f ${po} || die
+ done
+ fi
+
+ # don't chan= ge behaviour for kde5.eclass consumers
+ # for ported ebuilds, limit playing field of this to kde-*/ = categories
+ if [[ -n ${_KDE5= _ECLASS} ]] ; then
+ _ecm_st= rip_handbook_translations # TODO: kde5.eclass cleanup
+ elif [[ ${CATEGORY} =3D kde-* ]] ; then
+ # always install unconditionall= y for kconfigwidgets - if you use
+ # language X as system language, and there is a combobox with la= nguage
+ # names, the transl= ated language name for language Y is taken from
+ # /usr/share/locale/Y/kf5_entry.desktop
<= div style=3D"font-family:Arial;">+ [[ ${PN} !=3D kconfigwidgets ]] &= ;& _ecm_strip_handbook_translations
+ fi
+
+ # only build unit tests when required<= br>
+ if ! { in_iuse test &&a= mp; use test; } ; then
+ if = [[ ${ECM_TEST} =3D forceoptional ]] ; then
+ punt_bogus_dep Qt5 Test
+ # if forceoptional, also cover non-kde categories
+ cmake_comment_add_subdirectory= autotests test tests
+ elif= [[ ${ECM_TEST} =3D forceoptional-recursive ]] ; then
+ punt_bogus_dep Qt5 Test
+ local f pf=3D"${T}/${P}"-tests-optional.patc= h
+ touch ${pf} || die "Fai= led to touch patch file"
+ = for f in $(find . -type f -name "CMakeLists.txt" -exec \
+ grep -l "^\s*add_subdirectory\s*\(\s*.*= \(auto|unit\)\?tests\?\s*)\s*\)" {} \;); do
+ cp ${f} ${f}.old || die "Failed to prepare patch ori= gfile"
+ pushd ${f%/*} >= ; /dev/null || die
+ punt= _bogus_dep Qt5 Test
+ sed= -i CMakeLists.txt -e \
+ = "/^#/! s/add_subdirectory\s*\(\s*.*\(auto|unit\)\?tests\?\s*)\s*\)/if(= BUILD_TESTING)\n&\nendif()/" \
+ || die
+ popd= > /dev/null || die
+ d= iff -Naur ${f}.old ${f} 1>>${pf}
+ rm ${f}.old || die "Failed to clean up"
+ done
+ eqawarn "Build system was modified by ECM_TEST=3Dforceoptional= -recursive."
+ eqawarn "Uni= fied diff file ready for pickup in:"
+ eqawarn "  ${pf}"
+ eqawarn "Push it upstream to make this message go away."
+ elif [[ ${CATEGORY} =3D kde-fra= meworks || ${CATEGORY} =3D kde-plasma || ${CATEGORY} =3D kde-apps ]] ; t= hen
+ cmake_comment_add_sub= directory autotests test tests
+ fi
+ fi
+
= + # in frameworks, tests =3D manual tests so never build them
<= div style=3D"font-family:Arial;">+ if [[ ${CATEGORY} =3D kde-frameworks = ]] && [[ ${PN} !=3D extra-cmake-modules ]]; then
+ cmake_comment_add_subdirectory tests
<= /div>
+ fi
+}
+
=
+# @FUNCTION: ecm_src_configure
+# @DESCRIPTION:
+# Wrapper for cmake-utils_src_configure with e= xtra logic for magic handling of
+# handbook, tests etc.
+= ecm_src_configure() {
+ debug= -print-function ${FUNCNAME} "$@"
+
+ # we rely on cmake-ut= ils.eclass to append -DNDEBUG too
+ if in_iuse debug && ! use debug; then
+ append-cppflags -DQT_NO_DEBUG
+ fi
+
+ local cmakeargs
+
+ if in_iuse test && ! use test ; then
+ cmakeargs+=3D( -DBUILD_TESTING=3DOFF )
+
+ if [[ ${ECM_TEST} =3D optional ]] ; then
+ cmakeargs+=3D( -DCMAKE_DISABLE_FIND_PA= CKAGE_Qt5Test=3DON )
+ fi
+ fi
+
+ if [[ ${= ECM_HANDBOOK} =3D optional ]] ; then
+ cmakeargs+=3D( -DCMAKE_DISABLE_FIND_PACKAGE_KF5DocTools=3D$(u= sex handbook) )
+ fi
+
+ if in_iuse designer && [[ ${ECM_DESIGNERPLUGIN} =3D tr= ue ]]; then
+ cmakeargs+=3D(= -DBUILD_DESIGNERPLUGIN=3D$(usex designer) )
+ fi
+
+ # TODO: drop after KDE Applicatio= ns 19.08.3 removal
+ if in_iu= se designer && [[ ${KDE_DESIGNERPLUGIN} !=3D false ]] ; then
=
+ cmakeargs+=3D( $(cmake-utils_= use_find_package designer KF5DesignerPlugin) )
+ fi
+
<= /div>
+ if [[ ${ECM_QTHELP} =3D true ]]= ; then
+ cmakeargs+=3D( -DBU= ILD_QCH=3D$(usex doc) )
+ fi<= br>
+
+ if [[ ${ECM_KDEINSTALLDIRS} =3D true ]] ; then
+ cmakeargs+=3D(
+ # install mkspecs in the same directory as = Qt stuff
+ -DKDE_INSTALL_US= E_QT_SYS_PATHS=3DON
+ # mov= e handbook outside of doc dir, bug 667138
+ -DKDE_INSTALL_DOCBUNDLEDIR=3D"${EPREFIX}/usr/share/help= "
+ )
+ fi
+
+ # allow the ebuild to overri= de what we set here
+ mycmake= args=3D("${cmakeargs[@]}" "${mycmakeargs[@]}")
+
+ cmake-u= tils_src_configure
+}
+
+# @FUNCTION: ecm_src_compile
+# @DESCRIPTION:
+#= Wrapper for cmake-utils_src_compile. Currently doesn't do anything extr= a, but
+# is included as part= of the API just in case it's needed in the future.
+ecm_src_compile() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ c= make-utils_src_compile "$@"
+= }
+
+# @FUNCTION: ecm_src_test
+# @DESCRIPTION:
+# Wrapper for cmake-utils_src_test with extra logic for magic handl= ing of dbus
+# and virtualx.<= br>
+ecm_src_test() {
+ debug-print-function ${FUNCNAME} "$@"<= br>
+
+ _test_runner() {
+ if [[ -n "${VIRTUALDBUS_TEST}" ]]; then
+ export $(dbus-launch)
+ fi
+
<= /div>
+ cmake-utils_src_test
=
+ }
+
+ # When run as no= rmal user during ebuild development with the ebuild command,
+ # tests tend to access the session DBU= S. This however is not possible in a
+ # real emerge or on the tinderbox.
+ # make sure it does not happen, so bad tests can be re= cognized and disabled
+ unset= DBUS_SESSION_BUS_ADDRESS DBUS_SESSION_BUS_PID
+
+ if [[ $= {VIRTUALX_REQUIRED} =3D always || ${VIRTUALX_REQUIRED} =3D test ]]; then=
+ virtx _test_runner
+ else
+ _test_runner
+ fi
+
+ if [[ -n "${DBUS_SESSION_BUS_PID}" ]] ; then
<= /div>
+ kill ${DBUS_SESSION_BUS_PID}
+ fi
+}
+
+# @FUNCTION: ecm_src_install
+# @DESCRIPTION:
+# Wrapper for cmake-utils_src_install. Curren= tly doesn't do anything extra, but
+# is included as part of the API just in case it's needed in the = future.
+ecm_src_install() {<= br>
+ debug-print-function ${FUNC= NAME} "$@"
+
+ cmake-utils_src_install
+}
+<= br>
+# @FUNCTION: ecm_pkg_preinst=
+# @DESCRIPTION:
+# Sets up environment variables require= d in ecm_pkg_postinst.
+ecm_p= kg_preinst() {
+ debug-print-= function ${FUNCNAME} "$@"
+
+ case ${ECM_NONGUI} in
+ false) xdg_pkg_preinst ;;
+ *) ;;
+ esac
+}
+
+# @FUNCTION: ecm_pkg_postinst
+# @DESCRIPTION:
+# Updates the various XDG caches (icon, desktop, mime) if necessary= .
+ecm_pkg_postinst() {
+ debug-print-function ${FUNCNAME}= "$@"
+
+ case ${ECM_NONGUI} in
+ false) xdg_pkg_postinst ;;
+ *) ;;
+ e= sac
+
+ if [[ -n ${_KDE_ORG_ECLASS} ]] && [[ -z ${= I_KNOW_WHAT_I_AM_DOING} ]] && [[ ${KDE_BUILD_TYPE} =3D live ]]; = then
+ einfo "WARNING! This = is an experimental live ebuild of ${CATEGORY}/${PN}"
+ einfo "Use it at your own risk."
+ einfo "Do _NOT_ file bugs at bugs.gent= oo.org because of this ebuild!"
+ fi
+}
+
+#= @FUNCTION: ecm_pkg_postrm
+#= @DESCRIPTION:
+# Updates the= various XDG caches (icon, desktop, mime) if necessary.
+ecm_pkg_postrm() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ case ${ECM_NONGUI} in
+ = false) xdg_pkg_postrm ;;
+ *= ) ;;
+ esac
+}
= +
+fi


Attachments:
  • signature.asc

--1425828ac439486cb96f36ec1d6b20a8--