@@ -103,6 +103,17 @@ define fixup-libtool-files
endef
endif
+# When per-package is enabled, packages may generate .pc files with absolute
+# paths for the prefix field. Remove the absolute paths from the generated .pc
+# files to keep per-package isolation with the build sysroot.
+ifeq ($(BR2_PER_PACKAGE_DIRECTORIES),y)
+define FIXUP_PC_FILES_ABSOLUTE_PATHS
+ $(Q)find $(STAGING_DIR)/ -name "*.pc" | xargs --no-run-if-empty \
+ $(SED) "s:$(STAGING_DIR)::g"
+endef
+$(2)_PRE_CONFIGURE_HOOKS += FIXUP_PC_ABSOLUTE_PATHS
+endif
+
# Make sure python _sysconfigdata*.py files only reference the current
# per-package directory.
#
Some packages (notably qmake packages) generate .pc files with absolute paths. Unfortunately, doing so breaks per-package builds because the paths in the .pc file point outside the per-package sysroot. Add the new pre-configure-hook "FIXUP_PC_FILES_ABSOLUTE_PATHS" in package/pkg-generic.mk which searches for all .pc files in a per-package staging directory and removes the $(STAGING_DIR)/ prefix in them. This simple fix allows non-qt5base qt5 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> --- package/pkg-generic.mk | 11 +++++++++++ 1 file changed, 11 insertions(+)