commit: 2b32cb0d67222da271e2ae25b19479f0374648da
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Jun 26 09:54:06 2023 +0000
Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Sat Sep 16 15:03:30 2023 +0000
URL: https://gitweb.gentoo.org/proj/kde.git/commit/?id=2b32cb0d
cmake.eclass: workaround S=${WORKDIR} creating builddir above ${WORKDIR}
When S=${WORKDIR}, cmake.eclass would create its build directory (if
CMAKE_USE_DIR
is unset) above WORKDIR(!) as ${WORKDIR}_build. Creating directories above
WORKDIR is not legal.
Portage has its own bug (bug #889418) in that it doesn't clean up unknown
directories
above WORKDIR in PORTAGE_TMPDIR, so combined, you get a problem where "ebuild
... clean" doesn't
actually clean things up at all, and you get very confusing issues if e.g.
changing
CC between runs.
The explicit S=WORKDIR check isn't truly needed but it makes explicit our
intent here.
Bug: https://bugs.gentoo.org/889418
Closes: https://bugs.gentoo.org/889420
Signed-off-by: Sam James <sam <AT> gentoo.org>
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>
eclass/cmake.eclass | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/eclass/cmake.eclass b/eclass/cmake.eclass
index 340645e917..91cbf976bb 100644
--- a/eclass/cmake.eclass
+++ b/eclass/cmake.eclass
@@ -216,6 +216,15 @@ _cmake_check_build_dir() {
BUILD_DIR="${CMAKE_USE_DIR}"
else
: "${BUILD_DIR:=${CMAKE_USE_DIR}_build}"
+
+ # Avoid creating ${WORKDIR}_build (which is above WORKDIR).
+ # TODO: For EAPI > 8, we should ban S=WORKDIR for CMake.
+ # See bug #889420.
+ if [[ ${S} == "${WORKDIR}" && ${BUILD_DIR} ==
"${WORKDIR}_build" ]] ; then
+ eqawarn "QA notice: S=WORKDIR is deprecated for
cmake.eclass."
+ eqawarn "Please relocate the sources in src_unpack."
+ BUILD_DIR="${WORKDIR}"/${P}_build
+ fi
fi
einfo "Source directory (CMAKE_USE_DIR): \"${CMAKE_USE_DIR}\""