From 0c39484ffca3c09bbc15bd97216e905fbe230d3c Mon Sep 17 00:00:00 2001 From: Mirko Vogt Date: Mon, 20 Feb 2017 18:40:58 +0100 Subject: [PATCH] qt5base: also build for host Although Qt has the functionality of 's, it's supposed to be used and explicitly stated in project files, so it can't be switched on from the outside (e.g. via flags or env vars). On top of that all builds using the directive get linked against libQtBootstrap.a which is not always desired. libQtBootstrap.a is also the only file available for host builds, which means, 's can't just make use of and and link against e.g. libQtCore, as those objects only get compiled for the target, not for the host. Because of above reasons, we build Qt twice now, once for the host, once for the target. --- frameworks/qt5base/Makefile | 114 ++++++++++++++++++++++++++++++ frameworks/qt5base/files/qmake.mk | 28 +++++++- 2 files changed, 141 insertions(+), 1 deletion(-) diff --git a/frameworks/qt5base/Makefile b/frameworks/qt5base/Makefile index 77104be..1490ff4 100644 --- a/frameworks/qt5base/Makefile +++ b/frameworks/qt5base/Makefile @@ -21,12 +21,15 @@ PKG_SOURCE:=$(PKG_SYS_NAME).tar.xz PKG_SOURCE_URL:=http://download.qt-project.org/official_releases/qt/$(basename $(PKG_VERSION))/$(PKG_VERSION)/submodules PKG_BUILD_DIR=$(BUILD_DIR)/$(PKG_SYS_NAME) +HOST_BUILD_DIR=$(BUILD_DIR)/host/$(PKG_SYS_NAME) PKG_BUILD_PARALLEL:=1 +HOST_BUILD_PARALLEL:=1 PKG_BUILD_DEPENDS:=librpc PKG_INSTALL:=1 PKG_USE_MIPS16:=0 include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/host-build.mk include $(INCLUDE_DIR)/nls.mk include ./files/qmake.mk @@ -283,6 +286,7 @@ define Build/Configure -prefix $(QT_INSTALL_PREFIX) \ -extprefix $(QT_EXTPREFIX) \ -hostprefix $(QT_HOST_PREFIX) \ + -hostdatadir $(QT_HOST_PREFIX)/share \ -no-gcc-sysroot \ -bindir $(QT_INSTALL_BINS) \ -headerdir $(QT_INSTALL_HEADERS) \ @@ -390,6 +394,89 @@ define Build/Configure ) endef + +define Host/Configure + # CROSS/TARGET_* need to be passed to configure, in order to use cross-compiling tools to check for requirements. + # Usually used variables such as CC/CXX/CFLAGS/CXXFLAGS/LDFLAGS would be used for compilation of host tools (qmake, moc, etc.), + # hence we use the TARGET_* nomenclature. + ( cd $(HOST_BUILD_DIR) ; \ + TARGET_CFLAGS="$(HOST_CFLAGS)" \ + TARGET_CXXFLAGS="$(HOST_CFLAGS) $(HOST_CXXFLAGS)" \ + TARGET_LDFLAGS="$(HOST_LDFLAGS)" \ + ./configure \ + -prefix $(STAGING_DIR_HOST) \ + -hostprefix $(STAGING_DIR_HOST) \ + -hostdatadir $(STAGING_DIR_HOST)/share \ + -datadir $(STAGING_DIR_HOST)/share \ + -archdatadir $(STAGING_DIR_HOST)/lib \ + -no-gcc-sysroot \ + -verbose \ + -opensource \ + -confirm-license \ + -release \ + -no-optimized-tools \ + -no-strip \ + -shared \ + -no-framework \ + -nomake tools \ + -nomake examples \ + -no-compile-examples \ + -gui \ + -no-widgets \ + -no-dbus \ + -no-accessibility \ + -no-qml-debug \ + -qt-doubleconversion \ + -no-glib \ + -no-eventfd \ + -no-inotify \ + -no-icu \ + -qt-pcre \ + -qt-zlib \ + -no-journald \ + -no-syslog \ + -no-ssl \ + -no-openssl \ + -no-cups \ + -no-fontconfig \ + -qt-freetype \ + -no-harfbuzz \ + -no-gtk \ + -no-opengl \ + -no-xcb-xlib \ + -no-xcb \ + -no-directfb \ + -no-eglfs \ + -no-gbm \ + -no-kms \ + -no-linuxfb \ + -no-mirclient \ + -no-xcb \ + -evdev \ + -no-libinput \ + -no-mtdev \ + -no-tslib \ + -no-xinput2 \ + -no-xkbcommon-x11 \ + -no-xkbcommon-evdev \ + -no-gif \ + -no-ico \ + -qt-libpng \ + -no-libjpeg \ + -no-sql-db2 \ + -no-sql-ibase \ + -no-sql-mysql \ + -no-sql-oci \ + -no-sql-odbc \ + -no-sql-psql \ + -no-sql-sqlite \ + -no-sql-sqlite2 \ + -no-sql-tds \ + -no-libproxy \ + -no-xkbcommon \ + ) +endef + define Build/InstallDev $(INSTALL_DIR) \ $(STAGING_DIR)/host/mk @@ -403,6 +490,32 @@ define Build/InstallDev $(call Build/Install/Libs,$(1),*) endef +define Host/Install + $(call Host/Install/Default) + + $(INSTALL_DIR) \ + $(STAGING_DIR_HOST)/bin \ + $(STAGING_DIR_HOST)/lib \ + $(STAGING_DIR_HOST)/include \ + $(STAGING_DIR_HOST)/share + + $(CP) \ + $(HOST_INSTALL_DIR)/lib/* \ + $(STAGING_DIR_HOST)/lib/ + + $(CP) \ + $(HOST_INSTALL_DIR)/include/* \ + $(STAGING_DIR_HOST)/include/ + + $(CP) \ + $(HOST_INSTALL_DIR)/share/* \ + $(STAGING_DIR_HOST)/share/ + + $(CP) \ + $(HOST_INSTALL_DIR)/bin/qmake \ + $(STAGING_DIR_HOST)/bin/qmake_host +endef + define Package/qt5base-concurrent/install $(call Build/Install/Libs,$(1),libQt5Concurrent) endef @@ -534,3 +647,4 @@ $(eval $(call BuildPackage,qt5base-plugin-platforms-offscreen)) $(eval $(call BuildPackage,qt5base-plugin-platforms-vnc)) #$(eval $(call BuildPackage,qt5base-plugin-sqldrivers-sqlite)) $(eval $(call BuildPackage,qt5base-examples)) +$(eval $(call HostBuild)) diff --git a/frameworks/qt5base/files/qmake.mk b/frameworks/qt5base/files/qmake.mk index 343572a..3feabc6 100644 --- a/frameworks/qt5base/files/qmake.mk +++ b/frameworks/qt5base/files/qmake.mk @@ -37,7 +37,7 @@ # objects on the target platform. Tihs behaviour wasn't observed so far, however # one might use the QT_INSTALL_* variables for some weird reason during runtime. - +# for target builds (STAGING_DIR) QT_EXTPREFIX:=$(STAGING_DIR)/$(CONFIGURE_PREFIX) QT_SYSROOT:= QT_INSTALL_CONFIGURATION:=/etc/qt5 @@ -56,6 +56,7 @@ QT_INSTALL_IMPORTS:=$(QT_INSTALL_ARCHDATA)/imports QT_INSTALL_QML:=$(QT_INSTALL_ARCHDATA)/qml QT_INSTALL_EXAMPLES:=$(QT_INSTALL_ARCHDATA)/examples QT_INSTALL_DEMOS:=$(QT_INSTALL_EXAMPLES) +# for host builds defined in target project files (STAGING_DIR)/host QT_HOST_EXTPREFIX:=$(STAGING_DIR)/host QT_HOST_PREFIX:=$(QT_HOST_EXTPREFIX) QT_HOST_DATA:=$(QT_HOST_PREFIX)/share @@ -68,6 +69,11 @@ QMAKE_XSPEC:=linux-openwrt-g++ PKG_INSTALL_DIR_ROOT:=$(PKG_INSTALL_DIR) PKG_INSTALL_DIR:=$(PKG_INSTALL_DIR_ROOT)/$(STAGING_DIR) +# for target independant host builds (STAGING_DIR_HOST) +HOST_INSTALL_DIR_ROOT:=$(HOST_INSTALL_DIR) +HOST_INSTALL_DIR:=$(HOST_INSTALL_DIR_ROOT)/$(STAGING_DIR_HOST) +#HOST_INSTALL_DIR:=$(HOST_INSTALL_DIR_ROOT)/$(STAGING_DIR) + define Build/Configure/Default TARGET_CROSS="$(TARGET_CROSS)" \ TARGET_CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \ @@ -78,6 +84,12 @@ define Build/Configure/Default $(PKG_BUILD_DIR)/$(MAKE_PATH)/$(if $(1),$(1).pro,) endef +define Host/Configure/Default + qmake_host \ + -o $(HOST_BUILD_DIR)/$(MAKE_PATH)/Makefile \ + $(HOST_BUILD_DIR)/$(MAKE_PATH)/$(if $(1),$(1).pro,) +endef + # We need to pass all qmake related variables to $(MAKE) as well, as (generated) Makefiles may invoke qmake once again for creating further Makefiles. # Actually we'd also like to pass $MAKE_VARS and $MAKE_FLAGS to also make ordinary non-qmake generated Makefiles calling toolchain executables # like $CC/$CXX/.. work, however this would interfere with qmake generated Makefiles, since they expect variables being set differently. @@ -93,12 +105,26 @@ define Build/Compile/Default $(1) endef +define Host/Compile/Default + +TARGET_CFLAGS="$(HOST_CPPFLAGS) $(HOST_CFLAGS)" \ + TARGET_CXXFLAGS="$(HOST_CPPFLAGS) $(HOST_CXXFLAGS)" \ + TARGET_LDFLAGS="$(HOST_LDFLAGS)" \ + $(MAKE) $(PKG_JOBS) -C $(HOST_BUILD_DIR)/$(MAKE_PATH) \ + $(1) +endef + define Build/Install/Default INSTALL_ROOT="$(PKG_INSTALL_DIR_ROOT)" \ $(MAKE) -C $(PKG_BUILD_DIR)/$(MAKE_PATH) \ $(1) install endef +define Host/Install/Default + INSTALL_ROOT="$(HOST_INSTALL_DIR_ROOT)" \ + $(MAKE) -C $(HOST_BUILD_DIR)/$(MAKE_PATH) \ + $(1) install +endef + define Build/Install/HostFiles $(INSTALL_DIR) \ $(1)/host -- 2.30.2