[PATCH 2/2] build: only use fakeroot for packages if required

Paul Spooren mail at aparcar.org
Fri Sep 4 18:46:36 EDT 2020


Fakeroot was recently wrapped around the `ipkg-build` script to allow
arbitrary file modes for packages, like setting a SUID. However this
slows down the building process while most packages don't make use of
that (by defining `PKG_FILE_MODES`).

This commit only uses fakeroot if `PKG_FILE_MODES` is set. If it is not
defined the newly added *all root* option `-r` is used.

Signed-off-by: Paul Spooren <mail at aparcar.org>
---
 include/package-ipkg.mk | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/include/package-ipkg.mk b/include/package-ipkg.mk
index 0b7a561edc..362fa25307 100644
--- a/include/package-ipkg.mk
+++ b/include/package-ipkg.mk
@@ -260,7 +260,13 @@ $(_endef)
     endif
 
 	$(INSTALL_DIR) $$(PDIR_$(1))
+ifdef PKG_FILE_MODES
+	echo "Package $(1) is build with fakeroot" >&2
 	$(FAKEROOT) $(SCRIPT_DIR)/ipkg-build -m "$(PKG_FILE_MODES)" $$(IDIR_$(1)) $$(PDIR_$(1))
+else
+	echo "Package $(1) is build without fakeroot" >&2
+	$(SCRIPT_DIR)/ipkg-build -r $$(IDIR_$(1)) $$(PDIR_$(1))
+endif
 	@[ -f $$(IPKG_$(1)) ]
 
     $(1)-clean:
-- 
2.25.1




More information about the openwrt-devel mailing list