Skip to contentSkip to conversation

glog: Support building for native

PATCH In review Peter Kjellerstedt 3 participants 4 messages Sep 27, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 glog: Support building for native

This is needed to build opencv-native.

---
 meta-oe/recipes-support/glog/glog_0.7.1.bb | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
meta-oe/recipes-support/glog/glog_0.7.1.bb +2 -1
index 570d9a7e5f..6a649325a0 100644
@@ -12,7 +12,6 @@ SRC_URI = " \
 
 SRCREV = "7b134a5c82c0c0b5698bb6bf7a835b230c5638e4"
 
-
 inherit cmake
 
 PACKAGECONFIG ?= "shared unwind 64bit-atomics"
@@ -39,3 +38,5 @@ do_configure:append() {
 }
 
 FILES:${PN}-dev += "${datadir}/${BPN}/cmake"
+
+BBCLASSEXTEND = "native"
#1 lore raw

PATCH 2/2 opencv: Support building for native

---
 meta-oe/recipes-support/opencv/opencv_4.12.0.bb | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
meta-oe/recipes-support/opencv/opencv_4.12.0.bb +10 -5
index d1ab87b06f..27499caa92 100644
@@ -200,11 +200,6 @@ do_install:append() {
         mv ${D}/usr/lib/* ${D}/${libdir}/
         rm -rf ${D}/usr/lib
     fi
-    # remove build host path to improve reproducibility
-    if [ -f ${D}${libdir}/cmake/opencv4/OpenCVModules.cmake ]; then
-        sed -e 's@${STAGING_DIR_HOST}@@g' \
-            -i ${D}${libdir}/cmake/opencv4/OpenCVModules.cmake
-    fi
     # remove setup_vars_opencv4.sh as its content is confusing and useless
     if [ -f ${D}${bindir}/setup_vars_opencv4.sh ]; then
         rm -rf ${D}${bindir}/setup_vars_opencv4.sh
@@ -222,3 +217,13 @@ do_install:append() {
         mv ${D}/${bindir}/shape ${D}/${bindir}/opencv_shape
     fi
 }
+
+do_install:append:class-target() {
+    # remove build host path to improve reproducibility
+    if [ -f ${D}${libdir}/cmake/opencv4/OpenCVModules.cmake ]; then
+        sed -e 's@${STAGING_DIR_HOST}@@g' \
+            -i ${D}${libdir}/cmake/opencv4/OpenCVModules.cmake
+    fi
+}
+
+BBCLASSEXTEND = "native"
#2 lore raw

Re: [oe] [meta-oe][PATCH 2/2] opencv: Support building for native

I am curious what’s the use case ?

Quoted 48 lines · Peter Kjellerstedt via lists.openembedded.org
---
 meta-oe/recipes-support/opencv/opencv_4.12.0.bb | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
meta-oe/recipes-support/opencv/opencv_4.12.0.bb +10 -6
index d1ab87b06f..27499caa92 100644
@@ -200,11 +200,6 @@ do_install:append() {
         mv ${D}/usr/lib/* ${D}/${libdir}/
         rm -rf ${D}/usr/lib
     fi
-    # remove build host path to improve reproducibility
-    if [ -f ${D}${libdir}/cmake/opencv4/OpenCVModules.cmake ]; then
-        sed -e 's@${STAGING_DIR_HOST}@@g' \
-            -i ${D}${libdir}/cmake/opencv4/OpenCVModules.cmake
-    fi
     # remove setup_vars_opencv4.sh as its content is confusing and useless
     if [ -f ${D}${bindir}/setup_vars_opencv4.sh ]; then
         rm -rf ${D}${bindir}/setup_vars_opencv4.sh
@@ -222,3 +217,13 @@ do_install:append() {
         mv ${D}/${bindir}/shape ${D}/${bindir}/opencv_shape
     fi
 }
+
+do_install:append:class-target() {
+    # remove build host path to improve reproducibility
+    if [ -f ${D}${libdir}/cmake/opencv4/OpenCVModules.cmake ]; then
+        sed -e 's@${STAGING_DIR_HOST}@@g' \
+            -i ${D}${libdir}/cmake/opencv4/OpenCVModules.cmake
+    fi
+}
+
+BBCLASSEXTEND = "native"
 
-=-=-=-=-=-=-=-=-=-=-=-

Links: You receive all messages sent to this group. View/Reply Online (#119949):
https://lists.openembedded.org/g/openembedded-devel/message/119949
Mute This Topic: https://lists.openembedded.org/mt/115460185/1997914
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#3 lore raw

RE: [oe] [meta-oe][PATCH 2/2] opencv: Support building for native

We have this (in my opinion) weird unit test system for our own recipes that relies on building the unit tests as a subclass of native, which means the recipe’s dependencies also need to be built for native. Normally we can just add a bbappend with a BBCLASSEXTEND if an upstream recipe does not support building for native out of the box. However, in this case due to the sed expression that removes ${STAGING_DIR_HOST} this does not work because ${STAGING_DIR_HOST} is empty for native and then sed fails. Since this is in a do_install:append, there is no way for me to solve this easily in our own layer. Thus the easiest solution is to solve it in meta-oe.

//Peter

From: Khem Raj <[email protected]>
Sent: den 27 september 2025 06:34
To: Peter Kjellerstedt <[email protected]>
Cc: [email protected]
Subject: Re: [oe] [meta-oe][PATCH 2/2] opencv: Support building for native

I am curious what’s the use case ?

On Fri, Sep 26, 2025 at 7:47 PM Peter Kjellerstedt via lists.openembedded.org<http://lists.openembedded.org> <[email protected]<mailto:[email protected]>> wrote:

---
 meta-oe/recipes-support/opencv/opencv_4.12.0.bb<http://opencv_4.12.0.bb> | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
meta-oe/recipes-support/opencv/opencv_4.12.0.bb<http://opencv_4.12.0.bb> +10 -5
index d1ab87b06f..27499caa92 100644
@@ -200,11 +200,6 @@ do_install:append() {
         mv ${D}/usr/lib/* ${D}/${libdir}/
         rm -rf ${D}/usr/lib
     fi
-    # remove build host path to improve reproducibility
-    if [ -f ${D}${libdir}/cmake/opencv4/OpenCVModules.cmake ]; then
-        sed -e 's@${STAGING_DIR_HOST}@@g' \
-            -i ${D}${libdir}/cmake/opencv4/OpenCVModules.cmake
-    fi
     # remove setup_vars_opencv4.sh as its content is confusing and useless
     if [ -f ${D}${bindir}/setup_vars_opencv4.sh ]; then
         rm -rf ${D}${bindir}/setup_vars_opencv4.sh
@@ -222,3 +217,13 @@ do_install:append() {
         mv ${D}/${bindir}/shape ${D}/${bindir}/opencv_shape
     fi
 }
+
+do_install:append:class-target() {
+    # remove build host path to improve reproducibility
+    if [ -f ${D}${libdir}/cmake/opencv4/OpenCVModules.cmake ]; then
+        sed -e 's@${STAGING_DIR_HOST}@@g' \
+            -i ${D}${libdir}/cmake/opencv4/OpenCVModules.cmake
+    fi
+}
+
+BBCLASSEXTEND = "native"

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#119949): https://lists.openembedded.org/g/openembedded-devel/message/119949
Mute This Topic: https://lists.openembedded.org/mt/115460185/1997914
Group Owner: [email protected]<mailto:openembedded-devel%[email protected]>
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]<mailto:[email protected]>]
-=-=-=-=-=-=-=-=-=-=-=-