QT5: Fix per-package builds with non-qt5base packages
cover QT5: Fix per-package builds with non-qt5base packages
These patches fix per-package builds with non-qt5base qt5 packages.
Based off of Louis-Paul's earlier work[1] and And Yann Morin's feedback to a different patch set[2], the simple fix is to add a few pre-configure hook methods to pkg-generic.mk, pkg-cmake.mk, and pkg-qmake.mk which search for .pc, .cmake, and .pri files for the $(STAGING_DIR)/ prefix and removes them.
Feedback is welcome!
Adam
1) https://lore.kernel.org/buildroot/[email protected]/
2) https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/
Adam Duskett (3):
package/pkg-generic.mk: fix absolute paths in .pc files for
per-package builds 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.
package/pkg-cmake.mk: fix absolute paths in .cmake files for
per-package builds
package/pkg-qmake.mk: fix absolute paths in .pri files for per-package
builds
package/pkg-cmake.mk | 11 +++++++++++ package/pkg-generic.mk | 11 +++++++++++ package/pkg-qmake.mk | 11 +++++++++++ 3 files changed, 33 insertions(+)
Signature · 6 lines
2.33.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 1/3 package/pkg-generic.mk: fix absolute paths in .pc files for per-package builds
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/[email protected]/
And Yann Morin's feedback found here:
https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/
--- package/pkg-generic.mk | 11 +++++++++++ 1 file changed, 11 insertions(+)
package/pkg-generic.mk +11 -0
@@ -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. #
Signature · 6 lines
2.33.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 2/3 package/pkg-cmake.mk: fix absolute paths in .cmake files for per-package builds
In reply to Adam DuskettSome packages (notably qmake packages) generate .cmake files with absolute paths. Unfortunately, doing so breaks per-package builds because the paths in the .cmake files point outside the per-package sysroot.
Add the new pre-configure-hook "FIXUP_CMAKECONFIG_ABSOLUTE_PATHS" in package/pkg-cmake.mk which searches for all .cmake files in a per-package staging directory and removes the $(STAGING_DIR)/ prefix from 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/[email protected]/
And Yann Morin's feedback found here:
https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/
--- package/pkg-cmake.mk | 11 +++++++++++ 1 file changed, 11 insertions(+)
package/pkg-cmake.mk +11 -0
@@ -65,6 +65,17 @@ else $(2)_BUILDDIR = $$($(2)_SRCDIR)/buildroot-build endif +# Some packages may generate cmake files with absolute paths. Remove the +# absolute paths from the generated cmake files to keep per-package isolation +# with the build sysroot. +ifeq ($(BR2_PER_PACKAGE_DIRECTORIES),y) +define FIXUP_CMAKECONFIG_ABSOLUTE_PATHS + $(Q)find $(STAGING_DIR)/ -name "*.cmake" | xargs --no-run-if-empty \ + $(SED) "s:$(STAGING_DIR)::g" +endef +$(2)_PRE_CONFIGURE_HOOKS += FIXUP_CMAKECONFIG_ABSOLUTE_PATHS +endif + # # Configure step. Only define it if not already defined by the package # .mk file. And take care of the differences between host and target
Signature · 6 lines
2.33.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 3/3 package/pkg-qmake.mk: fix absolute paths in .pri files for per-package builds
In reply to Adam DuskettQmake generates .pri files with absolute paths. Unfortunately, doing so breaks per-package builds because the paths in the .pri files point outside the per-package sysroot.
Add the new pre-configure-hook "FIXUP_PRI_FILES_ABSOLUTE_PATHS" in package/pkg-qmake.mk which searches for all .pri files in a per-package staging directory and removes the $(STAGING_DIR)/ prefix in them. This simple fix allows non-qt5base qt5 packages that use .pri files 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]/
--- package/pkg-qmake.mk | 11 +++++++++++ 1 file changed, 11 insertions(+)
package/pkg-qmake.mk +11 -0
@@ -27,6 +27,17 @@ define QT_HEADERS_SYNC_HOOK $(Q)cd $($(PKG)_BUILDDIR) && $(HOST_DIR)/bin/syncqt.pl -version $(QT5_VERSION) endef +# When per-package is enabled, qmake packages may generate .pri files with +# absolute paths Remove the absolute paths from the generated .pri files to +# keep per-package isolation with the build sysroot. +ifeq ($(BR2_PER_PACKAGE_DIRECTORIES),y) +define FIXUP_PRI_FILES_ABSOLUTE_PATHS + $(Q)find $(HOST_DIR)/ -name "*.pri" | xargs --no-run-if-empty \ + $(SED) "s:$(STAGING_DIR):\$$\$$\[QT_SYSROOT\]:g" +endef +$(2)_PRE_CONFIGURE_HOOKS += FIXUP_PC_ABSOLUTE_PATHS +endif + ################################################################################ # inner-qmake-package -- defines how the configuration, compilation and # installation of a qmake package should be done, implements a few hooks
Signature · 6 lines
2.33.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot