Makefile: fix SDK relocation for per-package-dirs
PATCH v2 1/1 Makefile: fix SDK relocation for per-package-dirs
The relocate-sdk.sh script does not work correctly when BR2_PER_PACKAGE_DIRECTORIES is enabled. relocate-sdk.sh expects everything to point at $HOST_DIR, but each package will be pointing at its $(O)/per-package/*/host.
Use the same command for scrubing host paths during the build, to scrub to the final host directory location.
---
v2:
- drop original implementation in favor of reusing the existing PPD_FIXUP_PATHS code.
--- Makefile | 1 + package/pkg-generic.mk | 12 +----------- package/pkg-utils.mk | 15 +++++++++++++++ 3 files changed, 17 insertions(+), 11 deletions(-)
Makefile +1 -0
@@ -598,6 +598,7 @@ prepare-sdk: world @$(call MESSAGE,"Rendering the SDK relocatable") PER_PACKAGE_DIR=$(PER_PACKAGE_DIR) $(TOPDIR)/support/scripts/fix-rpath host PER_PACKAGE_DIR=$(PER_PACKAGE_DIR) $(TOPDIR)/support/scripts/fix-rpath staging + $(call ppd-fixup-paths,$(BASE_DIR)) $(INSTALL) -m 755 $(TOPDIR)/support/misc/relocate-sdk.sh $(HOST_DIR)/relocate-sdk.sh mkdir -p $(HOST_DIR)/share/buildroot echo $(HOST_DIR) > $(HOST_DIR)/share/buildroot/sdk-location
package/pkg-generic.mk +1 -11
@@ -92,18 +92,8 @@ endif ifeq ($(BR2_PER_PACKAGE_DIRECTORIES),y) -# Ensure files like .la, .pc, .pri, .cmake, and so on, point to the -# proper staging and host directories for the current package: find -# all text files that contain the PPD root, and replace it with the -# current package's PPD. define PPD_FIXUP_PATHS - $(Q)grep --binary-files=without-match -lrZ '$(PER_PACKAGE_DIR)/[^/]\+/' $(HOST_DIR) \ - |while read -d '' f; do \ - file -b --mime-type "$${f}" | grep -q '^text/' || continue; \ - printf '%s\0' "$${f}"; \ - done \ - |xargs -0 --no-run-if-empty \ - $(SED) 's:$(PER_PACKAGE_DIR)/[^/]\+/:$(PER_PACKAGE_DIR)/$($(PKG)_NAME)/:g' + $(call ppd-fixup-paths,$(PER_PACKAGE_DIR)/$($(PKG)_NAME)) endef # Remove python's pre-compiled "sysconfigdata", as it may contain paths to
package/pkg-utils.mk +15 -0
@@ -233,6 +233,21 @@ define prepare-per-package-directory $(call per-package-rsync,$(1),host,$(HOST_DIR)) $(call per-package-rsync,$(1),target,$(TARGET_DIR)) endef + +# Ensure files like .la, .pc, .pri, .cmake, and so on, point to the +# proper staging and host directories for the current package: find +# all text files that contain the PPD root, and replace it with the +# current package's PPD. +# $1: destination root directory containing host and staging +define ppd-fixup-paths + $(Q)grep --binary-files=without-match -lrZ '$(PER_PACKAGE_DIR)/[^/]\+/' $(HOST_DIR) \ + |while read -d '' f; do \ + file -b --mime-type "$${f}" | grep -q '^text/' || continue; \ + printf '%s\0' "$${f}"; \ + done \ + |xargs -0 --no-run-if-empty \ + $(SED) 's:$(PER_PACKAGE_DIR)/[^/]\+/:$(1)/:g' +endef endif #
Signature · 6 lines
2.39.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 10 lines · Brandon Maier via buildroot
The
relocate-sdk.shscript does not work correctly whenBR2_PER_PACKAGE_DIRECTORIESis enabled.relocate-sdk.shexpects everything to point at $HOST_DIR, but each package will be pointing at its $(O)/per-package/*/host.Use the same command for scrubing host paths during the build, to scrub to the final host directory location.
Signed-off-by Brandon Maier <[email protected]>
Tested and verified the host paths in the shasum as an example
Quoted 75 lines
---
v2:
- drop original implementation in favor of reusing the existingPPD_FIXUP_PATHScode.--- Makefile | 1 + package/pkg-generic.mk | 12 +----------- package/pkg-utils.mk | 15 +++++++++++++++ 3 files changed, 17 insertions(+), 11 deletions(-)Makefile +1
-0@@ -598,6 +598,7 @@ prepare-sdk: world @$(call MESSAGE,"Rendering the SDK relocatable") PER_PACKAGE_DIR=$(PER_PACKAGE_DIR) $(TOPDIR)/support/scripts/fix-rpath host PER_PACKAGE_DIR=$(PER_PACKAGE_DIR) $(TOPDIR)/support/scripts/fix-rpath staging + $(call ppd-fixup-paths,$(BASE_DIR)) $(INSTALL) -m 755 $(TOPDIR)/support/misc/relocate-sdk.sh $(HOST_DIR)/relocate-sdk.sh mkdir -p $(HOST_DIR)/share/buildroot echo $(HOST_DIR) > $(HOST_DIR)/share/buildroot/sdk-locationpackage/pkg-generic.mk +1
-11@@ -92,18 +92,8 @@ endif ifeq ($(BR2_PER_PACKAGE_DIRECTORIES),y) -# Ensure files like .la, .pc, .pri, .cmake, and so on, point to the -# proper staging and host directories for the current package: find -# all text files that contain the PPD root, and replace it with the -# current package's PPD. define PPD_FIXUP_PATHS - $(Q)grep --binary-files=without-match -lrZ '$(PER_PACKAGE_DIR)/[^/]\+/' $(HOST_DIR) \ - |while read -d '' f; do \ - file -b --mime-type "$${f}" | grep -q '^text/' || continue; \ - printf '%s\0' "$${f}"; \ - done \ - |xargs -0 --no-run-if-empty \ - $(SED) 's:$(PER_PACKAGE_DIR)/[^/]\+/:$(PER_PACKAGE_DIR)/$($(PKG)_NAME)/:g' + $(call ppd-fixup-paths,$(PER_PACKAGE_DIR)/$($(PKG)_NAME)) endef # Remove python's pre-compiled "sysconfigdata", as it may contain paths topackage/pkg-utils.mk +15
-1@@ -233,6 +233,21 @@ define prepare-per-package-directory $(call per-package-rsync,$(1),host,$(HOST_DIR)) $(call per-package-rsync,$(1),target,$(TARGET_DIR)) endef + +# Ensure files like .la, .pc, .pri, .cmake, and so on, point to the +# proper staging and host directories for the current package: find +# all text files that contain the PPD root, and replace it with the +# current package's PPD. +# $1: destination root directory containing host and staging +define ppd-fixup-paths + $(Q)grep --binary-files=without-match -lrZ '$(PER_PACKAGE_DIR)/[^/]\+/' $(HOST_DIR) \ + |while read -d '' f; do \ + file -b --mime-type "$${f}" | grep -q '^text/' || continue; \ + printf '%s\0' "$${f}"; \ + done \ + |xargs -0 --no-run-if-empty \ + $(SED) 's:$(PER_PACKAGE_DIR)/[^/]\+/:$(1)/:g' +endef endif # --2.39.0
Quoted 4 lines
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 9 lines · Brandon Maier
The
relocate-sdk.shscript does not work correctly whenBR2_PER_PACKAGE_DIRECTORIESis enabled.relocate-sdk.shexpects everything to point at $HOST_DIR, but each package will be pointing at its $(O)/per-package/*/host.Use the same command for scrubing host paths during the build, to scrub to the final host directory location.
Signed-off-by Brandon Maier <[email protected]>
Applied to master, thanks.
And thank you Charles for the review.
Regards,
Arnout
Quoted 62 lines
---
v2:
- drop original implementation in favor of reusing the existingPPD_FIXUP_PATHScode.--- Makefile | 1 + package/pkg-generic.mk | 12 +----------- package/pkg-utils.mk | 15 +++++++++++++++ 3 files changed, 17 insertions(+), 11 deletions(-)Makefile +1
-0@@ -598,6 +598,7 @@ prepare-sdk: world @$(call MESSAGE,"Rendering the SDK relocatable") PER_PACKAGE_DIR=$(PER_PACKAGE_DIR) $(TOPDIR)/support/scripts/fix-rpath host PER_PACKAGE_DIR=$(PER_PACKAGE_DIR) $(TOPDIR)/support/scripts/fix-rpath staging + $(call ppd-fixup-paths,$(BASE_DIR)) $(INSTALL) -m 755 $(TOPDIR)/support/misc/relocate-sdk.sh $(HOST_DIR)/relocate-sdk.sh mkdir -p $(HOST_DIR)/share/buildroot echo $(HOST_DIR) > $(HOST_DIR)/share/buildroot/sdk-locationpackage/pkg-generic.mk +1
-11@@ -92,18 +92,8 @@ endif ifeq ($(BR2_PER_PACKAGE_DIRECTORIES),y) -# Ensure files like .la, .pc, .pri, .cmake, and so on, point to the -# proper staging and host directories for the current package: find -# all text files that contain the PPD root, and replace it with the -# current package's PPD. define PPD_FIXUP_PATHS - $(Q)grep --binary-files=without-match -lrZ '$(PER_PACKAGE_DIR)/[^/]\+/' $(HOST_DIR) \ - |while read -d '' f; do \ - file -b --mime-type "$${f}" | grep -q '^text/' || continue; \ - printf '%s\0' "$${f}"; \ - done \ - |xargs -0 --no-run-if-empty \ - $(SED) 's:$(PER_PACKAGE_DIR)/[^/]\+/:$(PER_PACKAGE_DIR)/$($(PKG)_NAME)/:g' + $(call ppd-fixup-paths,$(PER_PACKAGE_DIR)/$($(PKG)_NAME)) endef # Remove python's pre-compiled "sysconfigdata", as it may contain paths topackage/pkg-utils.mk +8
-0@@ -233,6 +233,21 @@ define prepare-per-package-directory $(call per-package-rsync,$(1),host,$(HOST_DIR)) $(call per-package-rsync,$(1),target,$(TARGET_DIR)) endef + +# Ensure files like .la, .pc, .pri, .cmake, and so on, point to the +# proper staging and host directories for the current package: find +# all text files that contain the PPD root, and replace it with the +# current package's PPD. +# $1: destination root directory containing host and staging +define ppd-fixup-paths + $(Q)grep --binary-files=without-match -lrZ '$(PER_PACKAGE_DIR)/[^/]\+/' $(HOST_DIR) \
package/pkg-utils.mk define prepare-per-package-directory · line 253
Quoted 10 lines
package/pkg-utils.mk +7
-0+ |while read -d '' f; do \ + file -b --mime-type "$${f}" | grep -q '^text/' || continue; \ + printf '%s\0' "$${f}"; \ + done \ + |xargs -0 --no-run-if-empty \ + $(SED) 's:$(PER_PACKAGE_DIR)/[^/]\+/:$(1)/:g' +endef endif #
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 12 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Arnout" == Arnout Vandecappelle via buildroot <[email protected]> writes:
Quoted 8 lines · Brandon Maier
The
relocate-sdk.shscript does not work correctly whenBR2_PER_PACKAGE_DIRECTORIESis enabled.relocate-sdk.shexpects everything to point at $HOST_DIR, but each package will be pointing at its $(O)/per-package/*/host.
Use the same command for scrubing host paths during the build, to scrub
to the final host directory location.Signed-off-by Brandon Maier <[email protected]>
Quoted 3 lines
Applied to master, thanks.
And thank you Charles for the review.
Committed to 2023.02.x and 2023.08.x, thanks.
Signature · 5 lines
Bye, Peter Korsgaard _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot