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 EAE691580B9 for ; Sat, 21 Aug 2021 13:11:37 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 07CECE08BD; Sat, 21 Aug 2021 13:11:37 +0000 (UTC) Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (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 D5E4EE08BD for ; Sat, 21 Aug 2021 13:11:36 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 41ACF342A7A for ; Sat, 21 Aug 2021 13:11:34 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 203887B2 for ; Sat, 21 Aug 2021 13:11:32 +0000 (UTC) From: "Andreas Sturmlechner" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Andreas Sturmlechner" Message-ID: <1629551411.ca79336c00701b0f0981adf57e2e0f6e614c3a0e.asturm@gentoo> Subject: [gentoo-commits] proj/kde:master commit in: eclass/ X-VCS-Repository: proj/kde X-VCS-Files: eclass/cmake.eclass X-VCS-Directories: eclass/ X-VCS-Committer: asturm X-VCS-Committer-Name: Andreas Sturmlechner X-VCS-Revision: ca79336c00701b0f0981adf57e2e0f6e614c3a0e X-VCS-Branch: master Date: Sat, 21 Aug 2021 13:11:32 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: c950830c-36e7-4943-b429-3de8f2cadaec X-Archives-Hash: 6b0f49751c9d478d65f44ac594dc81ea commit: ca79336c00701b0f0981adf57e2e0f6e614c3a0e Author: Andreas Sturmlechner gentoo org> AuthorDate: Sun Jul 18 11:25:20 2021 +0000 Commit: Andreas Sturmlechner gentoo org> CommitDate: Sat Aug 21 13:10:11 2021 +0000 URL: https://gitweb.gentoo.org/proj/kde.git/commit/?id=ca79336c cmake.eclass: Support EAPI-8 Switch to using current working directory instead of ${S} when initializing ${CMAKE_USE_DIR} and ${BUILD_DIR}. Raise baseline cmake version to 3.20. Bug: https://bugs.gentoo.org/704524 Thanks-to: Arfrever Frehtes Taifersar Arahesis Apache.Org> Signed-off-by: Andreas Sturmlechner gentoo.org> eclass/cmake.eclass | 81 ++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 55 insertions(+), 26 deletions(-) diff --git a/eclass/cmake.eclass b/eclass/cmake.eclass index 05556e49f1..b78441bfaa 100644 --- a/eclass/cmake.eclass +++ b/eclass/cmake.eclass @@ -9,7 +9,7 @@ # Maciej Mrozowski # (undisclosed contributors) # Original author: Zephyrus (zephyrus@mirach.it) -# @SUPPORTED_EAPIS: 7 +# @SUPPORTED_EAPIS: 7 8 # @BLURB: common ebuild functions for cmake-based packages # @DESCRIPTION: # The cmake eclass makes creating ebuilds for cmake-based packages much easier. @@ -17,8 +17,8 @@ # out-of-source builds (default), in-source builds and an implementation of the # well-known use_enable function for CMake. -case ${EAPI:-0} in - 7) ;; +case ${EAPI} in + 7|8) ;; *) die "EAPI=${EAPI:-0} is not supported" ;; esac @@ -28,12 +28,14 @@ if [[ -z ${_CMAKE_ECLASS} ]]; then _CMAKE_ECLASS=1 # @ECLASS-VARIABLE: BUILD_DIR +# @DEFAULT_UNSET # @DESCRIPTION: # Build directory where all cmake processed files should be generated. # For in-source build it's fixed to ${CMAKE_USE_DIR}. # For out-of-source build it can be overridden, by default it uses -# ${WORKDIR}/${P}_build. -: ${BUILD_DIR:=${WORKDIR}/${P}_build} +# ${CMAKE_USE_DIR}_build (in EAPI-7: ${WORKDIR}/${P}_build). +[[ ${EAPI} == 7 ]] && : ${BUILD_DIR:=${WORKDIR}/${P}_build} +# EAPI-8: set inside _cmake_check_build_dir # @ECLASS-VARIABLE: CMAKE_BINARY # @DESCRIPTION: @@ -65,16 +67,16 @@ _CMAKE_ECLASS=1 # @ECLASS-VARIABLE: CMAKE_REMOVE_MODULES_LIST # @DESCRIPTION: -# Space-separated list of CMake modules that will be removed in $S during -# src_prepare, in order to force packages to use the system version. -# Set to empty to disable removing modules entirely. +# Space-separated list of CMake modules to be removed in ${CMAKE_USE_DIR} +# (in EAPI-7: ${S}) during src_prepare, in order to force packages to use the +# system version. Set to empty to disable removing modules entirely. : ${CMAKE_REMOVE_MODULES_LIST:=FindBLAS FindLAPACK} # @ECLASS-VARIABLE: CMAKE_USE_DIR # @DESCRIPTION: # Sets the directory where we are working with cmake, for example when # application uses autotools and only one plugin needs to be done by cmake. -# By default it uses ${S}. +# By default it uses current working directory (in EAPI-7: ${S}). # @ECLASS-VARIABLE: CMAKE_VERBOSE # @DESCRIPTION: @@ -100,9 +102,9 @@ _CMAKE_ECLASS=1 # @USER_VARIABLE # @DEFAULT_UNSET # @DESCRIPTION: -# After running cmake_src_prepare, sets ${S} to read-only. This is -# a user flag and should under _no circumstances_ be set in the ebuild. -# Helps in improving QA of build systems that write to source tree. +# After running cmake_src_prepare, sets ${CMAKE_USE_DIR} (in EAPI-7: ${S}) to +# read-only. This is a user flag and should under _no circumstances_ be set in +# the ebuild. Helps in improving QA of build systems that write to source tree. inherit toolchain-funcs ninja-utils flag-o-matic multiprocessing xdg-utils @@ -127,7 +129,7 @@ case ${CMAKE_MAKEFILE_GENERATOR} in esac if [[ ${PN} != cmake ]]; then - BDEPEND+=" dev-util/cmake" + BDEPEND+=" >=dev-util/cmake-3.20" fi # @FUNCTION: cmake_run_in @@ -264,14 +266,22 @@ cmake-utils_useno() { _cmake_banned_func "" "$@" ; } # @DESCRIPTION: # Determine using IN or OUT source build _cmake_check_build_dir() { - : ${CMAKE_USE_DIR:=${S}} + if [[ ${EAPI} == 7 ]]; then + : ${CMAKE_USE_DIR:=${S}} + else + : ${CMAKE_USE_DIR:=${PWD}} + fi if [[ -n ${CMAKE_IN_SOURCE_BUILD} ]]; then # we build in source dir BUILD_DIR="${CMAKE_USE_DIR}" + else + : ${BUILD_DIR:=${CMAKE_USE_DIR}_build} fi + einfo "Source directory (CMAKE_USE_DIR): \"${CMAKE_USE_DIR}\"" + einfo "Build directory (BUILD_DIR): \"${BUILD_DIR}\"" + mkdir -p "${BUILD_DIR}" || die - einfo "Working in BUILD_DIR: \"$BUILD_DIR\"" } # @FUNCTION: _cmake_modify-cmakelists @@ -320,12 +330,14 @@ _cmake_modify-cmakelists() { cmake_src_prepare() { debug-print-function ${FUNCNAME} "$@" - # FIXME: workaround from cmake-utils; use current working directory instead, bug #704524 - # esp. test with 'special' pkgs like: app-arch/brotli, media-gfx/gmic, net-libs/quiche - pushd "${S}" > /dev/null || die + if [[ ${EAPI} == 7 ]]; then + pushd "${S}" > /dev/null || die # workaround from cmake-utils + # in EAPI-8, we use current working directory instead, bug #704524 + # esp. test with 'special' pkgs like: app-arch/brotli, media-gfx/gmic, net-libs/quiche + fi + _cmake_check_build_dir default_src_prepare - _cmake_check_build_dir # check if CMakeLists.txt exist and if no then die if [[ ! -e ${CMAKE_USE_DIR}/CMakeLists.txt ]] ; then @@ -351,17 +363,28 @@ cmake_src_prepare() { local name for name in "${modules_list[@]}" ; do - find "${S}" -name ${name}.cmake -exec rm -v {} + || die + if [[ ${EAPI} == 7 ]]; then + find "${S}" -name ${name}.cmake -exec rm -v {} + || die + else + find -name "${name}.cmake" -exec rm -v {} + || die + fi done # Remove dangerous things. _cmake_modify-cmakelists - popd > /dev/null || die + if [[ ${EAPI} == 7 ]]; then + popd > /dev/null || die + fi - # make ${S} read-only in order to detect broken build-systems + # Make ${CMAKE_USE_DIR} (in EAPI-7: ${S}) read-only in order to detect + # broken build systems. if [[ ${CMAKE_QA_SRC_DIR_READONLY} && ! ${CMAKE_IN_SOURCE_BUILD} ]]; then - chmod -R a-w "${S}" + if [[ ${EAPI} == 7 ]]; then + chmod -R a-w "${S}" + else + chmod -R a-w "${CMAKE_USE_DIR}" + fi fi _CMAKE_SRC_PREPARE_HAS_RUN=1 @@ -657,9 +680,15 @@ cmake_src_install() { die "died running ${CMAKE_MAKEFILE_GENERATOR} install" popd > /dev/null || die - pushd "${S}" > /dev/null || die - einstalldocs - popd > /dev/null || die + if [[ ${EAPI} == 7 ]]; then + pushd "${S}" > /dev/null || die + einstalldocs + popd > /dev/null || die + else + pushd "${CMAKE_USE_DIR}" > /dev/null || die + einstalldocs + popd > /dev/null || die + fi } fi