Skip to contentSkip to conversation

qtconnectivity, qtsystems: fix bluetooth support

PATCH In review Javier Viguera 2 participants 8 messages Jan 4, 2016 – Mar 1, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qtconnectivity, qtsystems: fix bluetooth support

QMAKE_CACHE_EVAL is only used in qtwebengine and qtwebkit, but not in the rest of the QT5 packages, so use EXTRA_QMAKEVARS_PRE to pass the packageconfig options to the do_configure task.

Also generalize bluetooth support so it can be used not only with bluez4 but with bluez5 as well.

---
 recipes-qt/qt5/qtconnectivity_git.bb | 9 ++++++---
 recipes-qt/qt5/qtsystems_git.bb      | 9 ++++++---
 2 files changed, 12 insertions(+), 6 deletions(-)
recipes-qt/qt5/qtconnectivity_git.bb +6 -3
index b1e155e2b48d..f677f7107465 100644
@@ -13,11 +13,14 @@ LIC_FILES_CHKSUM = " \
 
 DEPENDS += "qtbase qtdeclarative"
 
-PACKAGECONFIG ??= ""
-PACKAGECONFIG[bluez4] = "OE_BLUEZ_ENABLED,,bluez4"
+inherit bluetooth
+
+PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'bluetooth', 'bluez', '', d)}"
+PACKAGECONFIG[bluez] = "CONFIG+=OE_BLUEZ_ENABLED,,${BLUEZ}"
+
+EXTRA_QMAKEVARS_PRE += "${EXTRA_OECONF}"
 
 do_configure_prepend() {
-    export QMAKE_CACHE_EVAL="CONFIG+=${EXTRA_OECONF}"
     # disable bluez test if it isn't enabled by PACKAGECONFIG
     sed -i 's/^qtCompileTest(bluez)/OE_BLUEZ_ENABLED:qtCompileTest(bluez)/g' ${S}/qtconnectivity.pro
 }
recipes-qt/qt5/qtsystems_git.bb +6 -3
index 27d2bff37b51..9d9d245d2d09 100644
@@ -11,11 +11,14 @@ LIC_FILES_CHKSUM = " \
 
 DEPENDS += "qtbase qtdeclarative udev gconf"
 
-PACKAGECONFIG ??= ""
-PACKAGECONFIG[bluez4] = "OE_BLUEZ_ENABLED,,bluez4"
+inherit bluetooth
+
+PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'bluetooth', 'bluez', '', d)}"
+PACKAGECONFIG[bluez] = "CONFIG+=OE_BLUEZ_ENABLED,,${BLUEZ}"
+
+EXTRA_QMAKEVARS_PRE += "${EXTRA_OECONF}"
 
 do_configure_prepend() {
-    export QMAKE_CACHE_EVAL="CONFIG+=${EXTRA_OECONF}"
     # disable bluez test if it isn't enabled by PACKAGECONFIG
     sed -i 's/^    qtCompileTest(bluez)/    OE_BLUEZ_ENABLED:qtCompileTest(bluez)/g' ${S}/qtsystems.pro
 }
#1 lore raw
Quoted 6 lines · Javier Viguera

QMAKE_CACHE_EVAL is only used in qtwebengine and qtwebkit, but not in the rest of the QT5 packages, so use EXTRA_QMAKEVARS_PRE to pass the packageconfig options to the do_configure task.

Also generalize bluetooth support so it can be used not only with bluez4 but with bluez5 as well.

Is it deterministic?

Will it always pick bluez4 when BLUEZ is set to bluez4, but there is bluez5 is already in the sysroot as well?

config.tests/bluez/bluez.pro is only using pkgconfig to find bluez, so I'm not sure which one will win.

Quoted 55 lines
---
 recipes-qt/qt5/qtconnectivity_git.bb | 9 ++++++---
 recipes-qt/qt5/qtsystems_git.bb      | 9 ++++++---
 2 files changed, 12 insertions(+), 6 deletions(-)
recipes-qt/qt5/qtconnectivity_git.bb +6 -3
index b1e155e2b48d..f677f7107465 100644
@@ -13,11 +13,14 @@ LIC_FILES_CHKSUM = " \
 
 DEPENDS += "qtbase qtdeclarative"
 
-PACKAGECONFIG ??= ""
-PACKAGECONFIG[bluez4] = "OE_BLUEZ_ENABLED,,bluez4"
+inherit bluetooth
+
+PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'bluetooth', 'bluez', '', d)}"
+PACKAGECONFIG[bluez] = "CONFIG+=OE_BLUEZ_ENABLED,,${BLUEZ}"
+
+EXTRA_QMAKEVARS_PRE += "${EXTRA_OECONF}"
 
 do_configure_prepend() {
-    export QMAKE_CACHE_EVAL="CONFIG+=${EXTRA_OECONF}"
     # disable bluez test if it isn't enabled by PACKAGECONFIG
     sed -i 's/^qtCompileTest(bluez)/OE_BLUEZ_ENABLED:qtCompileTest(bluez)/g' ${S}/qtconnectivity.pro
 }
recipes-qt/qt5/qtsystems_git.bb +6 -3
index 27d2bff37b51..9d9d245d2d09 100644
@@ -11,11 +11,14 @@ LIC_FILES_CHKSUM = " \
 
 DEPENDS += "qtbase qtdeclarative udev gconf"
 
-PACKAGECONFIG ??= ""
-PACKAGECONFIG[bluez4] = "OE_BLUEZ_ENABLED,,bluez4"
+inherit bluetooth
+
+PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'bluetooth', 'bluez', '', d)}"
+PACKAGECONFIG[bluez] = "CONFIG+=OE_BLUEZ_ENABLED,,${BLUEZ}"
+
+EXTRA_QMAKEVARS_PRE += "${EXTRA_OECONF}"
 
 do_configure_prepend() {
-    export QMAKE_CACHE_EVAL="CONFIG+=${EXTRA_OECONF}"
     # disable bluez test if it isn't enabled by PACKAGECONFIG
     sed -i 's/^    qtCompileTest(bluez)/    OE_BLUEZ_ENABLED:qtCompileTest(bluez)/g' ${S}/qtsystems.pro
 }
Signature · 4 lines
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel
Signature · 1 line
Martin 'JaMa' Jansa     jabber: [email protected]
#2 lore raw
Quoted 5 lines · Martin Jansa

Is it deterministic?

Will it always pick bluez4 when BLUEZ is set to bluez4, but there is bluez5 is already in the sysroot as well?

No, BLUEZ is set by *bluetooth* class depending on your distro features and is only used to add 'bluez4' or 'bluez5' to the recipe build-time dependences (DEPENDS). But apart from that it does nothing to the QT5 compilation itself.

Quoted 3 lines

config.tests/bluez/bluez.pro is only using pkgconfig to find bluez, so I'm not sure which one will win.

Neither do I, but I don't think having both versions of the bluez libraries in the sysroot is a common use-case. The package config file for bluez4 and bluez5 is almost the same. It adds the same cflags and libs to any package querying it:

Libs: -L${libdir} -lbluetooth
Cflags: -I${includedir}

So to recap: this change fix the bluetooth support which is currently broken because QMAKE_CACHE_EVAL is not used at all, and also allows to build QT5 bluetooth support using bluez5 instead of the hard-coded bluez4.

Signature · 3 lines
Regards,

Javier Viguera
#3 lore raw
Quoted 11 lines · Javier Viguera
Quoted 5 lines · Martin Jansa

Is it deterministic?

Will it always pick bluez4 when BLUEZ is set to bluez4, but there is bluez5 is already in the sysroot as well?

No, BLUEZ is set by *bluetooth* class depending on your distro features and is only used to add 'bluez4' or 'bluez5' to the recipe build-time dependences (DEPENDS). But apart from that it does nothing to the QT5 compilation itself.

That's not what I was asking about.

Some distros are still using bluez4, you can try it as well with:
DISTRO_FEATURES_remove = "bluez5" DISTRO_FEATURES_append = " bluez4"

But nothing prevents bluez5 from being populated in the sysroot, because unlike bluez4 in meta-oe, bluez5 in oe-core doesn't set the PNBLACKLIST the make these 2 recipes really mutually exclusive in sysroot.

So you can build both with:
bitbake -c build bluez5 bluez4
(or with "bitbake world")

and you end with 2 providers for bluez.pc (and bluetooth.so) in the sysroot and qtconnectivity will get runtime dependency on whatever bluez version was built first, e.g. bluez5 even when BLUEZ variable says bluez4. See shlibs provider code in package.bbclass.

That's cause for undeterministic builds and this QA warning:
WARNING: QA Issue: qtconnectivity rdepends on bluez5, but it isn't a build dependency? [build-deps]

Quoted 10 lines
Quoted 4 lines

config.tests/bluez/bluez.pro is only using pkgconfig to find bluez, so I'm not sure which one will win.

Neither do I, but I don't think having both versions of the bluez libraries in the sysroot is a common use-case. The package config file for bluez4 and bluez5 is almost the same. It adds the same cflags and libs to any package querying it:

Quoted 6 lines

Libs: -L${libdir} -lbluetooth
Cflags: -I${includedir}

So to recap: this change fix the bluetooth support which is currently broken because QMAKE_CACHE_EVAL is not used at all, and also allows to build QT5 bluetooth support using bluez5 instead of the hard-coded bluez4.

I understand that, but it adds bluez5 support with undeterministic behavior, which can cause currently bluez4 only images to get bluez5 dependency through qtconnectivity, as uncommon such setup it could be it's still an issue (which should be fixed eithr in oe-core or meta-qt5).

Maybe I should PNBLACKLIST bluez4 only recipes with message that they will be removed from meta-oe after 2.1 release and stop caring about issues like this.

Signature · 1 line
Martin 'JaMa' Jansa     jabber: [email protected]
#4 lore raw
Quoted 11 lines · Martin Jansa

So you can build both with:
bitbake -c build bluez5 bluez4
(or with "bitbake world")

and you end with 2 providers for bluez.pc (and bluetooth.so) in the sysroot and qtconnectivity will get runtime dependency on whatever bluez version was built first, e.g. bluez5 even when BLUEZ variable says bluez4. See shlibs provider code in package.bbclass.

That's cause for undeterministic builds and this QA warning:
WARNING: QA Issue: qtconnectivity rdepends on bluez5, but it isn't a build dependency? [build-deps]

Ok, I understand now the problem. Thanks for explaining it.

But to be honest, I don't know how this can be solved in these QT5 recipes. To me this seems more a problem in the bluez5 recipe, so it cannot be built when bluez4 is already built. This is probably beyond my Yocto skills :-)

I used this commit as an example to add the bluez5 support:

http://git.openembedded.org/meta-openembedded/commit/?id=c2069a1420fb3d199c99f8b6e778478240fa56be

Shouldn't the problem you outline happen just the same with the gpsd recipe after above commit?

Signature · 3 lines
Regards,

Javier Viguera
#5 lore raw
In reply to Martin Jansa

Hi Martin

Quoted 7 lines · Martin Jansa

Some distros are still using bluez4, you can try it as well with:
DISTRO_FEATURES_remove = "bluez5" DISTRO_FEATURES_append = " bluez4"

But nothing prevents bluez5 from being populated in the sysroot, because unlike bluez4 in meta-oe, bluez5 in oe-core doesn't set the PNBLACKLIST the make these 2 recipes really mutually exclusive in sysroot.

Seems that this problem was finally solved in:

http://git.openembedded.org/openembedded-core/commit/?id=0a556af62b509f9defd8ac5b3a6648bdfe1dff67

So here my humble ping for this commit (master and jethro).

Signature · 3 lines
Regards,

Javier Viguera
#6 lore raw
In reply to Javier Viguera
Quoted 8 lines · Javier Viguera

QMAKE_CACHE_EVAL is only used in qtwebengine and qtwebkit, but not in the rest of the QT5 packages, so use EXTRA_QMAKEVARS_PRE to pass the packageconfig options to the do_configure task.

Also generalize bluetooth support so it can be used not only with bluez4 but with bluez5 as well.

Hi all,

This patch has been in *jethro-next* for almost two months now.

Is there a date to have 'jethro-next' merged into jethro? Is it planned?

-
Thanks,

Javier Viguera

#7 lore raw
Quoted 8 lines · Javier Viguera
Quoted 7 lines · Javier Viguera

QMAKE_CACHE_EVAL is only used in qtwebengine and qtwebkit, but not in the rest of the QT5 packages, so use EXTRA_QMAKEVARS_PRE to pass the packageconfig options to the do_configure task.

Also generalize bluetooth support so it can be used not only with bluez4 but with bluez5 as well.

Quoted 7 lines
Quoted 1 line

Hi all,

This patch has been in *jethro-next* for almost two months now.

Is there a date to have 'jethro-next' merged into jethro? Is it planned?

merged

Signature · 1 line
Martin 'JaMa' Jansa     jabber: [email protected]