[openwrt/openwrt] tools/coreutils: replace symlinks to build prerequisites
LEDE Commits
lede-commits at lists.infradead.org
Sat Jul 26 05:38:40 PDT 2025
robimarko pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/b8c0ed469238291298732512045ed8659ac22ea8
commit b8c0ed469238291298732512045ed8659ac22ea8
Author: Michael Pratt <mcpratt at pm.me>
AuthorDate: Mon Sep 30 03:55:14 2024 -0400
tools/coreutils: replace symlinks to build prerequisites
Before building, symlinks are made from existing utilities
on the host machine, because they are necessary before
coreutils can be built.
Instead of leaving these utilities as symlinks,
replace them with the copy provided by the coreutils build
in order to increase version control for these utilities
and to have a real copy for targets like the SDK.
The utilities required before building and provided by coreutils are
cp, install, realpath, seq, and stat.
Let all of the utilities be installed with the "g" prefix,
then, existing symlinks named without the "g" prefix are safely replaced
with a new symlink using the coreutils version of `ln` just built
in order to prevent an inconsistent state of the file
since these utilities must always be available.
While at it, sort the list alphabetically.
Tested-by: Georgi Valkov <gvalkov at gmail.com> # macOS
Signed-off-by: Michael Pratt <mcpratt at pm.me>
Link: https://github.com/openwrt/openwrt/pull/16522
Signed-off-by: Robert Marko <robimarko at gmail.com>
---
tools/coreutils/Makefile | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/tools/coreutils/Makefile b/tools/coreutils/Makefile
index 84aba9e64a..fcd2fa76bb 100644
--- a/tools/coreutils/Makefile
+++ b/tools/coreutils/Makefile
@@ -16,7 +16,7 @@ PKG_HASH:=2bec616375002c92c1ed5ead32a092b174fe44c14bc736d32e5961053b821d84
HOST_BUILD_PARALLEL := 1
-PKG_PROGRAMS:=date readlink touch ln chown ginstall
+PKG_PROGRAMS:=chown cp date ginstall ln readlink realpath seq stat touch
include $(INCLUDE_DIR)/host-build.mk
@@ -68,8 +68,10 @@ endef
define Host/Install
$(INSTALL_DIR) $(1)/bin
- $(INSTALL_BIN) $(patsubst %,$(HOST_BUILD_DIR)/src/%,$(PKG_PROGRAMS)) $(1)/bin/
- ln -sf ginstall $(1)/bin/install
+ $(foreach prog,$(filter-out g%,$(PKG_PROGRAMS)),$(INSTALL_BIN) $(patsubst %,$(HOST_BUILD_DIR)/src/%,$(prog)) $(1)/bin/g$(prog); )
+ $(foreach prog,$(filter g%,$(PKG_PROGRAMS)),$(INSTALL_BIN) $(patsubst %,$(HOST_BUILD_DIR)/src/%,$(prog)) $(1)/bin/$(prog); )
+ $(foreach prog,$(filter-out g%,$(PKG_PROGRAMS)),g$(LN) g$(prog) $(1)/bin/$(prog); )
+ $(foreach prog,$(filter g%,$(PKG_PROGRAMS)),g$(LN) $(prog) $(1)/bin/$(patsubst g%,%,$(prog)); )
endef
define Host/Uninstall
More information about the lede-commits
mailing list