Skip to contentSkip to conversation

pocketpy: disable CMake Unity build to fix buildpaths QA warnings

PATCH New Khem Raj 1 participant 2 messages Sep 27

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/2 pocketpy: disable CMake Unity build to fix buildpaths QA warnings

pocketpy's upstream CMakeLists.txt defaults PK_BUILD_WITH_UNITY to ON for CMake >= 3.16, which makes CMake generate a synthetic translation unit (Unity/unity_pocketpy_c.c) that #includes every source file by its absolute build-tree path. That generated file gets copied verbatim into the pocketpy-src package's /usr/src/debug tree, so its embedded paths trip the buildpaths QA check for both TMPDIR and the build host's HOME directory.

Setting OEQA_BUILDPATHS_SKIP as suggested in the warning text would only silence the HOME-directory half of the check; TMPDIR has no skip mechanism in insane.bbclass and would keep firing. Instead, disable the Unity build via -DPK_BUILD_WITH_UNITY=OFF so CMake emits normal per-file translation units with no absolute paths in their contents.

AI-Generated: Uses Claude Code

---
 meta-oe/recipes-devtools/pocketpy/pocketpy_2.1.8.bb | 1 +
 1 file changed, 1 insertion(+)
meta-oe/recipes-devtools/pocketpy/pocketpy_2.1.8.bb +1 -0
index 910deba386..7f3775941a 100644
@@ -21,6 +21,7 @@ inherit cmake
 
 EXTRA_OECMAKE = "\
     -DPK_ENABLE_OS=ON \
+    -DPK_BUILD_WITH_UNITY=OFF \
 "
 
 CFLAGS += "-fPIC"
author
#1 lore raw

PATCH 2/2 opencv: rewrite build-tree paths in all CPU-dispatch stub files

The recipe already rewrote the absolute ${S} path embedded in two PowerPC VSX3 dispatch stubs (arithm.vsx3.cpp, convert.vsx3.cpp) before packaging, but OpenCV's cmake ocv_add_dispatched_file() macro generates one such stub per enabled ISA in every module (avx, avx2, avx512_skx, sse4_1, sse4_2, ...). On x86-64-v3 that produced 69 more stub files under ${B}/modules/* whose #include lines still embedded the raw build-tree path, tripping the buildpaths QA check (TMPDIR and HOME) once copied verbatim into the opencv-src package.

OEQA_BUILDPATHS_SKIP would only silence the HOME-directory half of the check; TMPDIR has no skip mechanism in insane.bbclass. Generalize the existing sed-based rewrite to find and fix every generated dispatch stub under ${B}/modules, instead of a hardcoded two-file list, so any ISA/module combination is covered.

AI-Generated: Uses Claude Code

---
 meta-oe/recipes-support/opencv/opencv_4.14.0.bb | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
meta-oe/recipes-support/opencv/opencv_4.14.0.bb +2 -4
index 286b490870..7cc487c0ce 100644
@@ -214,10 +214,8 @@ do_install:append() {
         rm -rf ${D}${bindir}/setup_vars_opencv4.sh
     fi
 
-    for fn in arithm.vsx3.cpp convert.vsx3.cpp; do
-        if [ -f ${B}/modules/core/$fn ]; then
-            sed -i -e 's,${S},/usr/src/debug/${PN}/${PV},g' ${B}/modules/core/$fn
-        fi
+    find ${B}/modules -name "*.cpp" | xargs -r grep -l "${S}" | while read -r fn; do
+        sed -i -e 's,${S},/usr/src/debug/${PN}/${PV},g' "$fn"
     done
 
     if [ -d ${D}/${bindir}/shape ]; then