From 9bfda0ab03877855d9018712a046de0c9e147d34 Mon Sep 17 00:00:00 2001 From: Boris Barbulovski Date: Tue, 22 Sep 2015 11:36:20 -0700 Subject: Port xconfig to Qt5 - Remove Qt3Support from Makefile. Signed-off-by: Boris Barbulovski Signed-off-by: Thiago Macieira Signed-off-by: Michal Marek --- scripts/kconfig/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'scripts/kconfig/Makefile') diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index aceaaed09811..9b5b8c6796b9 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile @@ -265,8 +265,8 @@ $(obj)/.tmp_qtcheck: moc="/usr/bin/moc"; \ fi; \ else \ - cflags="\$$(shell pkg-config QtCore QtGui Qt3Support --cflags)"; \ - libs="\$$(shell pkg-config QtCore QtGui Qt3Support --libs)"; \ + cflags="\$$(shell pkg-config QtCore QtGui --cflags)"; \ + libs="\$$(shell pkg-config QtCore QtGui --libs)"; \ moc="\$$(shell pkg-config QtCore --variable=moc_location)"; \ [ -n "$$moc" ] || moc="\$$(shell pkg-config QtCore --variable=prefix)/bin/moc"; \ fi; \ -- cgit v1.2.3 From d1b0dc90abdb3487a8b60ac7c843708f98ff409a Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 22 Sep 2015 11:36:39 -0700 Subject: Update the buildsystem for KConfig finding Qt The buildsystem will now only search for Qt 4 and Qt 5. Support for Qt 2 and 3 was dropped in the previous commits (Qt 3 was EOL'ed in 2010 or so...). For Qt 5, to be future-proof with the future direction notice appearing in the 5.5 release, C++11 support is automatically enabled. Signed-off-by: Thiago Macieira Signed-off-by: Michal Marek --- scripts/kconfig/Makefile | 73 +++++++++++++++++++----------------------------- 1 file changed, 28 insertions(+), 45 deletions(-) (limited to 'scripts/kconfig/Makefile') diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index 9b5b8c6796b9..33c49944e1a7 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile @@ -226,53 +226,36 @@ $(obj)/.tmp_qtcheck: $(src)/Makefile # Qt needs some extra effort... $(obj)/.tmp_qtcheck: - @set -e; $(kecho) " CHECK qt"; dir=""; pkg=""; \ - if ! pkg-config --exists QtCore 2> /dev/null; then \ - echo "* Unable to find the Qt4 tool qmake. Trying to use Qt3"; \ - pkg-config --exists qt 2> /dev/null && pkg=qt; \ - pkg-config --exists qt-mt 2> /dev/null && pkg=qt-mt; \ - if [ -n "$$pkg" ]; then \ - cflags="\$$(shell pkg-config $$pkg --cflags)"; \ - libs="\$$(shell pkg-config $$pkg --libs)"; \ - moc="\$$(shell pkg-config $$pkg --variable=prefix)/bin/moc"; \ - dir="$$(pkg-config $$pkg --variable=prefix)"; \ - else \ - for d in $$QTDIR /usr/share/qt* /usr/lib/qt*; do \ - if [ -f $$d/include/qconfig.h ]; then dir=$$d; break; fi; \ - done; \ - if [ -z "$$dir" ]; then \ - echo >&2 "*"; \ - echo >&2 "* Unable to find any Qt installation. Please make sure that"; \ - echo >&2 "* the Qt4 or Qt3 development package is correctly installed and"; \ - echo >&2 "* either qmake can be found or install pkg-config or set"; \ - echo >&2 "* the QTDIR environment variable to the correct location."; \ - echo >&2 "*"; \ - false; \ - fi; \ - libpath=$$dir/lib; lib=qt; osdir=""; \ - $(HOSTCXX) -print-multi-os-directory > /dev/null 2>&1 && \ - osdir=x$$($(HOSTCXX) -print-multi-os-directory); \ - test -d $$libpath/$$osdir && libpath=$$libpath/$$osdir; \ - test -f $$libpath/libqt-mt.so && lib=qt-mt; \ - cflags="-I$$dir/include"; \ - libs="-L$$libpath -Wl,-rpath,$$libpath -l$$lib"; \ - moc="$$dir/bin/moc"; \ - fi; \ - if [ ! -x $$dir/bin/moc -a -x /usr/bin/moc ]; then \ - echo "*"; \ - echo "* Unable to find $$dir/bin/moc, using /usr/bin/moc instead."; \ - echo "*"; \ - moc="/usr/bin/moc"; \ - fi; \ - else \ - cflags="\$$(shell pkg-config QtCore QtGui --cflags)"; \ - libs="\$$(shell pkg-config QtCore QtGui --libs)"; \ - moc="\$$(shell pkg-config QtCore --variable=moc_location)"; \ - [ -n "$$moc" ] || moc="\$$(shell pkg-config QtCore --variable=prefix)/bin/moc"; \ - fi; \ + @set -e; $(kecho) " CHECK qt"; \ + qtver=`qmake -query QT_VERSION` || { \ + echo >&2 "*"; \ + echo >&2 "* qmake failed."; \ + echo >&2 "*"; \ + exit 1; \ + }; \ + qtlibdir=`qmake -query QT_INSTALL_LIBS`; \ + qthdrdir=`qmake -query QT_INSTALL_HEADERS`; \ + qtbindir=`qmake -query QT_INSTALL_BINS`; \ + cflags="-I$$qthdrdir -I$$qthdrdir/QtCore -I$$qthdrdir/QtGui"; \ + case "$$qtver" in \ + 5.*) \ + cflags="$$cflags -I$$qthdrdir/QtWidgets -std=c++11 -fPIC"; \ + libs="-L$$qtlibdir -lQt5Widgets -lQt5Gui -lQt5Core "; \ + ;; \ + 4.*) \ + libs="-L$$qtlibdir -lQtGui -lQtCore"; \ + ;; \ + *) \ + echo >&2 "*"; \ + echo >&2 "* Found qmake but it is for Qt version $$qtver, which is not supported."; \ + echo >&2 "* Please install either Qt 4.8 or 5.x."; \ + echo >&2 "*"; \ + exit 1; \ + ;; \ + esac; \ echo "KC_QT_CFLAGS=$$cflags" > $@; \ echo "KC_QT_LIBS=$$libs" >> $@; \ - echo "KC_QT_MOC=$$moc" >> $@ + echo "KC_QT_MOC=$$qtbindir/moc" >> $@ endif $(obj)/gconf.o: $(obj)/.tmp_gtkcheck -- cgit v1.2.3 From 588446a84776cfb3ebbc1677c3407d6884878bd6 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sun, 1 Nov 2015 21:12:53 -0600 Subject: Use pkg-config to find Qt 4 and 5 instead of direct qmake The Qt Project recommendation is that there should always be a "qmake" binary and it should never be renamed. If it's necessary to handle multiple Qt versions, the Qt Project recommends using qtchooser. Unfortunately, some distros do not follow the recommendation, so we would need to check qmake-qt4, qmake-qt5, etc. So, instead, let's try pkg-config. Signed-off-by: Thiago Macieira Reported-by: Alexey Brodkin Acked-by: Alexey Brodkin Signed-off-by: Michal Marek --- scripts/kconfig/Makefile | 37 +++++++++++++------------------------ 1 file changed, 13 insertions(+), 24 deletions(-) (limited to 'scripts/kconfig/Makefile') diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index 33c49944e1a7..8d0b1ba77242 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile @@ -227,35 +227,24 @@ $(obj)/.tmp_qtcheck: $(src)/Makefile # Qt needs some extra effort... $(obj)/.tmp_qtcheck: @set -e; $(kecho) " CHECK qt"; \ - qtver=`qmake -query QT_VERSION` || { \ + if pkg-config --exists Qt5Core; then \ + cflags="-std=c++11 -fPIC `pkg-config --cflags Qt5Core Qt5Gui Qt5Widgets`"; \ + libs=`pkg-config --libs Qt5Core Qt5Gui Qt5Widgets`; \ + moc=`pkg-config --variable=host_bins Qt5Core`/moc; \ + elif pkg-config --exists QtCore; then \ + cflags=`pkg-config --cflags QtCore QtGui`; \ + libs=`pkg-config --libs QtCore QtGui`; \ + moc=`pkg-config --variable=moc_location QtCore`; \ + else \ echo >&2 "*"; \ - echo >&2 "* qmake failed."; \ + echo >&2 "* Could not find Qt via pkg-config."; \ + echo >&2 "* Please install either Qt 4.8 or 5.x. and make sure it's in PKG_CONFIG_PATH"; \ echo >&2 "*"; \ exit 1; \ - }; \ - qtlibdir=`qmake -query QT_INSTALL_LIBS`; \ - qthdrdir=`qmake -query QT_INSTALL_HEADERS`; \ - qtbindir=`qmake -query QT_INSTALL_BINS`; \ - cflags="-I$$qthdrdir -I$$qthdrdir/QtCore -I$$qthdrdir/QtGui"; \ - case "$$qtver" in \ - 5.*) \ - cflags="$$cflags -I$$qthdrdir/QtWidgets -std=c++11 -fPIC"; \ - libs="-L$$qtlibdir -lQt5Widgets -lQt5Gui -lQt5Core "; \ - ;; \ - 4.*) \ - libs="-L$$qtlibdir -lQtGui -lQtCore"; \ - ;; \ - *) \ - echo >&2 "*"; \ - echo >&2 "* Found qmake but it is for Qt version $$qtver, which is not supported."; \ - echo >&2 "* Please install either Qt 4.8 or 5.x."; \ - echo >&2 "*"; \ - exit 1; \ - ;; \ - esac; \ + fi; \ echo "KC_QT_CFLAGS=$$cflags" > $@; \ echo "KC_QT_LIBS=$$libs" >> $@; \ - echo "KC_QT_MOC=$$qtbindir/moc" >> $@ + echo "KC_QT_MOC=$$moc" >> $@ endif $(obj)/gconf.o: $(obj)/.tmp_gtkcheck -- cgit v1.2.3