diff --git a/Makefile b/Makefile index 004039d847..4cf8750bfb 100644 --- a/Makefile +++ b/Makefile @@ -602,6 +602,16 @@ prepare-sdk: world @$(call MESSAGE,"Preparing the SDK") $(INSTALL) -m 755 $(TOPDIR)/support/misc/relocate-sdk.sh $(HOST_DIR)/relocate-sdk.sh mkdir -p $(HOST_DIR)/share/buildroot + (\ + export LC_ALL=C; \ + grep -lr '$(HOST_DIR)' '$(HOST_DIR)' | while read -r FILE; do \ + if file -b --mime-type "$$FILE" | grep -q '^text/' && \ + [ "$$FILE" != '$(HOST_DIR)/share/buildroot/sdk-location' ] && \ + [ "$$FILE" != '$(HOST_DIR)/share/buildroot/sdk-relocs' ]; then \ + echo "$$FILE"; \ + fi; \ + done \ + ) | sed -e 's|^$(HOST_DIR)|.|g' > $(HOST_DIR)/share/buildroot/sdk-relocs echo $(HOST_DIR) > $(HOST_DIR)/share/buildroot/sdk-location BR2_SDK_PREFIX ?= $(GNU_TARGET_NAME)_sdk-buildroot diff --git a/support/misc/relocate-sdk.sh b/support/misc/relocate-sdk.sh index 981d272425..d25bc55279 100755 --- a/support/misc/relocate-sdk.sh +++ b/support/misc/relocate-sdk.sh @@ -37,15 +37,10 @@ fi echo "Relocating the buildroot SDK from ${OLDPATH} to ${NEWPATH} ..." -# Make sure file uses the right language -export LC_ALL=C # Replace the old path with the new one in all text files -grep -lr "${OLDPATH}" . | while read -r FILE ; do - if file -b --mime-type "${FILE}" | grep -q '^text/' && [ "${FILE}" != "${LOCFILE}" ] - then - sed -i "s|${OLDPATH}|${NEWPATH}|g" "${FILE}" - fi -done +while read -r FILE ; do + sed -i "s|${OLDPATH}|${NEWPATH}|g" "${FILE}" +done < share/buildroot/sdk-relocs # At the very end, we update the location file to not break the # SDK if this script gets interruted.