make xconfig no longer works in Fedora

From: Alexey Brodkin
Date: Sat Oct 31 2015 - 08:39:54 EST


Hi Thiago,

I noticed that with your patch "Update the buildsystem for KConfig finding Qt"
I cannot use "make xconfig" in Fedora 22 any longer.

That's what I'm seeing:
-------------------->8---------------------
$ make xconfig
CHECK qt
/bin/sh: line 1: qmake: command not found
*
* qmake failed.
*
make[1]: *** No rule to make target 'scripts/kconfig/.tmp_qtcheck', needed by 'scripts/kconfig/qconf.o'. Stop.
Makefile:547: recipe for target 'xconfig' failed
make: *** [xconfig] Error 2
-------------------->8---------------------

The reason why xconfig target fails is in Fedora (at least its recent versions)
there's no "qmake". Instead there're "qmake-qt4" and/or "qmake-qt5" depending on
which Qt packages are installed.

I understand that there're plenty of possible workarounds like creating
an alias qmake -> qmake-qtX, usage of "update-alternatives" etc.

But IMHO it would be really nice if we don't break things that used to work.

Still if I revert the patch in question "make xconfig" works again.
And that's because we did autodiscovery of moc like that:
-------------------->8---------------------
moc="\$$(shell pkg-config QtCore --variable=moc_location)";
-------------------->8---------------------

In my case it returns:
-------------------->8---------------------
$ pkg-config QtCore --variable=moc_location
/usr/lib64/qt4/bin/moc
-------------------->8---------------------

If we do want to use "qmake" directly we may first find it similarly:

-------------------->8---------------------
$ pkg-config QtCore --variable=exec_prefix
/usr/lib64/qt4
-------------------->8---------------------

And then add "/bin/qmake" like this:
-------------------->8---------------------
qmake="\$$(shell pkg-config QtCore --variable=exec_prefix""/bin/qmake";
-------------------->8---------------------

Regards,
Alexey