[PATCH 5/5] build: remove shell.sh

Elliott Mitchell ehem+openwrt at m5p.com
Fri Dec 1 13:33:39 PST 2023


Handling common shell usage may have been valuable in the past.  Yet now
this is almost unused, so inline the single remaining use.  Then delete
the old file.

Signed-off-by: Elliott Mitchell <ehem+openwrt at m5p.com>
---
I've tried to test the removal.  I'm unsure I actually achieved
coverage, so a careful look at package/kernel/mac80211/Makefile by
someone else would be good.
---
 include/shell.sh                 | 15 ---------------
 include/unpack.mk                |  4 ++--
 package/kernel/mac80211/Makefile |  2 +-
 rules.mk                         |  1 -
 4 files changed, 3 insertions(+), 19 deletions(-)
 delete mode 100644 include/shell.sh

diff --git a/include/shell.sh b/include/shell.sh
deleted file mode 100644
index 6ee0cf6030..0000000000
--- a/include/shell.sh
+++ /dev/null
@@ -1,15 +0,0 @@
-getvar() {
-	eval "echo \"\${$1}\""
-}
-
-var2file() {
-	local var
-	eval "var=\"\${$1}\""
-	if [ -n "$var" ]; then echo "$var" > "$2"; fi
-}
-
-isset() {
-	local var
-	eval "var=\"\${$1}\""
-	[ -n "$var" ]
-}
diff --git a/include/unpack.mk b/include/unpack.mk
index 5959d55f4b..a120a6093d 100644
--- a/include/unpack.mk
+++ b/include/unpack.mk
@@ -62,10 +62,10 @@ ifeq ($(strip $(UNPACK_CMD)),)
 endif
 
 ifdef PKG_BUILD_DIR
-  PKG_UNPACK ?= $(SH_FUNC) $(call UNPACK_CMD,$(PKG_BUILD_DIR))
+  PKG_UNPACK ?= $(call UNPACK_CMD,$(PKG_BUILD_DIR))
 endif
 ifdef HOST_BUILD_DIR
-  HOST_UNPACK ?= $(SH_FUNC) $(call UNPACK_CMD,$(HOST_BUILD_DIR))
+  HOST_UNPACK ?= $(call UNPACK_CMD,$(HOST_BUILD_DIR))
 endif
 
 endif # PKG_SOURCE
diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile
index 9016e2a525..8aef63d868 100644
--- a/package/kernel/mac80211/Makefile
+++ b/package/kernel/mac80211/Makefile
@@ -365,7 +365,7 @@ define Quilt/Refresh/Package
 endef
 
 define Build/Compile
-	$(SH_FUNC) var2file "$(call shvar,mac80211_config)" $(PKG_BUILD_DIR)/.config
+	[ -z "$$$${$(call shvar,mac80211_config)}" ] || echo "$$$${$(call shvar,mac80211_config)}" > "$(PKG_BUILD_DIR)/.config"
 	$(MAKE) $(MAKE_OPTS) allnoconfig
 	$(call Build/Compile/kmod)
 endef
diff --git a/rules.mk b/rules.mk
index 6f05047f26..f09ea1ecc4 100644
--- a/rules.mk
+++ b/rules.mk
@@ -234,7 +234,6 @@ endif
 export ORIG_PATH:=$(if $(ORIG_PATH),$(ORIG_PATH),$(PATH))
 export PATH:=$(TARGET_PATH)
 export STAGING_DIR STAGING_DIR_HOST STAGING_DIR_HOSTPKG
-export SH_FUNC:=. $(INCLUDE_DIR)/shell.sh;
 
 PKG_CONFIG:=$(STAGING_DIR_HOST)/bin/pkg-config
 
-- 
(\___(\___(\______          --=> 8-) EHM <=--          ______/)___/)___/)
 \BS (    |       ehem+openwrt at m5p.com     PGP 87145445       |    )   /
  \_CS\   |  _____  -O #include <stddisclaimer.h> O-   _____  |   /  _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445






More information about the openwrt-devel mailing list