Message ID | 20230207171721.2973997-14-angelo@amarulasolutions.com |
---|---|
State | Changes Requested |
Headers | show |
Series | Extend Qt6 configuration | expand |
Hello, On Tue, 7 Feb 2023 18:17:21 +0100 Angelo Compagnucci <angelo@amarulasolutions.com> wrote: > diff --git a/package/qt6/qt6base/qt.conf.in b/package/qt6/qt6base/qt.conf.in > new file mode 100644 > index 0000000000..4842bcb462 > --- /dev/null > +++ b/package/qt6/qt6base/qt.conf.in > @@ -0,0 +1,7 @@ > +[Paths] > +Prefix=/usr > +HostPrefix=@@HOST_DIR@@ > +HostData=../target/usr This looks very very odd, and most likely doesn't work. If I understand correctly, this is a path that will be interpreted relatively to $(HOST_DIR), so this value assumes that host/ and target/ are side by side, but that's not true in the general case. Indeed, BR2_HOST_DIR allows to customize where $(HOST_DIR) is located, and it can be elsewhere than side by side to target/. What is this trying to do exactly? > +Sysroot=@@STAGING_DIR@@ > +SysrootifyPrefix=true > +TargetSpec=devices/linux-buildroot-g++ > diff --git a/package/qt6/qt6base/qt6base.mk b/package/qt6/qt6base/qt6base.mk > index ec1c65f827..f37b2bafce 100644 > --- a/package/qt6/qt6base/qt6base.mk > +++ b/package/qt6/qt6base/qt6base.mk > @@ -54,6 +54,9 @@ QT6BASE_CONF_OPTS = \ > -DFEATURE_system_zlib=ON \ > -DFEATURE_system_libb2=ON > > +QT6BASE_CFLAGS = $(TARGET_CFLAGS) > +QT6BASE_CXXFLAGS = $(TARGET_CXXFLAGS) > + > # x86 optimization options. While we have a BR2_X86_CPU_HAS_AVX512, it > # is not clear yet how it maps to all the avx512* options of Qt, so we > # for now keeps them disabled. > @@ -384,5 +387,18 @@ else > QT6BASE_CONF_OPTS += -DFEATURE_zstd=OFF > endif > > +define QT6BASE_MAKE_BR_SPEC > + $(INSTALL) -m 0644 -D $(QT6BASE_PKGDIR)/qmake.conf.in \ > + $(@D)/mkspecs/devices/linux-buildroot-g++/qmake.conf > + $(INSTALL) -m 0644 -D $(QT6BASE_PKGDIR)/qplatformdefs.h \ > + $(@D)/mkspecs/devices/linux-buildroot-g++/qplatformdefs.h > +endef > + > +QT6BASE_CONF_OPTS += -DQT_QMAKE_DEVICE_OPTIONS=CROSS_COMPILE="$(TARGET_CROSS)";BR_COMPILER_CFLAGS="$(QT6BASE_CFLAGS)";BR_COMPILER_CXXFLAGS="$(QT6BASE_CXX_FLAGS)" > + > +QT6BASE_PRE_CONFIGURE_HOOKS += QT6BASE_MAKE_BR_SPEC > + > +QT6BASE_POST_INSTALL_STAGING_HOOKS += QT6_INSTALL_QT_CONF Where is QT6_INSTALL_QT_CONF implemented ? Thomas
Hello Thomas, You're right, this won't work with a relocated HOST_DIR the QT6_INSTALL_QT_CONF seems to have gotten dropped in Angelo his patch series, I'll rebase onto what has been approved and submit a new series for the qmake functionality. Thanks for the reviews! Regards, Jesse Op wo 8 feb. 2023 om 12:18 schreef Thomas Petazzoni <thomas.petazzoni@bootlin.com>: > > Hello, > > On Tue, 7 Feb 2023 18:17:21 +0100 > Angelo Compagnucci <angelo@amarulasolutions.com> wrote: > > > diff --git a/package/qt6/qt6base/qt.conf.in b/package/qt6/qt6base/qt.conf.in > > new file mode 100644 > > index 0000000000..4842bcb462 > > --- /dev/null > > +++ b/package/qt6/qt6base/qt.conf.in > > @@ -0,0 +1,7 @@ > > +[Paths] > > +Prefix=/usr > > +HostPrefix=@@HOST_DIR@@ > > +HostData=../target/usr > > This looks very very odd, and most likely doesn't work. If I understand > correctly, this is a path that will be interpreted relatively to > $(HOST_DIR), so this value assumes that host/ and target/ are side by > side, but that's not true in the general case. Indeed, BR2_HOST_DIR > allows to customize where $(HOST_DIR) is located, and it can be > elsewhere than side by side to target/. > > What is this trying to do exactly? > > > > > +Sysroot=@@STAGING_DIR@@ > > +SysrootifyPrefix=true > > +TargetSpec=devices/linux-buildroot-g++ > > diff --git a/package/qt6/qt6base/qt6base.mk b/package/qt6/qt6base/qt6base.mk > > index ec1c65f827..f37b2bafce 100644 > > --- a/package/qt6/qt6base/qt6base.mk > > +++ b/package/qt6/qt6base/qt6base.mk > > @@ -54,6 +54,9 @@ QT6BASE_CONF_OPTS = \ > > -DFEATURE_system_zlib=ON \ > > -DFEATURE_system_libb2=ON > > > > +QT6BASE_CFLAGS = $(TARGET_CFLAGS) > > +QT6BASE_CXXFLAGS = $(TARGET_CXXFLAGS) > > + > > # x86 optimization options. While we have a BR2_X86_CPU_HAS_AVX512, it > > # is not clear yet how it maps to all the avx512* options of Qt, so we > > # for now keeps them disabled. > > @@ -384,5 +387,18 @@ else > > QT6BASE_CONF_OPTS += -DFEATURE_zstd=OFF > > endif > > > > +define QT6BASE_MAKE_BR_SPEC > > + $(INSTALL) -m 0644 -D $(QT6BASE_PKGDIR)/qmake.conf.in \ > > + $(@D)/mkspecs/devices/linux-buildroot-g++/qmake.conf > > + $(INSTALL) -m 0644 -D $(QT6BASE_PKGDIR)/qplatformdefs.h \ > > + $(@D)/mkspecs/devices/linux-buildroot-g++/qplatformdefs.h > > +endef > > + > > +QT6BASE_CONF_OPTS += -DQT_QMAKE_DEVICE_OPTIONS=CROSS_COMPILE="$(TARGET_CROSS)";BR_COMPILER_CFLAGS="$(QT6BASE_CFLAGS)";BR_COMPILER_CXXFLAGS="$(QT6BASE_CXX_FLAGS)" > > + > > +QT6BASE_PRE_CONFIGURE_HOOKS += QT6BASE_MAKE_BR_SPEC > > + > > +QT6BASE_POST_INSTALL_STAGING_HOOKS += QT6_INSTALL_QT_CONF > > Where is QT6_INSTALL_QT_CONF implemented ? > > Thomas > -- > Thomas Petazzoni, co-owner and CEO, Bootlin > Embedded Linux and Kernel engineering and training > https://bootlin.com
diff --git a/package/qt6/qt6.mk b/package/qt6/qt6.mk index 431bb8c9d3..847286a3fc 100644 --- a/package/qt6/qt6.mk +++ b/package/qt6/qt6.mk @@ -10,3 +10,15 @@ QT6_SOURCE_TARBALL_PREFIX = everywhere-src QT6_SITE = https://download.qt.io/archive/qt/$(QT6_VERSION_MAJOR)/$(QT6_VERSION)/submodules include $(sort $(wildcard package/qt6/*/*.mk)) + +# The file "qt.conf" can be used to override the hard-coded paths that are +# compiled into the Qt library. We need it to make "qmake" relocatable due +# to the host/target build and tweak the per-package install pathes +define QT6_INSTALL_QT_CONF + rm -f $(HOST_DIR)/bin/qt.conf + sed -e "s|@@HOST_DIR@@|$(HOST_DIR)|" -e "s|@@STAGING_DIR@@|$(STAGING_DIR)|" \ + $(QT6BASE_PKGDIR)/qt.conf.in > $(HOST_DIR)/bin/qt.conf +endef + +# Variable for other Qt applications to use +QT6_QMAKE = $(HOST_DIR)/bin/qmake -spec devices/linux-buildroot-g++ diff --git a/package/qt6/qt6base/qmake.conf.in b/package/qt6/qt6base/qmake.conf.in new file mode 100644 index 0000000000..e0d53d755d --- /dev/null +++ b/package/qt6/qt6base/qmake.conf.in @@ -0,0 +1,34 @@ +# Qt6 has a mechanism to support "device" profiles, so that people can +# specify the compiler, compiler flags and so on for a specific device. + +# We leverage this mechanism in the Buildroot packaging of qt6 to +# simplify cross-compilation: we have our own "device" definition, which +# allows us to easily pass the cross-compiler paths and flags from our +# qt6.mk. + +include(../common/linux_device_pre.conf) + +# modifications to g++-unix.conf +QMAKE_CC = $${CROSS_COMPILE}gcc +QMAKE_CXX = $${CROSS_COMPILE}g++ +QMAKE_LINK = $${CROSS_COMPILE}g++ + +# modifications to gcc-base.conf +QMAKE_CFLAGS += $${BR_COMPILER_CFLAGS} +QMAKE_CXXFLAGS += $${BR_COMPILER_CXXFLAGS} +# Remove all optimisation flags, we really only want our own. +QMAKE_CFLAGS_OPTIMIZE = +QMAKE_CFLAGS_OPTIMIZE_DEBUG = +QMAKE_CFLAGS_OPTIMIZE_FULL = +QMAKE_CFLAGS_OPTIMIZE_SIZE = +QMAKE_CFLAGS_DEBUG = +QMAKE_CXXFLAGS_DEBUG = +QMAKE_CFLAGS_RELEASE = +QMAKE_CXXFLAGS_RELEASE = +CONFIG += nostrip + +QMAKE_LIBS += -lrt -lpthread -ldl +QMAKE_CFLAGS_ISYSTEM = + +include(../common/linux_device_post.conf) +load(qt_config) diff --git a/package/qt6/qt6base/qplatformdefs.h b/package/qt6/qt6base/qplatformdefs.h new file mode 100644 index 0000000000..99e9a27923 --- /dev/null +++ b/package/qt6/qt6base/qplatformdefs.h @@ -0,0 +1 @@ +#include "../../linux-g++/qplatformdefs.h" diff --git a/package/qt6/qt6base/qt.conf.in b/package/qt6/qt6base/qt.conf.in new file mode 100644 index 0000000000..4842bcb462 --- /dev/null +++ b/package/qt6/qt6base/qt.conf.in @@ -0,0 +1,7 @@ +[Paths] +Prefix=/usr +HostPrefix=@@HOST_DIR@@ +HostData=../target/usr +Sysroot=@@STAGING_DIR@@ +SysrootifyPrefix=true +TargetSpec=devices/linux-buildroot-g++ diff --git a/package/qt6/qt6base/qt6base.mk b/package/qt6/qt6base/qt6base.mk index ec1c65f827..f37b2bafce 100644 --- a/package/qt6/qt6base/qt6base.mk +++ b/package/qt6/qt6base/qt6base.mk @@ -54,6 +54,9 @@ QT6BASE_CONF_OPTS = \ -DFEATURE_system_zlib=ON \ -DFEATURE_system_libb2=ON +QT6BASE_CFLAGS = $(TARGET_CFLAGS) +QT6BASE_CXXFLAGS = $(TARGET_CXXFLAGS) + # x86 optimization options. While we have a BR2_X86_CPU_HAS_AVX512, it # is not clear yet how it maps to all the avx512* options of Qt, so we # for now keeps them disabled. @@ -384,5 +387,18 @@ else QT6BASE_CONF_OPTS += -DFEATURE_zstd=OFF endif +define QT6BASE_MAKE_BR_SPEC + $(INSTALL) -m 0644 -D $(QT6BASE_PKGDIR)/qmake.conf.in \ + $(@D)/mkspecs/devices/linux-buildroot-g++/qmake.conf + $(INSTALL) -m 0644 -D $(QT6BASE_PKGDIR)/qplatformdefs.h \ + $(@D)/mkspecs/devices/linux-buildroot-g++/qplatformdefs.h +endef + +QT6BASE_CONF_OPTS += -DQT_QMAKE_DEVICE_OPTIONS=CROSS_COMPILE="$(TARGET_CROSS)";BR_COMPILER_CFLAGS="$(QT6BASE_CFLAGS)";BR_COMPILER_CXXFLAGS="$(QT6BASE_CXX_FLAGS)" + +QT6BASE_PRE_CONFIGURE_HOOKS += QT6BASE_MAKE_BR_SPEC + +QT6BASE_POST_INSTALL_STAGING_HOOKS += QT6_INSTALL_QT_CONF + $(eval $(cmake-package)) $(eval $(host-cmake-package))