* [Buildroot] [PATCH v2 0/1] Fix per-package builds with qt5 submodule packages
@ 2022-01-04 17:48 Adam Duskett
2022-01-04 17:48 ` [Buildroot] [PATCH v2 1/1] package/pkg-generic.mk: fix absolute paths in per-package config files Adam Duskett
0 siblings, 1 reply; 2+ messages in thread
From: Adam Duskett @ 2022-01-04 17:48 UTC (permalink / raw)
To: buildroot; +Cc: Adam Duskett, Thomas Petazzoni
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/a339f273-33f3-f232-eac4-6e50427abf6d@cordier.org/
2) https://patchwork.ozlabs.org/project/buildroot/patch/20200217212350.29750-21-anaumann@ultratronik.de/
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(+)
--
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
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Buildroot] [PATCH v2 1/1] package/pkg-generic.mk: fix absolute paths in per-package config files
2022-01-04 17:48 [Buildroot] [PATCH v2 0/1] Fix per-package builds with qt5 submodule packages Adam Duskett
@ 2022-01-04 17:48 ` Adam Duskett
0 siblings, 0 replies; 2+ messages in thread
From: Adam Duskett @ 2022-01-04 17:48 UTC (permalink / raw)
To: buildroot; +Cc: Adam Duskett, Thomas Petazzoni
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/a339f273-33f3-f232-eac4-6e50427abf6d@cordier.org/
And Yann Morin's feedback found here:
https://patchwork.ozlabs.org/project/buildroot/patch/20200217212350.29750-21-anaumann@ultratronik.de/
Signed-off-by: Adam Duskett <aduskett@gmail.com>
---
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(+)
diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk
index 5626af1d87..5a2b4ccaf8 100644
--- a/package/pkg-generic.mk
+++ b/package/pkg-generic.mk
@@ -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),)
--
2.33.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-01-04 17:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-04 17:48 [Buildroot] [PATCH v2 0/1] Fix per-package builds with qt5 submodule packages Adam Duskett
2022-01-04 17:48 ` [Buildroot] [PATCH v2 1/1] package/pkg-generic.mk: fix absolute paths in per-package config files Adam Duskett
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.