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

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


The following commit(s) were added to refs/heads/master by this push:
     new 6cad7e9582 arm, arm64, xtensa, libxx: Change sed -r to sed -E to 
support macOS
6cad7e9582 is described below

commit 6cad7e9582be79564f0c4d1adc5a8b10db86f92c
Author: Lee Lup Yuen <lu...@appkaki.com>
AuthorDate: Tue Oct 10 11:58:47 2023 +0800

    arm, arm64, xtensa, libxx: Change sed -r to sed -E to support macOS
    
    When we build NuttX on macOS, it shows many `sed` messages (and the build 
still completes successfully):
    
    ```text
    $ tools/configure.sh pinephone:nsh
    $ make
    sed: illegal option -- r
    ```
    
    This is due to the Makefiles executing `sed -r` which is not a valid option 
on macOS.
    
    This PR proposes to change `sed -r` to `sed -E` because:
    
    - `sed -E` on macOS is equivalent to `sed -r` on Linux
    
    - `sed -E` and `sed -r` are aliases according to the GNU `sed` Manual
    
    - `sed -E` is already used in nuttx_add_romfs.cmake, nuttx_add_symtab.cmake 
and process_config.sh
---
 arch/arm/src/common/Toolchain.defs | 4 ++--
 arch/arm64/src/Toolchain.defs      | 2 +-
 arch/xtensa/src/esp32/Make.defs    | 2 +-
 libs/libxx/libcxx.defs             | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/arm/src/common/Toolchain.defs 
b/arch/arm/src/common/Toolchain.defs
index 5a40e0d11e..7c0e712d7b 100644
--- a/arch/arm/src/common/Toolchain.defs
+++ b/arch/arm/src/common/Toolchain.defs
@@ -178,7 +178,7 @@ ifeq ($(CONFIG_ARM_TOOLCHAIN_CLANG),y)
 
   ifneq ($(TOOLCHAIN_CLANG_CONFIG),)
     ifeq ($(CLANGVER),)
-      export CLANGVER := $(shell $(CC) --version | grep "clang version" | sed 
-r "s/.* ([0-9]+\.[0-9]+).*/\1/")
+      export CLANGVER := $(shell $(CC) --version | grep "clang version" | sed 
-E "s/.* ([0-9]+\.[0-9]+).*/\1/")
     endif
 
     ifeq ($(CLANGVER),14.0)
@@ -257,7 +257,7 @@ else
   # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105523
 
   ifeq ($(GCCVER),)
-    export GCCVER := $(shell $(CC) --version | grep gcc | sed -r "s/.* 
([0-9]+\.[0-9]+).*/\1/" | cut -d'.' -f1)
+    export GCCVER := $(shell $(CC) --version | grep gcc | sed -E "s/.* 
([0-9]+\.[0-9]+).*/\1/" | cut -d'.' -f1)
   endif
 
   ifeq ($(GCCVER),12)
diff --git a/arch/arm64/src/Toolchain.defs b/arch/arm64/src/Toolchain.defs
index bf6a8eb8f5..4b54399103 100644
--- a/arch/arm64/src/Toolchain.defs
+++ b/arch/arm64/src/Toolchain.defs
@@ -166,7 +166,7 @@ endif
 
 ifeq ($(CONFIG_ARCH_TOOLCHAIN_GNU),y)
   ifeq ($(GCCVER),)
-    export GCCVER := $(shell $(CC) --version | grep gcc | sed -r "s/.* 
([0-9]+\.[0-9]+).*/\1/" | cut -d'.' -f1)
+    export GCCVER := $(shell $(CC) --version | grep gcc | sed -E "s/.* 
([0-9]+\.[0-9]+).*/\1/" | cut -d'.' -f1)
   endif
 
   ifeq ($(GCCVER),12)
diff --git a/arch/xtensa/src/esp32/Make.defs b/arch/xtensa/src/esp32/Make.defs
index f368f6bccd..43642d581d 100644
--- a/arch/xtensa/src/esp32/Make.defs
+++ b/arch/xtensa/src/esp32/Make.defs
@@ -236,7 +236,7 @@ CHIP_CSRCS += esp32_wlan.c esp32_wifi_utils.c 
esp32_wifi_adapter.c
 EXTRA_LIBS += -lcore -lnet80211 -lpp -lsmartconfig -lespnow -lwpa_supplicant
 
 ifeq ($(GCCVER),)
-  export GCCVER := $(shell $(CC) --version | grep gcc | sed -r 's/.* 
([0-9]+\.[0-9]+).*/\1/' | cut -d'.' -f1)
+  export GCCVER := $(shell $(CC) --version | grep gcc | sed -E 's/.* 
([0-9]+\.[0-9]+).*/\1/' | cut -d'.' -f1)
 endif
 ifeq ($(GCCVER),12)
   chip/esp32_wifi_adapter.c_CFLAGS += -Wno-maybe-uninitialized
diff --git a/libs/libxx/libcxx.defs b/libs/libxx/libcxx.defs
index 6a1fe640cd..c0c5b51527 100644
--- a/libs/libxx/libcxx.defs
+++ b/libs/libxx/libcxx.defs
@@ -79,7 +79,7 @@ libcxx/src/filesystem/operations.cpp_CXXFLAGS += -Wno-shadow
 #       |                                ^~~~~~
 
 ifeq ($(GCCVER),)
-  export GCCVER = $(shell $(CXX) --version | grep g++ | sed -r 's/.* 
([0-9]+\.[0-9]+).*/\1/' | cut -d'.' -f1)
+  export GCCVER = $(shell $(CXX) --version | grep g++ | sed -E 's/.* 
([0-9]+\.[0-9]+).*/\1/' | cut -d'.' -f1)
 endif
 
 ifeq ($(GCCVER),12)

Reply via email to