1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
|
#!/bin/bash
ask_for_qt() {
bad "Qt4 could not be found in usual locations, pass it here"
QT_DIR="/"
while [ "$QT_DIR" != "" ]; do
read -p "Path to Qt4: " QT_DIR
check="$($QT_DIR/bin/qmake --version 2>&1 | grep -E "Qt *version *4")"
if [ "$check" != "" ]; then
QMAKE="$QT_DIR/bin/qmake"
break;
fi
done
}
QT_DIRS="/opt/qt4 /usr/local/qt4 /usr/share/qt4 /usr/lib/qt4"
find_qt() {
check="$(qmake --version 2>&1 | grep -E "Qt *version *4")"
if [ "$check" = "" ]; then
for DIR in $QT_DIRS; do
check="$($DIR/bin/qmake --version 2>&1 | grep -E "Qt *version *4")"
if [ "$check" != "" ]; then
QT_DIR="$DIR"
QMAKE="$QT_DIR/bin/qmake"
echo "*** Qt4 was found in non dominant path \"$QT_DIR\""
break
fi
done
else
QT_DIR="$(which qmake)"
QT_DIR="${QT_DIR%/bin/qmake}"
QMAKE="$QT_DIR/bin/qmake"
echo "### Qt4 found in\"$QT_DIR\""
fi
[ "$QT_DIR" != "" ]
}
KDE=false
## Main code here...
if cmake --version | grep "cmake version" > /dev/null 2>&1; then
echo -e "\n\n==================== Bespin interactive configuration ====================\n
Seems you have cmake.
In addition to the style, you can have a KWin decoration,
a mac-like menu plasmoid and config plugins IFF you have KDE....\n"
KDE=true
read -n1 -s -p "--> Do you want to compile with KDE support? [Y/n]"
echo ""
if [ "$REPLY" = "n" -o "$REPLY" = "N" ]; then
KDE=false
echo "Compiling Qt/qmake only..."
else
mkdir build > /dev/null 2>&1
cd build
if ! cmake -DCMAKE_INSTALL_PREFIX=`kde4-config --prefix` -DCMAKE_BUILD_TYPE=Release ..; then
exit
fi
fi
fi
if $KDE; then
echo -e "\nConfiguration succeeded...\n"
read -n1 -s -p "--> Do you want to run a cmake GUI to adjust the configuration? [y/N]"
echo ""
if [ "$REPLY" = "y" -o "$REPLY" = "Y" ]; then
ccmake ..
fi
cd ..
echo -e "\n\n========================= Configuration done ============================\n
Ok, now just \"cd build\", \"make\" and \"sudo make install\"...\n\n"
else
QMAKE="qmake"
find_qt || ask_for_qt
if [ "$QT_DIR" = "" ]; then
echo -e ":(\nQt4 not found - exiting...\n"
exit 1;
fi
if ! $QMAKE qmake.pro; then
echo ":(\nMakefile generation failed - exiting\n"
exit 1;
fi
echo -e "\n\n========================= Configuration done ============================\n
Ok, now just \"make\" and \"sudo make install\"...\n\n"
fi
|