From 0263af75c053d1d7ea4882a75cf59b230fbb88ad Mon Sep 17 00:00:00 2001 From: Samuli Piippo Date: Mon, 18 Jun 2018 10:52:40 +0300 Subject: qt5: add option to build Qt5 statically Add PACKAGECONFIG that enables static build for qtbase and consequently to all Qt recipes. This can be enabled with DISTRO_FEATURE 'qt5-static', which also adds qtdeclarative-native dependency to all recipes that depend on qtdeclarative as it's required for qmlimportscannertool. Building examples and tests with static build can take excessive amounts of time and disk space, so disabling DISTRO_FEATURE 'ptest' and PACKAGECONFIGs 'examples' from qtbase is advised. Not all recipes support static builds and those are not fixed here. Change-Id: Ia0e2a2467cd42d4395ed5292a645fd1d89ad521a Signed-off-by: Samuli Piippo --- recipes-qt/qt5/qt5.inc | 22 ++++++++++++++++++++++ recipes-qt/qt5/qtbase_git.bb | 2 ++ recipes-qt/qt5/qtdeclarative_git.bb | 3 ++- recipes-qt/qt5/qtwebengine_git.bb | 4 ++++ 4 files changed, 30 insertions(+), 1 deletion(-) (limited to 'recipes-qt') diff --git a/recipes-qt/qt5/qt5.inc b/recipes-qt/qt5/qt5.inc index b4915138..99105bd9 100644 --- a/recipes-qt/qt5/qt5.inc +++ b/recipes-qt/qt5/qt5.inc @@ -37,6 +37,14 @@ python __anonymous() { d.setVar("PACKAGE_ARCH", tarch) } +# if building static Qt5, add qtdeclarative-native dependency to all recipes +# that depend on qtdeclarative as it's required for qmlimportscannertool +python __anonymous() { + if bb.utils.contains('DISTRO_FEATURES', "qt5-static", True, False, d): + if bb.utils.contains('DEPENDS', "qtdeclarative", True, False, d): + d.appendVar("DEPENDS", " qtdeclarative-native") +} + # Many examples come with libraries installed outside of standard libdir, # suppress QA check complaining INSANE_SKIP_${PN}-dbg += "libdir" @@ -48,6 +56,8 @@ PACKAGES =. "${PN}-qmlplugins-dbg ${PN}-tools-dbg ${PN}-plugins-dbg ${PN}-qmldes ALLOW_EMPTY_${PN} = "1" ALLOW_EMPTY_${PN}-dbg = "1" +ALLOW_EMPTY_${PN}-plugins = "1" +ALLOW_EMPTY_${PN}-qmlplugins = "1" RRECOMMENDS_${PN} = " \ ${PN}-plugins \ @@ -159,6 +169,18 @@ FILES_${PN}-dbg += " \ " FILES_${PN}-staticdev += " \ ${OE_QMAKE_PATH_LIBS}/*.a \ + ${OE_QMAKE_PATH_PLUGINS}/*/*.a \ + ${OE_QMAKE_PATH_PLUGINS}/*/*.prl \ + ${OE_QMAKE_PATH_PLUGINS}/*/*/*.a \ + ${OE_QMAKE_PATH_PLUGINS}/*/*/*.prl \ + ${OE_QMAKE_PATH_QML}/*/*.a \ + ${OE_QMAKE_PATH_QML}/*/*.prl \ + ${OE_QMAKE_PATH_QML}/*/*/*.a \ + ${OE_QMAKE_PATH_QML}/*/*/*.prl \ + ${OE_QMAKE_PATH_QML}/*/*/*/*.a \ + ${OE_QMAKE_PATH_QML}/*/*/*/*.prl \ + ${OE_QMAKE_PATH_QML}/*/*/*/*/*.a \ + ${OE_QMAKE_PATH_QML}/*/*/*/*/*.prl \ " FILES_${PN}-examples = " \ ${OE_QMAKE_PATH_EXAMPLES}/* \ diff --git a/recipes-qt/qt5/qtbase_git.bb b/recipes-qt/qt5/qtbase_git.bb index bf05cf81..fdaf031f 100644 --- a/recipes-qt/qt5/qtbase_git.bb +++ b/recipes-qt/qt5/qtbase_git.bb @@ -70,6 +70,7 @@ PACKAGECONFIG_RELEASE ?= "release" # PACKAGECONFIG_OPENSSL ?= "openssl" PACKAGECONFIG_DEFAULT ?= "dbus udev evdev widgets tools libs freetype tests \ ${@bb.utils.contains('SELECTED_OPTIMIZATION', '-Os', 'optimize-size ltcg', '', d)} \ + ${@bb.utils.contains('DISTRO_FEATURES', 'qt5-static', 'static', '', d)} \ " PACKAGECONFIG ?= " \ @@ -84,6 +85,7 @@ PACKAGECONFIG ?= " \ ${PACKAGECONFIG_DISTRO} \ " +PACKAGECONFIG[static] = "-static,-shared" PACKAGECONFIG[release] = "-release,-debug" PACKAGECONFIG[debug] = "" PACKAGECONFIG[developer] = "-developer-build" diff --git a/recipes-qt/qt5/qtdeclarative_git.bb b/recipes-qt/qt5/qtdeclarative_git.bb index 69e90570..e6173b4e 100644 --- a/recipes-qt/qt5/qtdeclarative_git.bb +++ b/recipes-qt/qt5/qtdeclarative_git.bb @@ -14,10 +14,11 @@ LIC_FILES_CHKSUM = " \ DEPENDS += "qtbase" -PACKAGECONFIG ??= "qtxmlpatterns qml-debug qml-network" +PACKAGECONFIG ??= "qtxmlpatterns qml-debug qml-network ${@bb.utils.contains('DISTRO_FEATURES', 'qt5-static', 'static', '', d)}" PACKAGECONFIG[qtxmlpatterns] = ",,qtxmlpatterns" PACKAGECONFIG[qml-debug] = "-qml-debug,-no-qml-debug" PACKAGECONFIG[qml-network] = "-qml-network, -no-qml-network" +PACKAGECONFIG[static] = ",,qtdeclarative-native" do_configure_prepend() { # disable qtxmlpatterns test if it isn't enabled by PACKAGECONFIG diff --git a/recipes-qt/qt5/qtwebengine_git.bb b/recipes-qt/qt5/qtwebengine_git.bb index 11ee347e..32ad875c 100644 --- a/recipes-qt/qt5/qtwebengine_git.bb +++ b/recipes-qt/qt5/qtwebengine_git.bb @@ -73,6 +73,10 @@ inherit qmake5 inherit gettext inherit pythonnative inherit perlnative +inherit distro_features_check + +# Static builds of QtWebEngine aren't supported. +CONFLICT_DISTRO_FEATURES = "qt5-static" # we don't want gettext.bbclass to append --enable-nls def gettext_oeconf(d): -- cgit v1.2.3-54-g00ecf