From 47f7b47c8443994cf11be904407db826476f911f Mon Sep 17 00:00:00 2001
From: guowenxue <guowenxue@gmail.com>
Date: Thu, 08 Aug 2019 13:05:28 +0800
Subject: [PATCH] update qt5 build shell script

---
 /dev/null          |    0 
 qt5/tslib/build.sh |   16 +-
 qt5/build_QT4.sh   |  111 ++++++++++++++++++++++
 qt5/build_QT5.sh   |  112 ++++++++++++++++++++++
 qt5/iconv/build.sh |   16 +-
 5 files changed, 239 insertions(+), 16 deletions(-)

diff --git a/qt4/apps/build.sh b/qt4/apps/build.sh
deleted file mode 100755
index 4391dca..0000000
--- a/qt4/apps/build.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh
-export PATH=/apps/qt-everywhere-rpi/bin/:$PATH
-qmake -project && qmake && make
diff --git a/qt4/build-everywhere-4.6.4.sh b/qt4/build-everywhere-4.6.4.sh
deleted file mode 100755
index c928f30..0000000
--- a/qt4/build-everywhere-4.6.4.sh
+++ /dev/null
@@ -1,87 +0,0 @@
-#!/bin/bash
-
-#+--------------------------------------------------------------------------------------------
-#|Description:  This shell script used to download qt-extended-4.4.3 code and cross compile it.
-#|     Author:  GuoWenxue <guowenxue@gmail.com>
-#|  ChangeLog:
-#|           1, Initialize 1.0.0 on 2012.03.28
-#+--------------------------------------------------------------------------------------------
-
-APP_NAME="qt-everywhere-opensource-src-4.6.4"
-PACK_SUFIX="tar.gz"
-DL_ADDR="http://releases.qt-project.org/qt4/source/$APP_NAME.$PACK_SUFIX"
-
-INST_PATH=/apps
-QT_INST_PATH=$INST_PATH/qt-everywhere-rpi
-
-ARCH=cortexa53
-
-if [ -z "$ARCH" -a $# -gt 0 ] ; then
-   ARCH=$1
-fi
-
-sup_arch=("" "arm920t" )
-
-function select_arch()
-{
-   echo "Current support ARCH: "
-   i=1
-   len=${#sup_arch[*]}
-
-   while [ $i -lt $len ]; do
-     echo "$i: ${sup_arch[$i]}"
-     let i++;
-   done
-
-   echo "Please select: "
-   index=
-   read index
-   ARCH=${sup_arch[$index]}
-}
-
-
-if [ -z "$CROSS" ] ; then
-    if [ -z $ARCH ] ; then
-        select_arch
-    fi
-    CROSS=/opt/rpi/arm-bcm2708/arm-linux-gnueabihf/bin/arm-linux-gnueabihf-
-fi
-
-export PATH=`dirname $CROSS`:$PATH
-
-mkdir -p ${QT_INST_PATH}
-
-echo "+------------------------------------------------------------------+"
-echo "|          Build $APP_NAME for $ARCH "
-echo "| Crosstool:  $CROSS"
-echo "+------------------------------------------------------------------+"
-
-# Download source code packet
-if [ ! -s $APP_NAME.$PACK_SUFIX ] ; then 
-    echo "+------------------------------------------------------------------+" 
-    echo "|  Download $APP_NAME.$PACK_SUFIX now "  
-    echo "+------------------------------------------------------------------+" 
-    wget $DL_ADDR 
-fi 
-
-# Decompress source code packet 
-if [ ! -d $APP_NAME ] ; then 
-    tar -xzf $APP_NAME.$PACK_SUFIX 
-fi
-
-cd $APP_NAME
-
-
-#Configure for the QT
-./configure -opensource -confirm-license -release -prefix ${QT_INST_PATH} \
--embedded arm -xplatform qws/linux-arm-g++ -shared -no-fast -no-largefile -no-multimedia \
--no-audio-backend  -no-phonon -no-phonon-backend -no-svg -qt-freetype \
--little-endian -nomake tools -nomake docs -no-xmlpatterns \
--no-javascript-jit -no-script -no-scripttools -no-declarative -qt-zlib \
--no-gif -qt-libtiff -qt-libpng  -no-libmng -qt-libjpeg -no-openssl \
--no-nis -no-cups -no-dbus -no-mmx -no-3dnow -no-sse -no-sse2 -no-rpath -no-glib \
--no-xcursor -no-xfixes -no-xrandr -no-xrender -no-separate-debug-info
-
-make -j 16 && make install
-
-cd - 
diff --git a/qt5/build.sh b/qt5/build.sh
deleted file mode 100755
index 7f87623..0000000
--- a/qt5/build.sh
+++ /dev/null
@@ -1,111 +0,0 @@
-#!/bin/bash
-
-#+--------------------------------------------------------------------------------------------
-#|Description:  This shell script used download and compile QT5 for ARM
-#|     Author:  GuoWenxue <guowenxue@gmail.com>
-#|  ChangeLog:
-#|           1, Initialize 1.0.0 on 2011.04.12
-#+--------------------------------------------------------------------------------------------
-
-QT_INST_PATH=/apps/qt5_rpi
-LIBS_PATH=`pwd`/libs
-
-if [ -z $CROSSTOOL ] ; then
-   CROSSTOOL=/opt/rpi/arm-bcm2708/arm-linux-gnueabihf/bin/arm-linux-gnueabihf-
-fi
-
-function msg_banner()
-{
-    echo ""
-    echo "+-----------------------------------------------------------------------"
-    echo "|  $1 "
-    echo "+-----------------------------------------------------------------------"
-    echo ""
-}
-
-function check_result()
-{
-    if [ $? != 0 ] ; then
-       echo ""
-       echo "+-----------------------------------------------------------------------"
-       echo "|  $1 "
-       echo "+-----------------------------------------------------------------------"
-       echo ""
-       exit ;
-    fi
-}
-
-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 compile_qt()
-{
-    SRC_NAME=qt-everywhere-opensource-src-5.6.1
-    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 http://mirrors.ustc.edu.cn/qtproject/archive/qt/5.6/5.6.1/single/${SRC_NAME}.${PACK_SUFIX}
-        check_result "ERROR: download ${SRC_NAME} failure"
-    fi
-
-    msg_banner "Start decompress $SRC_NAME.${PACK_SUFIX} "
-    if [ ! -d ${SRC_NAME} ] ; then
-        xz -dk ${SRC_NAME}.${PACK_SUFIX} && tar -xf ${SRC_NAME}.tar && rm -f ${SRC_NAME}.tar
-    fi
-
-    cd ${SRC_NAME}
-
-    sed -i "s|arm-linux-gnueabi-|$CROSSTOOL|" qtbase/mkspecs/linux-arm-gnueabi-g++/qmake.conf
-
-    ./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 -optimized-qmake \
-        -qt-zlib -no-mtdev -no-gif -qt-libpng  -qt-libjpeg -no-openssl -no-cups -no-dbus -pch -qt-sql-sqlite \
-        -no-xcb -no-xcb-xlib -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 -qreal float \
-        -no-xcursor -no-xfixes -no-xrandr -no-xrender -no-separate-debug-info -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 -j8 && make install
-    check_result "ERROR: compile ${SRC_NAME} failure"
-    cp ./qtbase/plugins/platforms/libqlinuxfb.so  ${QT_INST_PATH}/lib
-
-    cd -
-}
-
-cd tslib
-  ./build.sh
-cd -
-
-cd iconv
-  ./build.sh
-cd -
-
-compile_qt
-
-
diff --git a/qt5/build_QT4.sh b/qt5/build_QT4.sh
new file mode 100755
index 0000000..53e72df
--- /dev/null
+++ b/qt5/build_QT4.sh
@@ -0,0 +1,111 @@
+#!/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.9_RPI
+QT_INST_PATH=/apps/QT4.6_RPI
+
+CROSSTOOL=/opt/rpi/arm-bcm2708/arm-linux-gnueabihf/bin/arm-linux-
+
+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_qt()
+{
+    SRC_NAME=qt-everywhere-opensource-src-4.6.4
+
+    PACK_SUFIX=tar.gz
+
+    #rm -rf ${QT_INST_PATH}/lib/libQt5Gui.so
+    if [ -f ${QT_INST_PATH}/lib/libQtGui.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} "
+    if [ ! -d ${SRC_NAME} ] ; then
+        tar -xzf ${SRC_NAME}.${PACK_SUFIX}
+    fi
+
+    cd ${SRC_NAME}
+
+    QMAKE_FILE=mkspecs/qws/linux-arm-g++/qmake.conf
+
+    grep "`dirname ${CROSSTOOL}`" ${QMAKE_FILE} > /dev/null 2>&1
+    if [ $? != 0 ] ; then 
+        sed -i "s|arm-linux-|$CROSSTOOL|" ${QMAKE_FILE}
+    fi
+
+    ./configure -opensource -confirm-license -release -shared -prefix ${QT_INST_PATH} -embedded arm \
+        -xplatform qws/linux-arm-g++ -qt-freetype -make libs -no-fast -no-largefile \
+        -qt-zlib  -no-gif -qt-libpng  -qt-libjpeg -no-openssl -no-cups -no-dbus -pch \
+        -no-phonon -no-phonon-backend -no-opengl -no-xmlpatterns \
+        -no-rpath -no-glib -no-javascript-jit -no-script -no-scripttools -no-declarative \
+        -no-nis -no-mmx -no-3dnow -no-sse -no-sse2 -no-xcursor -no-xfixes -no-xrandr -no-xrender \
+        -no-separate-debug-info -nomake tests -nomake tools -nomake examples \
+        -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 -af ${LIBS_PATH}/lib/libts*so* ${QT_INST_PATH}/lib
+
+    cd -
+}
+
+
+if [ ! -f ${LIBS_PATH}/lib/libiconv.so ] ; then
+    cd ./iconv
+        ./build.sh 
+    cd -
+fi
+
+cd tslib
+  ./build.sh
+cd -
+
+compile_qt
+
+
diff --git a/qt5/build_QT5.sh b/qt5/build_QT5.sh
new file mode 100755
index 0000000..a7c916a
--- /dev/null
+++ b/qt5/build_QT5.sh
@@ -0,0 +1,112 @@
+#!/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.9_RPI
+QT_INST_PATH=/apps/QT5.6_RPI
+
+CROSSTOOL=/opt/rpi/arm-bcm2708/arm-linux-gnueabihf/bin/arm-linux-
+
+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_qt()
+{
+    # 5.6.3 is the last version can be compiled by g++ without c++11 support
+    #SRC_NAME=qt-everywhere-opensource-src-5.9.8
+    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} "
+    if [ ! -d ${SRC_NAME} ] ; then
+        tar -xJf ${SRC_NAME}.${PACK_SUFIX}
+    fi
+
+    cd ${SRC_NAME}
+
+    QMAKE_FILE=qtbase/mkspecs/linux-arm-gnueabi-g++/qmake.conf
+
+    grep "`dirname ${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} -c++std 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 -
+}
+
+
+if [ ! -f ${LIBS_PATH}/lib/libiconv.so ] ; then
+    cd ./iconv
+        ./build.sh 
+    cd -
+fi
+
+cd tslib
+  ./build.sh
+cd -
+
+compile_qt
+
+
diff --git a/qt5/iconv/build.sh b/qt5/iconv/build.sh
index b84cfb6..fc25292 100755
--- a/qt5/iconv/build.sh
+++ b/qt5/iconv/build.sh
@@ -7,12 +7,11 @@
 #|           1, Initialize 1.0.0 on 2011.04.12
 #+--------------------------------------------------------------------------------------------
 
-PROJ_PATH=`pwd`/../
-ICONV_INST_PATH=${PROJ_PATH}/libs/
+INST_PATH=`pwd`/../install
 
-if [ -z $CROSSTOOL ] ; then
-   CROSSTOOL=/opt/xtools/arm920t/bin/arm-linux-
-fi
+CROSSTOOL=/opt/rpi/arm-bcm2708/arm-linux-gnueabihf/bin/arm-linux-
+
+LYFTP_SRC=ftp://master.iot-yun.club/src/
 
 function msg_banner()
 {
@@ -61,7 +60,7 @@
     SRC_NAME=libiconv-1.15
     PACK_SUFIX=tar.gz
 
-    if [ -f ${ICONV_INST_PATH}/lib/libiconv.so ] ; then
+    if [ -f ${INST_PATH}/lib/libiconv.so ] ; then
         msg_banner "Already cross compile $SRC_NAME "
         return 0;
     fi
@@ -69,14 +68,15 @@
     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 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=${ICONV_INST_PATH} ${CONFIG_CROSS}
+    ./configure --prefix=${INST_PATH} ${CONFIG_CROSS}
     make && make install
 
     cd -
diff --git a/qt5/tslib/build.sh b/qt5/tslib/build.sh
index d57028e..34ee9ba 100755
--- a/qt5/tslib/build.sh
+++ b/qt5/tslib/build.sh
@@ -7,12 +7,11 @@
 #|           1, Initialize 1.0.0 on 2011.04.12
 #+--------------------------------------------------------------------------------------------
 
-PROJ_PATH=`pwd`/..
-TSLIB_INST_PATH=${PROJ_PATH}/libs/
+INST_PATH=`pwd`/../install
 
-if [ -z $CROSSTOOL ] ; then
-   CROSSTOOL=/opt/xtools/arm920t/bin/arm-linux-
-fi
+CROSSTOOL=/opt/rpi/arm-bcm2708/arm-linux-gnueabihf/bin/arm-linux-
+
+LYFTP_SRC=ftp://master.iot-yun.club/src/
 
 function msg_banner()
 {
@@ -61,7 +60,7 @@
     PACK_SUFIX=tar.bz2
 
 
-    if [ -f ${TSLIB_INST_PATH}/lib/libts.so ] ; then
+    if [ -f ${INST_PATH}/lib/libts.so ] ; then
         msg_banner "Already cross compile $SRC_NAME "
         return 0;
     fi
@@ -69,14 +68,15 @@
     msg_banner "Start cross compile $SRC_NAME "
 
     if [ ! -f ${SRC_NAME}.${PACK_SUFIX} ] ; then
-        wget https://gitlab.com/tslib/tslib/uploads/021755cde4aba79478464459c8a2122c/${SRC_NAME}.${PACK_SUFIX}
+        #wget https://gitlab.com/tslib/tslib/uploads/021755cde4aba79478464459c8a2122c/${SRC_NAME}.${PACK_SUFIX}
+        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=${TSLIB_INST_PATH} ${CONFIG_CROSS}
+    ./configure --prefix=${INST_PATH} ${CONFIG_CROSS}
     make && make install
 
     cd -
diff --git a/qt5/tslib/tslib-1.16.tar.bz2 b/qt5/tslib/tslib-1.16.tar.bz2
deleted file mode 100644
index 975aa4c..0000000
--- a/qt5/tslib/tslib-1.16.tar.bz2
+++ /dev/null
Binary files differ

--
Gitblit v1.9.1