diff mbox series

[meta-oe,PATCHv2] wifi-test-suite: Fix compile issue

Message ID 20250623125608.152348-1-alperyasinak1@gmail.com
State New
Headers show
Series [meta-oe,PATCHv2] wifi-test-suite: Fix compile issue | expand

Commit Message

Alper Ak June 23, 2025, 12:56 p.m. UTC
- Variables such as CC, CXX and related variables are usually assigned in core class like gcc.bbclass. For example, CC is assigned this specific value:

CC = "${CCACHE}${HOST_PREFIX}gcc ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}"

If you use the += operator to add flags to the CC variable early in your recipe, your changes will be overwritten and lost because BitBake applies class assignments to CC at a later stage, which replaces any previous modifications.

We should use :append operation to ensures that additions are applied to the final value, after all assignments from core classes have been processed. As a result, when you want to extend variables that may be set in core classes (like CC in gcc.bbclass), you should use the :append syntax to guarantee your changes are preserved in the final build environment.

- Using CFLAGS is the standard way to pass compiler flag for C projects.

- The Makefile of the project doesn't respect to append to CFLAGS so added 0006-make-CFLAGS-appendable.patch to make CFLAGS appendable.

Signed-off-by: Alper Ak <alperyasinak1@gmail.com>
---
 ...oc-Store-return-value-into-location.patch} |  0
 .../files/0006-make-CFLAGS-appendable.patch   | 60 +++++++++++++++++++
 .../wifi-test-suite_10.10.1.bb                |  7 ++-
 3 files changed, 65 insertions(+), 2 deletions(-)
 rename meta-oe/recipes-connectivity/wifi-test-suite/files/{0001-wfa_cmdproc-Store-return-value-into-location.patch => 0005-wfa_cmdproc-Store-return-value-into-location.patch} (100%)
 create mode 100644 meta-oe/recipes-connectivity/wifi-test-suite/files/0006-make-CFLAGS-appendable.patch
diff mbox series

Patch

diff --git a/meta-oe/recipes-connectivity/wifi-test-suite/files/0001-wfa_cmdproc-Store-return-value-into-location.patch b/meta-oe/recipes-connectivity/wifi-test-suite/files/0005-wfa_cmdproc-Store-return-value-into-location.patch
similarity index 100%
rename from meta-oe/recipes-connectivity/wifi-test-suite/files/0001-wfa_cmdproc-Store-return-value-into-location.patch
rename to meta-oe/recipes-connectivity/wifi-test-suite/files/0005-wfa_cmdproc-Store-return-value-into-location.patch
diff --git a/meta-oe/recipes-connectivity/wifi-test-suite/files/0006-make-CFLAGS-appendable.patch b/meta-oe/recipes-connectivity/wifi-test-suite/files/0006-make-CFLAGS-appendable.patch
new file mode 100644
index 0000000000..9d20403866
--- /dev/null
+++ b/meta-oe/recipes-connectivity/wifi-test-suite/files/0006-make-CFLAGS-appendable.patch
@@ -0,0 +1,60 @@ 
+From ef4ead927f69452c95b80e5bf042f67897f67e9d Mon Sep 17 00:00:00 2001
+From: Alper Ak <alperyasinak1@gmail.com>
+Date: Mon, 23 Jun 2025 15:46:37 +0300
+Subject: [PATCH] Allow extra CFLAGS via EXTRA_CFLAGS variable
+
+This patch introduces an EXTRA_CFLAGS variable to the Makefile, which is
+appended to CFLAGS. This allows users or external build systems to pass
+their additional compiler flags.
+
+Upstream-Status: Submitted [https://github.com/Wi-FiTestSuite/Wi-FiTestSuite-Linux-DUT/pull/61]
+
+Signed-off-by: Alper Ak <alperyasinak1@gmail.com>
+---
+ Makefile.inc | 15 ++++++++-------
+ 1 file changed, 8 insertions(+), 7 deletions(-)
+
+diff --git a/Makefile.inc b/Makefile.inc
+index 0094bdf..76729b9 100644
+--- a/Makefile.inc
++++ b/Makefile.inc
+@@ -22,28 +22,29 @@ UCC=ucc
+ CON=console_src
+ WTG=WTGService
+ MAKE?=make
++EXTRA_CFLAGS ?=
+ 
+ # This is for WMM-PS
+ #for Ext TG
+-#CFLAGS = -g -O2 -D_REENTRANT -DWFA_WMM_PS_EXT -Wall -I../inc
++#CFLAGS = -g -O2 -D_REENTRANT -DWFA_WMM_PS_EXT -Wall -I../inc ${EXTRA_CFLAGS}
+ 
+ ## for WMM-AC, WMM-PS, Voice, PMF, TDLS Test-Bed 
+-#CFLAGS = -g -O2 -D_REENTRANT  -DWFA_WMM_PS_EXT -DWFA_WMM_AC -DWFA_VOICE_EXT -DWFA_STA_TB -Wall -I../inc
++#CFLAGS = -g -O2 -D_REENTRANT  -DWFA_WMM_PS_EXT -DWFA_WMM_AC -DWFA_VOICE_EXT -DWFA_STA_TB -Wall -I../inc ${EXTRA_CFLAGS}
+ 
+ ## for WMM-AC, WMM-PS Test-Bed
+-#CFLAGS = -g -O2 -D_REENTRANT  -DWFA_WMM_PS_EXT -DWFA_WMM_AC -DWFA_STA_TB -Wall -I../inc
++#CFLAGS = -g -O2 -D_REENTRANT  -DWFA_WMM_PS_EXT -DWFA_WMM_AC -DWFA_STA_TB -Wall -I../inc ${EXTRA_CFLAGS}
+ 
+ ## for non-Test-Bed WMM-AC, WMM-PS and Voice
+-#CFLAGS = -g -O2 -D_REENTRANT  -DWFA_WMM_PS_EXT -DWFA_WMM_AC -DWFA_VOICE_EXT -Wall -I../inc
++#CFLAGS = -g -O2 -D_REENTRANT  -DWFA_WMM_PS_EXT -DWFA_WMM_AC -DWFA_VOICE_EXT -Wall -I../inc ${EXTRA_CFLAGS}
+ 
+ ## for PC-ENDPOINT
+-#CFLAGS = -g -O2 -D_REENTRANT  -DWFA_WMM_PS_EXT -DWFA_WMM_AC -DWFA_VOICE_EXT -DWFA_PC_CONSOLE -Wall -I../inc
++#CFLAGS = -g -O2 -D_REENTRANT  -DWFA_WMM_PS_EXT -DWFA_WMM_AC -DWFA_VOICE_EXT -DWFA_PC_CONSOLE -Wall -I../inc ${EXTRA_CFLAGS}
+ 
+ ## for PC-ENDPOINT No Voice
+-#CFLAGS = -g -O2 -D_REENTRANT  -DWFA_WMM_PS_EXT -DWFA_WMM_AC -DWFA_PC_CONSOLE -DWFA_STA_TB -Wall -I../inc
++#CFLAGS = -g -O2 -D_REENTRANT  -DWFA_WMM_PS_EXT -DWFA_WMM_AC -DWFA_PC_CONSOLE -DWFA_STA_TB -Wall -I../inc ${EXTRA_CFLAGS}
+ 
+ # This is for WPA2 as default
+-CFLAGS = -g -O2 -D_REENTRANT -Wall -I../inc
++CFLAGS = -g -O2 -D_REENTRANT -Wall -I../inc ${EXTRA_CFLAGS}
+ 
+ DUTLIBS = ../lib/libwfa_dut.a -lpthread
+ CALIBS = ../lib/libwfa_ca.a -lpthread
+-- 
+2.43.0
+
diff --git a/meta-oe/recipes-connectivity/wifi-test-suite/wifi-test-suite_10.10.1.bb b/meta-oe/recipes-connectivity/wifi-test-suite/wifi-test-suite_10.10.1.bb
index 9703c10452..357789ad88 100644
--- a/meta-oe/recipes-connectivity/wifi-test-suite/wifi-test-suite_10.10.1.bb
+++ b/meta-oe/recipes-connectivity/wifi-test-suite/wifi-test-suite_10.10.1.bb
@@ -14,7 +14,8 @@  SRC_URI = "git://github.com/Wi-FiTestSuite/Wi-FiTestSuite-Linux-DUT.git;branch=m
 	file://0003-fix-path-to-usr-sbin-for-script-and-make-script-for-.patch \
 	file://0004-run-ranlib-per-library-and-use-AR.patch \
         file://fno-common.patch \
-        file://0001-wfa_cmdproc-Store-return-value-into-location.patch \
+        file://0005-wfa_cmdproc-Store-return-value-into-location.patch \
+        file://0006-make-CFLAGS-appendable.patch \
 "
 
 # to avoid host path QA error
@@ -41,4 +42,6 @@  RDEPENDS:${PN} = "wpa-supplicant"
 # http://errors.yoctoproject.org/Errors/Details/766893/
 # wfa_cmdproc.c:467:68: error: passing argument 3 of 'strtok_r' from incompatible pointer type [-Wincompatible-pointer-types]
 # wfa_cs.c:4175:57: error: initialization of 'caStaGetEventDetails_t *' {aka 'struct ca_sta_get_event_details *'} from incompatible pointer type 'caStaMngServ_t *' {aka 'struct ca_sta_manage_service *'} [-Wincompatible-pointer-types]
-CC += "-Wno-error=incompatible-pointer-types"
+CFLAGS += "-Wno-error=incompatible-pointer-types"
+
+export EXTRA_CFLAGS = "${CFLAGS}"