[openwrt/openwrt] tools: build bash on macOS and use it for ipkg-build

LEDE Commits lede-commits at lists.infradead.org
Thu Jan 27 04:39:23 PST 2022


nbd pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/3869ccbcc891a7185550a2a422e2db01fd994b7d

commit 3869ccbcc891a7185550a2a422e2db01fd994b7d
Author: Felix Fietkau <nbd at nbd.name>
AuthorDate: Thu Jan 27 13:25:39 2022 +0100

    tools: build bash on macOS and use it for ipkg-build
    
    On macOS, system binaries silently drop the environment variables for injecting
    extra shared libraries (used by fakeroot). This is done for security reasons.
    Work around this by building bash from source, so that it gets an ad-hoc signature
    and does not have these restrictions
    
    Signed-off-by: Felix Fietkau <nbd at nbd.name>
---
 include/package-ipkg.mk |  2 +-
 tools/Makefile          |  3 +++
 tools/bash/Makefile     | 21 +++++++++++++++++++++
 3 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/include/package-ipkg.mk b/include/package-ipkg.mk
index 362a0e2a8b..3063a86a28 100644
--- a/include/package-ipkg.mk
+++ b/include/package-ipkg.mk
@@ -264,7 +264,7 @@ $(_endef)
     endif
 
 	$(INSTALL_DIR) $$(PDIR_$(1))
-	$(FAKEROOT) $(SCRIPT_DIR)/ipkg-build -m "$(FILE_MODES)" $$(IDIR_$(1)) $$(PDIR_$(1))
+	$(FAKEROOT) $(STAGING_DIR_HOST)/bin/bash $(SCRIPT_DIR)/ipkg-build -m "$(FILE_MODES)" $$(IDIR_$(1)) $$(PDIR_$(1))
 	@[ -f $$(IPKG_$(1)) ]
 
     $(1)-clean:
diff --git a/tools/Makefile b/tools/Makefile
index 686d5294d3..681344a014 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -80,6 +80,9 @@ ifneq ($(HOST_OS),Linux)
   $(curdir)/squashfskit4/compile += $(curdir)/coreutils/compile
   tools-y += coreutils
 endif
+ifeq ($(HOST_OS),Darwin)
+  tools-y += bash
+endif
 
 ifneq ($(CONFIG_CCACHE)$(CONFIG_SDK),)
 $(foreach tool, $(filter-out xz zstd pkgconf patch ninja meson libressl cmake,$(tools-y)), $(eval $(curdir)/$(tool)/compile += $(curdir)/ccache/compile))
diff --git a/tools/bash/Makefile b/tools/bash/Makefile
new file mode 100644
index 0000000000..7c25b83327
--- /dev/null
+++ b/tools/bash/Makefile
@@ -0,0 +1,21 @@
+#
+# Copyright (C) 2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=bash
+PKG_CPE_ID:=cpe:/a:gnu:bash
+PKG_VERSION:=5.1.16
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@GNU/bash
+PKG_HASH:=5bac17218d3911834520dad13cd1f85ab944e1c09ae1aba55906be1f8192f558
+
+HOST_BUILD_PARALLEL := 1
+
+include $(INCLUDE_DIR)/host-build.mk
+
+$(eval $(call HostBuild))



More information about the lede-commits mailing list