Handle both Qt4 and Qt5 and add fallback in case of missing qscintilla2.prf.

master
Torsten Paul 2014-10-17 19:32:15 +02:00
parent 1ab34dc9d0
commit aefafd2ec5
4 changed files with 72 additions and 39 deletions

View File

@ -9,4 +9,10 @@ greaterThan(QT_MAJOR_VERSION, 4) {
INCLUDEPATH += $$[QT_INSTALL_HEADERS]
LIBS += -L$$[QT_INSTALL_LIBS]
LIBS += -lqscintilla2
greaterThan(QT_MAJOR_VERSION, 4) {
win32|macx:LIBS += -lqscintilla2
else:LIBS += -lqt5scintilla2
} else {
LIBS += -lqscintilla2
}

View File

@ -4,15 +4,23 @@ scintilla {
DEFINES += USE_SCINTILLA_EDITOR
# The qscintilla2.prf which ships with QScintilla is broken for Mac/Windows
# The qscintilla2.prf which ships with QScintilla is broken for Mac/Windows
# debug builds, so we supply our own
win32|macx: include(qscintilla2.prf)
else: CONFIG += qscintilla2
# Older scintilla libs (e.g. 2.7.2 on fedora20) do not provide the
# prf file, so if no lib added at this point, we still fall back to
# the included qscintilla2.prf
!contains(LIBS, ".*scintilla.*") {
win32|macx: {
include(qscintilla2.prf)
}
else: {
load(qscintilla2) {
# All good, found installed *.prf file.
} else {
# Older scintilla libs (e.g. 2.7.2 on fedora20) do not provide the
# prf file.
#
# In addition Ubuntu (and maybe other distributions) have the Qt5
# prf file in the wrong location so it's not picked up by qmake
#
message("Using local copy of qscintilla2.prf instead.")
include(qscintilla2.prf)
}
}
}

View File

@ -160,31 +160,60 @@ gmp_sysver()
gmp_sysver_result="$gmpmaj.$gmpmin.$gmppat"
}
qt4_sysver()
qt_sysver()
{
qt4path=$1/include/qt4/QtCore/qglobal.h
if [ ! -e $qt4path ]; then
qt4path=$1/include/QtCore/qglobal.h
if [ "`command -v qtchooser`" ]; then
if qtchooser -run-tool=qmake -qt=5 -v >/dev/null 2>&1 ; then
export QT_SELECT=5
qtpath="`qtchooser -run-tool=qmake -qt=5 -query QT_INSTALL_HEADERS`"/QtCore/qglobal.h
fi
if [ ! -e $qtpath ]; then
if qtchooser -run-tool=qmake -qt=4 -v >/dev/null 2>&1 ; then
export QT_SELECT=4
qtpath="`qtchooser -run-tool=qmake -qt=4 -query QT_INSTALL_HEADERS`"/QtCore/qglobal.h
fi
fi
else
export QT_SELECT=5
qtpath=$1/include/qt5/QtCore/qglobal.h
if [ ! -e $qtpath ]; then
qtpath=$1/include/i686-linux-gnu/qt5/QtCore/qglobal.h
fi
if [ ! -e $qtpath ]; then
qtpath=$1/include/x86_64-linux-gnu/qt5/QtCore/qglobal.h
fi
if [ ! -e $qtpath ]; then
export QT_SELECT=4
qtpath=$1/include/qt4/QtCore/qglobal.h
fi
if [ ! -e $qtpath ]; then
qtpath=$1/include/QtCore/qglobal.h
fi
if [ ! -e $qtpath ]; then
# netbsd
qtpath=$1/qt4/include/QtCore/qglobal.h
fi
if [ ! -e $qtpath ]; then
unset QT_SELECT
return
fi
fi
if [ ! -e $qt4path ]; then
# netbsd
qt4path=$1/qt4/include/QtCore/qglobal.h
fi
if [ ! -e $qt4path ]; then return; fi
qt4ver=`grep 'define *QT_VERSION_STR *' $qt4path | awk '{print $3}'`
qt4ver=`echo $qt4ver | sed s/'"'//g`
qt4_sysver_result=$qt4ver
qtver=`grep 'define *QT_VERSION_STR *' $qtpath | awk '{print $3}'`
qtver=`echo $qtver | sed s/'"'//g`
qt_sysver_result=$qtver
}
qscintilla2_sysver()
{
QMAKE=qmake
if [ "`command -v qmake-qt4`" ]; then
# expecting the QT_SELECT already set in case we found qtchooser
if qmake -v >/dev/null 2>&1 ; then
QMAKE=qmake
elif [ "`command -v qmake-qt4`" ]; then
QMAKE=qmake-qt4
fi
qt4incdir="`$QMAKE -query QT_INSTALL_HEADERS`"
qscipath="$qt4incdir/Qsci/qsciglobal.h"
qtincdir="`$QMAKE -query QT_INSTALL_HEADERS`"
qscipath="$qtincdir/Qsci/qsciglobal.h"
if [ ! -e $qscipath ]; then
return
fi
@ -607,7 +636,7 @@ checkargs()
main()
{
deps="qt4 qscintilla2 cgal gmp mpfr boost opencsg glew eigen glib2 fontconfig freetype2 harfbuzz gcc bison flex make"
deps="qt qscintilla2 cgal gmp mpfr boost opencsg glew eigen glib2 fontconfig freetype2 harfbuzz gcc bison flex make"
#deps="$deps curl git" # not technically necessary for build
#deps="$deps python cmake imagemagick" # only needed for tests
#deps="cgal"

View File

@ -57,23 +57,13 @@ get_mageia_deps()
get_debian_deps()
{
for pkg in build-essential curl libffi-dev qtbase5-dev \
apt-get -y install \
build-essential curl libffi-dev qtbase5-dev libqt5scintilla2-dev \
libxmu-dev cmake bison flex git-core libboost-all-dev \
libXi-dev libmpfr-dev libboost-dev libglew-dev \
libeigen3-dev libcgal-dev libopencsg-dev libgmp3-dev libgmp-dev \
imagemagick libfontconfig-dev libfreetype6-dev \
libharfbuzz-dev gtk-doc-tools libglib2.0-dev gettext; do
sudo apt-get -y install $pkg;
done
# The following packages are only needed to build the static
# Qt5 version for release builds / older distributions.
for pkg in libdbus-1-dev \
libxcb1-dev libx11-xcb-dev libxcb-keysyms1-dev libxcb-image0-dev \
libxcb-shm0-dev libxcb-icccm4-dev libxcb-sync0-dev libxcb-xfixes0-dev \
libxrender-dev libxcb-shape0-dev libxcb-randr0-dev libxcb-glx0-dev; do
sudo apt-get -y install $pkg;
done
libharfbuzz-dev gtk-doc-tools libglib2.0-dev gettext
}
unknown()