prereq: add support for creating relative symlinks
authorMichael Pratt <mcpratt@pm.me>
Thu, 3 Oct 2024 04:49:10 +0000 (00:49 -0400)
committerRobert Marko <robimarko@gmail.com>
Sat, 26 Jul 2025 12:38:08 +0000 (14:38 +0200)
For targets that install symlinks, like coreutils,
if the links happen to be deleted, let prereq stage
be capable of creating them again with a relative path.

Tested-by: Georgi Valkov <gvalkov@gmail.com> # macOS
Signed-off-by: Michael Pratt <mcpratt@pm.me>
Link: https://github.com/openwrt/openwrt/pull/16522
Signed-off-by: Robert Marko <robimarko@gmail.com>
include/prereq.mk

index 1039c5540c6a01a17d61851a7aa2f334d8eb1df4..23287eade476c6d36a5f14762e3dfe0a846c2589 100644 (file)
@@ -113,7 +113,7 @@ define SetupHostCommand
                                                [ -x "$(STAGING_DIR_HOST)/bin/$(strip $(1))" ] && exit 0 \
                                                ;; \
                                esac; \
-                               ln -sf "$$$$$$$$bin" "$(STAGING_DIR_HOST)/bin/$(strip $(1))"; \
+                               ln -sf "$$$$$$$${bin#$(STAGING_DIR_HOST)/bin/}" "$(STAGING_DIR_HOST)/bin/$(strip $(1))"; \
                                exit 1; \
                        fi; \
                fi; \