Skip to content

Commit

Permalink
tools: build bash on macOS and use it for ipkg-build
Browse files Browse the repository at this point in the history
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@nbd.name>
  • Loading branch information
nbd168 committed Jan 27, 2022
1 parent 1d4750f commit 3869ccb
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion include/package-ipkg.mk
Expand Up @@ -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:
Expand Down
3 changes: 3 additions & 0 deletions tools/Makefile
Expand Up @@ -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))
Expand Down
21 changes: 21 additions & 0 deletions 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))

0 comments on commit 3869ccb

Please sign in to comment.