Fix per-package builds with qt5 submodule packages
v2 cover Fix per-package builds with qt5 submodule packages
Based off of Louis-Paul's earlier work[1] and And Yann Morin's feedback to a different patch set[2], this simple fix adds a new pre-configure hook method to pkg-generic.mk which searches for .pc,.cmake, and .pri files for any line that has a PER_PACKAGE_DIR path and replaces it with the appropriate PER_PACKAGE_DIR path for the package being compiled.
$(HOST_DIR) is used instead of $(STAGING_DIR) as that covers both host and staging directories in one step.
IE: If building qt5svg:
buildroot/output/per-package/qt5base -> buildroot/output/per-package/qt5svg
Feedback is welcome!
Adam
1) https://lore.kernel.org/buildroot/[email protected]/
2) https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/
Adam Duskett (1):
package/pkg-generic.mk: fix absolute paths in per-package config files
package/pkg-generic.mk | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
Signature · 14 lines
changes v1 -> v2
- Drop patches 2 and 3 and combine them into a single macro in pkg-generic.mk
- Move the PRE_CONFIGURE_HOOK to inner-generic-package so it actually runs
- Rename FIXUP_PC_FILES_ABSOLUTE_PATHS to FIXUP_CONFIG_FILES_ABSOLUTE_PATHS
- Use $(HOST_DIR) instead of $(STAGING_DIR) to cover both stagin and host
directories in a single step.
2.33.1
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildrootPATCH v2 1/1 package/pkg-generic.mk: fix absolute paths in per-package config files
Some packages (notably qmake packages) generate .cmake, .pc, and .pri files with absolute paths. Unfortunately, doing so breaks per-package builds because the paths in those files point outside the per-package sysroot for packages that have rsynced those same files.
Add the new pre-configure hook "FIXUP_CONFIG_FILES_ABSOLUTE_PATHS" in package/pkg-generic.mk which searches for .cmake, .pc, and .pri files in a given per-package host and staging directory and replaces the old $(PER_PACKAGE_DIR) directory with the correct directory for the given package.
This simple fix allows qt5 submodule packages to build with per-package enabled.
Based off of Louis-Paul's earlier work found here:
https://lore.kernel.org/buildroot/[email protected]/
And Yann Morin's feedback found here:
https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/
---
changes v1 -> v2
- Drop patches 2 and 3 and combine them into a single macro in pkg-generic.mk
- Move the PRE_CONFIGURE_HOOK to inner-generic-package so it actually runs
- Rename FIXUP_PC_FILES_ABSOLUTE_PATHS to FIXUP_CONFIG_FILES_ABSOLUTE_PATHS
- Use $(HOST_DIR) instead of $(STAGING_DIR) to cover both stagin and host directories in a single step.
package/pkg-generic.mk | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
package/pkg-generic.mk +16 -0
@@ -103,6 +103,21 @@ define fixup-libtool-files endef endif +# When per-package is enabled, packages may generate files with absolute paths +# that point to the given sysroot. However, after the rsync step for another +# package that uses those files, per-package isolation is broken because the +# hard-coded paths point to directories outside the per-package sysroot. +# As a pre-configure step, sed all .cmake, .pc, and .pri files in a given +# package sysroot containing the word "per-package" and replace the line with +# the appropriate per-package directory. +ifeq ($(BR2_PER_PACKAGE_DIRECTORIES),y) +define FIXUP_CONFIG_FILES_ABSOLUTE_PATHS + $(Q)find $(HOST_DIR)/ -name "*.pc" -o -name "*.cmake" -o -name "*.pri" \ + | xargs --no-run-if-empty \ + $(SED) "s:$(PER_PACKAGE_DIR)/[^/]\+/:$(PER_PACKAGE_DIR)/$(NAME)/:g" +endef +endif + # Make sure python _sysconfigdata*.py files only reference the current # per-package directory. #
@@ -837,6 +852,7 @@ $(2)_EXTRACT_CMDS ?= \ # pre/post-steps hooks $(2)_POST_PREPARE_HOOKS += FIXUP_PYTHON_SYSCONFIGDATA +$(2)_PRE_CONFIGURE_HOOKS += FIXUP_CONFIG_FILES_ABSOLUTE_PATHS ifeq ($$($(2)_TYPE),target) ifneq ($$(HOST_$(2)_KCONFIG_VAR),)
Signature · 6 lines
2.33.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot