Trying to build qtdeclarative-5.5.1 with 5.4.1 installed in /opt/qt5 fails because it finds libQt5Quick from /opt/qt5/lib, not the freshly built one.
This affected some sub-components/modules of qtdeclarative and not others. The point is that -L/opt/t5/lib is placed in LIBS for some libs from qtbase before -lQt5Quick is invoked, with the correct -L$SOURCE_DIRECTORY/lib to get the new one. The first -L rules and hence the old lib is picked. FAIL.
I was told on IRC #qt-labs that the build system indeed is supposed to ensure that the fresh libs are found first. There seems to be a gap in that feature for qtdeclarative components.
My solution is this hack now for qt5 builds:
This seems to work so far and settles the issue for me. Please be aware of me not having a larger interest in Qt than to get software depending on it installed, nor knowledge of how Qt/qmake builds are supposed to work in any detail.
I hope the issue is reasonably obvious for the initiated and I can remove my hack for a future release. I am not sure if other packages are also still affected, as I am building things now with the above hack.
PS: I chose "5.5.1" as affected version and Jira tells me that doesn't exist. Should I choose 5.5.0? I am talking about qtdeclarative-opensource-src-5.5.1.tar.xz with the sha512 sum e8c25eeaca66cfb8b8bd014487ad81b8b9780e2f3e898b967d0923dbb40b54cd32c35859b7419e964319401995c27a229ed0ec9d1ec6d2aba84002b59abefddf, if there's any doubt.