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 118d2b30e9bcda0e5eba62ca14cbde9eb248b76e
Author: tengshuangshuang <[email protected]>
AuthorDate: Tue Nov 17 17:16:22 2026 +0800

    system/libarchive: Apply every numbered patch to the downloaded sources.
    
    The sources of libarchive are downloaded at build time, and only
    0001-fix-conflict-libarchive-for-nuttx.patch was applied to them.
    
    Apply all the files that match 0*.patch in name order, in the Make and
    in the CMake build, so that further patches can be added next to it.
    
    Assisted-by: Claude Code:claude-sonnet-5.5
    Signed-off-by: tengshuangshuang <[email protected]>
---
 system/libarchive/CMakeLists.txt | 11 ++++++++---
 system/libarchive/Makefile       |  4 +++-
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/system/libarchive/CMakeLists.txt b/system/libarchive/CMakeLists.txt
index 33b7e4832..adf5f448c 100644
--- a/system/libarchive/CMakeLists.txt
+++ b/system/libarchive/CMakeLists.txt
@@ -31,15 +31,20 @@ if(CONFIG_UTILS_LIBARCHIVE)
         
https://github.com/libarchive/libarchive/releases/download/v3.7.7/libarchive-3.7.7.zip
     )
 
+    file(GLOB LIBARCHIVE_PATCHES ${CMAKE_CURRENT_LIST_DIR}/0*.patch)
+    set(LIBARCHIVE_PATCH_CMD "true")
+    foreach(p ${LIBARCHIVE_PATCHES})
+      string(APPEND LIBARCHIVE_PATCH_CMD
+             " && patch -p1 -d ${LIBARCHIVE_DIR} -i ${p}")
+    endforeach()
+
     FetchContent_Declare(
       libarchive_fetch
       URL ${LIBARCHIVE_URL} SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/libarchive
           BINARY_DIR ${CMAKE_BINARY_DIR}/apps/system/libarchive/libarchive
       DOWNLOAD_NO_PROGRESS true
       TIMEOUT 30
-      PATCH_COMMAND
-        patch -p1 -d ${CMAKE_CURRENT_LIST_DIR}/libarchive <
-        ${CMAKE_CURRENT_LIST_DIR}/0001-fix-conflict-libarchive-for-nuttx.patch)
+      PATCH_COMMAND sh -c "${LIBARCHIVE_PATCH_CMD}")
 
     FetchContent_GetProperties(libarchive_fetch)
 
diff --git a/system/libarchive/Makefile b/system/libarchive/Makefile
index 8631e64f9..4f97daa8e 100644
--- a/system/libarchive/Makefile
+++ b/system/libarchive/Makefile
@@ -32,7 +32,9 @@ $(LIBARCHIVE_ZIP):
 $(LIBARCHIVE_SRC): $(LIBARCHIVE_ZIP)
        unzip -o $(LIBARCHIVE_ZIP)
        mv libarchive-3.7.7 $(LIBARCHIVE_SRC)
-       $(Q) patch -d $(LIBARCHIVE_SRC) -p1 < 
0001-fix-conflict-libarchive-for-nuttx.patch
+       $(Q) for p in $(sort $(wildcard 0*.patch)); do \
+               patch -d $(LIBARCHIVE_SRC) -p1 < $$p || exit 1; \
+       done
 
 context:: $(LIBARCHIVE_SRC)
 

Reply via email to