编译Qt
#!/bin/sh
echo -e "*************************************"
echo -e "-------------编译安装QT--------------"
echo -e "*************************************"
PACK_PATH=`pwd`
echo "编译安装QT"
cd
yum install expat-devel fontconfig-devel freetype-devel kde-filesystem libICE-devel libSM-devel libXcursor-devel libXft-devel libXi-devel libXinerama-devel libXrandr-devel libXrender-devel libXt-devel libXv-devel libmng libpng-devel libuuid-devel mesa-libGLU mesa-libGLU-devel unixODBC unixODBC-devel zlib-devel gperf libXcomposite-devel dbus-devel ninja-build mesa-libEGL-devel libgcrypt-devel libgcrypt pciutils-devel nss-devel libXtst-devel pulseaudio-libs-devel systemd-devel libcap-devel alsa-lib-devel flex bison ruby snappy-devel libvpx-devel -y >/dev/null 2>&1
cd $PACK_PATH
[ -d "$PACK_PATH/qt-everywhere-opensource-src-5.9.6" ] && rm -rf $PACK_PATH/qt-everywhere-opensource-src-5.9.6
tar --no-same-owner -vxf qt-everywhere-opensource-src-5.9.6.tar.xz >/dev/null 2>&1
cd qt-everywhere-opensource-src-5.9.6/
[ ! -d build-qt ] && mkdir build-qt
cd build-qt/
../configure -opensource -confirm-license MYSQL_PREFIX=/usr/local/mysql MYSQL_LIBDIR=/usr/local/mysql/lib MYSQL_INCDIR=/usr/local/mysql/include >/dev/null 2>&1
thread=`lscpu|grep "CPU(s):"|awk '{print$NF}'`
gmake -j $thread >/dev/null 2>&1 |echo "编译安装QT中...大概需要1小时左右"
gmake install >/dev/null 2>&1 |echo "即将编译完成。"
ln -sf /usr/local/mysql/lib/libmysqlclient.so.20.3.14 /usr/local/Qt-5.9.6/plugins/sqldrivers/libmysqlclient.so.20
echo "export QTDIR=/usr/local/Qt-5.9.6
export PATH=\$QTDIR/bin:\$PATH
export MANPATH=\$QTDIR/man:\$MANPATH
export LD_LIBRARY_PATH=\$QTDIR/lib:\$LD_LIBRARY_PATH" >> /etc/profile
sleep 1
source /etc/profile
qmake -v >/dev/null
if [[ $? != 0 ]]
then
echo "QT安装失败"
exit
else
echo "QT安装成功"
fi
编译QtCreator
#!/bin/sh
echo -e "*************************************"
echo -e "---------编译安装qt-creator----------"
echo -e "*************************************"
PACK_PATH=`pwd`
source /etc/profile
echo "编译安装qt-creater"
cd $PACK_PATH
[ -d "$PACK_PATH/qt-creator-opensource-src-4.9.2" ] && rm -rf $PACK_PATH/qt-creator-opensource-src-4.9.2
tar --no-same-owner -vxf qt-creator-opensource-src-4.9.2.tar.xz >/dev/null 2>&1
cd qt-creator-opensource-src-4.9.2/
[ ! -d build-qtcreator ] && mkdir build-qtcreator
cd build-qtcreator
qmake ../qtcreator.pro >/dev/null 2>&1
thread=`lscpu|grep "CPU(s):"|awk '{print$NF}'`
make -j $thread >/dev/null 2>&1|echo "编译安装qt-creater中..."
make install INSTALL_ROOT=/usr >/dev/null 2>&1|echo "即将编译完成"
echo "qt-creator安装成功"
|