This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git

commit 3f2c7faa755d28f575009c8bf14781416a656808
Author: wangjianyu3 <[email protected]>
AuthorDate: Sun Nov 22 10:51:39 2026 +0800

    system/toybox: guard nuttx_bridge with CONFIG_SYSTEM_TOYBOX_BUILTIN_BRIDGE
    
    nuttx_bridge.c calls exec_builtin() (compiled under CONFIG_BUILTIN)
    and builtin_isavail() (declared under CONFIG_APP_REGISTRY); build the
    file only when CONFIG_SYSTEM_TOYBOX_BUILTIN_BRIDGE is enabled.
    
    Assisted-by: OpenCode:mimo-v2.6-pro
    Co-authored-by: multica-agent <[email protected]>
    Signed-off-by: wangjianyu3 <[email protected]>
---
 system/toybox/CMakeLists.txt | 7 ++++---
 system/toybox/Makefile       | 2 ++
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/system/toybox/CMakeLists.txt b/system/toybox/CMakeLists.txt
index b978c6031..4a14aa523 100644
--- a/system/toybox/CMakeLists.txt
+++ b/system/toybox/CMakeLists.txt
@@ -194,6 +194,8 @@ if(CONFIG_SYSTEM_TOYBOX)
   list(TRANSFORM TOYBOX_APPLET_SRCS PREPEND ${TOYBOX_DIR}/)
   file(GLOB TOYBOX_LIB_SRCS ${TOYBOX_DIR}/lib/*.c)
 
+  set(TOYBOX_GLUE_SRCS ${TOYBOX_DIR}/toybox_entry.c ${TOYBOX_DIR}/main.c)
+
   set(TOYBOX_DEFINITIONS __NuttX__ 
"TOYBOX_VERSION=\"${TOYBOX_VERSION}-nuttx\"")
 
   # strstart and show_help leak as globals and collide with other apps in a 
flat
@@ -203,15 +205,14 @@ if(CONFIG_SYSTEM_TOYBOX)
 
   if(CONFIG_SYSTEM_TOYBOX_BUILTIN_BRIDGE)
     list(APPEND TOYBOX_DEFINITIONS CONFIG_SYSTEM_TOYBOX_BUILTIN_BRIDGE=1)
+    list(APPEND TOYBOX_GLUE_SRCS ${TOYBOX_DIR}/nuttx_bridge.c)
   endif()
 
   nuttx_add_application(
     NAME
     toybox
     SRCS
-    ${TOYBOX_DIR}/toybox_entry.c
-    ${TOYBOX_DIR}/nuttx_bridge.c
-    ${TOYBOX_DIR}/main.c
+    ${TOYBOX_GLUE_SRCS}
     ${TOYBOX_LIB_SRCS}
     ${TOYBOX_APPLET_SRCS}
     STACKSIZE
diff --git a/system/toybox/Makefile b/system/toybox/Makefile
index 3b5a8f2f5..5c4451c0c 100644
--- a/system/toybox/Makefile
+++ b/system/toybox/Makefile
@@ -142,7 +142,9 @@ MAINSRC = $(TOYBOX_UNPACKNAME)/toybox_entry.c
 #  generated/build.sh so enabling more applets is "select it in
 #  menuconfig", not "edit CSRCS by hand".
 
+ifneq ($(CONFIG_SYSTEM_TOYBOX_BUILTIN_BRIDGE),)
 CSRCS += $(TOYBOX_UNPACKNAME)/nuttx_bridge.c
+endif
 CSRCS += $(TOYBOX_UNPACKNAME)/main.c
 # All of lib/*.c, same as upstream's own scripts/make.sh ($BUILD lib/*.c
 # $FILES ...) -- toybox's lib helpers call across files in ways that make

Reply via email to