diff mbox series

[OpenWrt-Devel] tools: Fix "lib" symlink created inside $(STAGING_DIR_HOST)/lib

Message ID 20200218213722.14030-1-jeffery.to@gmail.com
State Accepted
Delegated to: Petr Štetiar
Headers show
Series [OpenWrt-Devel] tools: Fix "lib" symlink created inside $(STAGING_DIR_HOST)/lib | expand

Commit Message

Jeffery To Feb. 18, 2020, 9:37 p.m. UTC
Currently, if "make tools/install" is called after tools have already
been installed, a symbolic link named "lib" will be created inside
$(STAGING_DIR_HOST)/lib, pointing to "lib" (i.e. itself).

During tools/prepare, a "lib64" symlink is created inside
$(STAGING_DIR_HOST) that points to "lib" (also inside
$(STAGING_DIR_HOST)).

If tools/prepare is called and the "lib64" symlink already exists, then
ln will treat it as a directory and instead create a symlink named "lib"
inside of that directory.

This adds the -n option for ln so that $(STAGING_DIR_HOST)/lib64 is
always treated as a normal file (the link name), not as a directory.

Signed-off-by: Jeffery To <jeffery.to@gmail.com>
---
 tools/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/tools/Makefile b/tools/Makefile
index 2f57d25525..b7e236cbd2 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -138,7 +138,7 @@  $(STAGING_DIR_HOST)/.prepared: $(TMP_DIR)/.build
 	mkdir -p $(BUILD_DIR_HOST)/stamp $(STAGING_DIR_HOST)/include/sys
 	$(INSTALL_DATA) $(TOPDIR)/tools/include/*.h $(STAGING_DIR_HOST)/include/
 	$(INSTALL_DATA) $(TOPDIR)/tools/include/sys/*.h $(STAGING_DIR_HOST)/include/sys/
-	ln -sf lib $(STAGING_DIR_HOST)/lib64
+	ln -snf lib $(STAGING_DIR_HOST)/lib64
 	touch $@
 
 endif