guowenxue
2022-04-08 c7a69ad99ba1500722b3eb3dd8777893574a4be1
Add QT5.6.3 build shell script and patch file
2 files added
219 ■■■■■ changed files
qt/build_QT.sh 208 ●●●●● patch | view | raw | blame | history
qt/patch/qt-everywhere-opensource-src-5.6.3.patch 11 ●●●●● patch | view | raw | blame | history
qt/build_QT.sh
New file
@@ -0,0 +1,208 @@
#!/bin/bash
#+--------------------------------------------------------------------------------------------
#|Description:  This shell script used download and compile QT5 for ARM
#|     Author:  GuoWenxue <guowenxue@gmail.com>
#|
#|   WARNNING:  QT >= 5.7 need crosstool g++ support C++11 support
#|              QT configure need host g++ support C++11, so need config g++ on ubuntu host:
#|              sudo update-alternatives --config g++
#|
#|  ChangeLog:
#|           1, Initialize 1.0.0 on 2011.04.12
#+--------------------------------------------------------------------------------------------
JOBS=`cat /proc/cpuinfo |grep "processor"|wc -l`
PRJ_PATH=`pwd`
LIBS_PATH=$PRJ_PATH/install
QT_INST_PATH=/apps/qt5_rpi
# sudo apt install gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf
CROSSTOOL=arm-linux-gnueabihf-
LYFTP_SRC=ftp://master.iot-yun.club/src/
function msg_banner()
{
    echo ""
    echo "+-----------------------------------------------------------------------"
    echo "|  $1 "
    echo "+-----------------------------------------------------------------------"
    echo ""
}
function check_result()
{
    if [ $? != 0 ] ; then
       echo ""
       echo "+-----------------------------------------------------------------------"
       echo "|  $1 "
       echo "+-----------------------------------------------------------------------"
       echo ""
       exit ;
    fi
}
function compile_qt5()
{
    # 5.6.3 is the last version can be compiled by g++ without c++11 support
    SRC_NAME=qt-everywhere-opensource-src-5.6.3
    PACK_SUFIX=tar.xz
    #rm -rf ${QT_INST_PATH}/lib/libQt5Gui.so
    if [ -f ${QT_INST_PATH}/lib/libQt5Gui.so ] ; then
        msg_banner "Already cross compile $SRC_NAME "
        return 0;
    fi
    if [ ! -f ${SRC_NAME}.${PACK_SUFIX} ] ; then
        msg_banner "Start download ${SRC_NAME}.${PACK_SUFIX} "
        wget ${LYFTP_SRC}/qt/${SRC_NAME}.${PACK_SUFIX}
        check_result "ERROR: download ${SRC_NAME} failure"
    fi
    msg_banner "Start decompress $SRC_NAME.${PACK_SUFIX} and patch"
    if [ ! -d ${SRC_NAME} ] ; then
        tar -xJf ${SRC_NAME}.${PACK_SUFIX}
        patch -p0 < patch/${SRC_NAME}.patch
    fi
    cd ${SRC_NAME}
    QMAKE_FILE=qtbase/mkspecs/linux-arm-gnueabi-g++/qmake.conf
    grep "`basename ${CROSSTOOL}`" ${QMAKE_FILE} > /dev/null 2>&1
    if [ $? != 0 ] ; then
        sed -i "s|arm-linux-gnueabi-|$CROSSTOOL|" ${QMAKE_FILE}
    fi
    ./configure -opensource -confirm-license -release -shared -strip -prefix ${QT_INST_PATH} -no-c++11 \
        -xplatform linux-arm-gnueabi-g++ -qt-freetype -no-libproxy -no-avx  -make libs \
        -qt-zlib -no-mtdev -no-gif -qt-libpng  -qt-libjpeg -no-openssl -no-cups -no-dbus -pch \
        -no-xcb -no-eglfs -no-kms -no-directfb -no-opengl -linuxfb -qpa linuxfb \
        -no-sse2 -no-sse3 -no-ssse3 -no-sse4.1 -no-sse4.2 -no-rpath -no-glib \
        -no-separate-debug-info -nomake tests -nomake tools -nomake examples \
        -tslib -I${LIBS_PATH}/include/  -L${LIBS_PATH}/lib/  -I${QT_INST_PATH}/include/  -L${QT_INST_PATH}/lib/
    msg_banner "Start cross compile $SRC_NAME "
    make -j${JOBS} && make install
    check_result "ERROR: compile ${SRC_NAME} failure"
    cp ./qtbase/plugins/platforms/libqlinuxfb.so  ${QT_INST_PATH}/lib
    cp -af ${LIBS_PATH}/lib/libts*so* ${QT_INST_PATH}/lib
    cd -
}
function compile_tslib()
{
    SRC_NAME=tslib-1.22
    PACK_SUFIX=tar.bz2
    if [ -f ${LIBS_PATH}/lib/libts.so ] ; then
        msg_banner "Already cross compile $SRC_NAME "
        return 0;
    fi
    mkdir -p libs && cd libs
    msg_banner "Start cross compile $SRC_NAME "
    if [ ! -f ${SRC_NAME}.${PACK_SUFIX} ] ; then
        #tslib official download address: https://github.com/libts/tslib/tags
        wget ${LYFTP_SRC}/${SRC_NAME}.${PACK_SUFIX}
        check_result "ERROR: download ${SRC_NAME} failure"
    fi
    tar -xjf ${SRC_NAME}.${PACK_SUFIX}
    cd ${SRC_NAME}
    ./configure --prefix=${LIBS_PATH} ${CONFIG_CROSS}
    make && make install
    cd ${PRJ_PATH}
}
function compile_libiconv()
{
    SRC_NAME=libiconv-1.15
    PACK_SUFIX=tar.gz
    if [ -f ${LIBS_PATH}/lib/libiconv.so ] ; then
        msg_banner "Already cross compile $SRC_NAME "
        return 0;
    fi
    mkdir -p libs && cd libs
    msg_banner "Start cross compile $SRC_NAME "
    if [ ! -f ${SRC_NAME}.${PACK_SUFIX} ] ; then
        #wget https://ftp.gnu.org/gnu/libiconv/${SRC_NAME}.${PACK_SUFIX}
        wget ${LYFTP_SRC}/${SRC_NAME}.${PACK_SUFIX}
        check_result "ERROR: download ${SRC_NAME} failure"
    fi
    tar -xzf ${SRC_NAME}.${PACK_SUFIX}
    cd ${SRC_NAME}
    ./configure --prefix=${LIBS_PATH} ${CONFIG_CROSS}
    make && make install
    cd ${PRJ_PATH}
}
function export_cross()
{
    # export cross toolchain
    export CC=${CROSSTOOL}gcc
    export AS=${CROSSTOOL}as
    export AR=${CROSSTOOL}ar
    export LD=${CROSSTOOL}ld
    export NM=${CROSSTOOL}nm
    export RANLIB=${CROSSTOOL}ranlib
    export OBJDUMP=${CROSSTOOL}objdump
    export STRIP=${CROSSTOOL}strip
    # export cross configure
    export CONFIG_CROSS=" --build=i686-pc-linux --host=arm-linux "
    # Clear LDFLAGS and CFLAGS
    export LDFLAGS=
    export CFLAGS=
}
function unexport_cross()
{
    # export cross toolchain
    export CC=""
    export AS=""
    export AR=""
    export LD=""
    export NM=""
    export RANLIB=""
    export OBJDUMP=""
    export STRIP=""
    # export cross configure
    export CONFIG_CROSS=""
    # Clear LDFLAGS and CFLAGS
    export LDFLAGS=""
    export CFLAGS=""
}
export_cross
compile_libiconv
compile_tslib
unexport_cross
compile_qt5
qt/patch/qt-everywhere-opensource-src-5.6.3.patch
New file
@@ -0,0 +1,11 @@
diff -Nuar qt-everywhere-opensource-src-5.6.3/qtserialbus/src/plugins/canbus/socketcan/socketcanbackend.cpp qt-everywhere-opensource-src-5.6.3-modify/qtserialbus/src/plugins/canbus/socketcan/socketcanbackend.cpp
--- qt-everywhere-opensource-src-5.6.3/qtserialbus/src/plugins/canbus/socketcan/socketcanbackend.cpp    2017-09-06 20:16:43.000000000 +0800
+++ qt-everywhere-opensource-src-5.6.3-modify/qtserialbus/src/plugins/canbus/socketcan/socketcanbackend.cpp    2022-04-08 00:26:20.441520428 +0800
@@ -42,6 +42,7 @@
 #include <linux/can/error.h>
 #include <linux/can/raw.h>
+#include <linux/sockios.h>
 #include <errno.h>
 #include <unistd.h>
 #include <net/if.h>