From 5f20547d454eda23ad5db4900a48bc28747d1359 Mon Sep 17 00:00:00 2001
From: guowenxue <guowenxue@gmail.com>
Date: Sun, 11 Aug 2019 11:18:05 +0800
Subject: [PATCH] update build shell script to format

---
 3rdparty/curl/build.sh            |    8 
 3rdparty/dnsmasq/build.sh         |    9 
 3rdparty/opencv/build.sh          |    8 
 3rdparty/libressl/build.sh        |   94 +++++++
 3rdparty/ntpdate/build.sh         |    8 
 3rdparty/iptables/build.sh        |    9 
 3rdparty/zbar/build.sh            |  282 +++++++----------------
 3rdparty/tree/build.sh            |    6 
 3rdparty/ethtool/build.sh         |    4 
 3rdparty/libevent/build.sh        |    4 
 3rdparty/imageMagick/build.sh     |   96 ++++++++
 3rdparty/openssl/build.sh         |    4 
 3rdparty/vsftpd/build.sh          |    4 
 3rdparty/mosquitto/build.sh       |    4 
 3rdparty/file/build.sh            |    6 
 3rdparty/busybox/build.sh         |   26 +-
 3rdparty/sqlite/build.sh          |    4 
 3rdparty/libpng/build.sh          |    4 
 3rdparty/openssh/openssl/build.sh |    5 
 3rdparty/zlib/build.sh            |    4 
 3rdparty/pppd/build.sh            |    6 
 3rdparty/fbgrab/build.sh          |    4 
 3rdparty/openssh/zlib/build.sh    |    5 
 3rdparty/qt/build_QT5.sh          |    3 
 3rdparty/openssh/build.sh         |    5 
 3rdparty/dhcpd/build.sh           |    9 
 3rdparty/stunnel/build.sh         |    8 
 3rdparty/ffmpeg/build.sh          |   10 
 3rdparty/dropbear/build.sh        |    9 
 3rdparty/libconfig/build.sh       |    4 
 3rdparty/lrzsz/build.sh           |    5 
 3rdparty/appweb/build.sh          |   12 
 32 files changed, 363 insertions(+), 306 deletions(-)

diff --git a/3rdparty/appweb/build.sh b/3rdparty/appweb/build.sh
index dc66641..1e6844c 100755
--- a/3rdparty/appweb/build.sh
+++ b/3rdparty/appweb/build.sh
@@ -12,9 +12,9 @@
 
 mkdir -p $PREFIX_PATH/{bin,modules}
 
-if [ -z  $CROSSTOOL ] ; then 
-    CROSSTOOL=/opt/crosstool/cortex-a7/bin/arm-linux-gnueabi-
-fi
+LYFTP_SRC=ftp://master.iot-yun.club/src/
+
+CROSSTOOL=/opt/crosstool/cortex-a7/bin/arm-linux-gnueabi-
 
 function msg_banner()
 {
@@ -70,7 +70,8 @@
     msg_banner "Start cross compile $SRC_NAME "
 
     if [ ! -f ${SRC_NAME}.${PACK_SUFIX} ] ; then
-        wget http://museum.php.net/php5/${SRC_NAME}.${PACK_SUFIX}
+        #wget http://museum.php.net/php5/${SRC_NAME}.${PACK_SUFIX}
+        wget $LYFTP_SRC/$SRC_NAME.$PACK_SUFIX
         check_result "ERROR: download ${SRC_NAME} failure"
     fi
 
@@ -119,7 +120,8 @@
     msg_banner "Start cross compile $SRC_NAME "
 
     if [ ! -f ${SRC_NAME}${PACK_SUFIX} ] ; then
-        wget https://embedthis.com/software/${SRC_NAME}${PACK_SUFIX}
+        #wget https://embedthis.com/software/${SRC_NAME}${PACK_SUFIX}
+        wget $LYFTP_SRC/${SRC_NAME}${PACK_SUFIX}
         check_result "ERROR: download ${SRC_NAME} failure"
     fi
 
diff --git a/3rdparty/busybox/build.sh b/3rdparty/busybox/build.sh
index 723c649..8a02c7f 100755
--- a/3rdparty/busybox/build.sh
+++ b/3rdparty/busybox/build.sh
@@ -2,31 +2,33 @@
 
 set -e
 
-CROSSTOOL=/opt/crosstool/cortex-a7/bin/arm-linux-gnueabi-
 ROOTFS_PATH=`pwd`/../../linux-bsp/rootfs/
 
-APP_SRC=busybox-1.31.0
-PACK_SUFFIX=tar.bz2
+LYFTP_SRC=ftp://master.iot-yun.club/src/
+
+CROSSTOOL=/opt/crosstool/cortex-a7/bin/arm-linux-gnueabi-
+
+SRC_NAME=busybox-1.31.0
+PACK_SUFIX=tar.bz2
 
 JOBS=`cat /proc/cpuinfo  |  grep processor | wc -l`
 
-if [ ! -d $APP_SRC ] ; then
-    if [ ! -f $APP_SRC.${PACK_SUFFIX} ] ; then
-        wget ftp://master.iot-yun.club/src/$APP_SRC.${PACK_SUFFIX}
+if [ ! -d $SRC_NAME ] ; then
+    if [ ! -f $SRC_NAME.${PACK_SUFIX} ] ; then
+        wget ${LYFTP_SRC}/${SRC_NAME}.${PACK_SUFIX}
     fi
 
-    tar -xjf $APP_SRC.${PACK_SUFFIX}
+    tar -xjf $SRC_NAME.${PACK_SUFIX}
 fi
 
+cp config/${SRC_NAME}.config $SRC_NAME/.config
 
-
-cp config/${APP_SRC}.config $APP_SRC/.config
-
-cd $APP_SRC
+cd $SRC_NAME
 
 sed -i "s|^CONFIG_CROSS_COMPILER_PREFIX.*|CONFIG_CROSS_COMPILER_PREFIX=\"${CROSSTOOL}\"|g" .config
 sed -i "s|^CONFIG_PREFIX.*|CONFIG_PREFIX=\"$ROOTFS_PATH\"|g" .config
 
-make &&  make uninstall && sudo make install
+make 
+#make uninstall && sudo make install
 
 
diff --git a/3rdparty/curl/build.sh b/3rdparty/curl/build.sh
index dea2328..9262c36 100755
--- a/3rdparty/curl/build.sh
+++ b/3rdparty/curl/build.sh
@@ -11,9 +11,7 @@
 
 LYFTP_SRC=ftp://master.iot-yun.club/src/
 
-if [ -z $CROSSTOOL ] ; then
-   CROSSTOOL=/opt/crosstool/cortex-a7/bin/arm-linux-gnueabi-
-fi
+CROSSTOOL=/opt/crosstool/cortex-a7/bin/arm-linux-gnueabi-
 
 function msg_banner()
 {
@@ -60,7 +58,7 @@
 function compile_curl()
 {
     SRC_NAME=curl-7.65.3
-    PACK_SUFIX=tar.gz
+    PACK_SUFIX=tar.bz2
 
     if [ -f ${PREFIX_PATH}/bin/curl ] ; then
         return 0;
@@ -73,7 +71,7 @@
         check_result "ERROR: download ${SRC_NAME} failure"
     fi
 
-    tar -xzf ${SRC_NAME}.${PACK_SUFIX}
+    tar -xjf ${SRC_NAME}.${PACK_SUFIX}
     cd ${SRC_NAME}
 
     msg_banner "Start cross compile $SRC_NAME "
diff --git a/3rdparty/dhcpd/build.sh b/3rdparty/dhcpd/build.sh
index 7bc30c5..a5d8ea6 100755
--- a/3rdparty/dhcpd/build.sh
+++ b/3rdparty/dhcpd/build.sh
@@ -9,9 +9,9 @@
 
 PREFIX_PATH=`pwd`/../install/bin
 
-if [ -z $CROSSTOOL ] ; then
-   CROSSTOOL=/opt/crosstool/cortex-a7/bin/arm-linux-gnueabi-
-fi
+LYFTP_SRC=ftp://master.iot-yun.club/src/
+
+CROSSTOOL=/opt/crosstool/cortex-a7/bin/arm-linux-gnueabi-
 
 function msg_banner()
 {
@@ -67,7 +67,8 @@
     msg_banner "Start cross compile $SRC_NAME "
 
     if [ ! -f ${SRC_NAME}.${PACK_SUFIX} ] ; then
-        wget ftp://ftp.isc.org/isc/dhcp/${SRC_NAME}.${PACK_SUFIX}
+        #wget ftp://ftp.isc.org/isc/dhcp/${SRC_NAME}.${PACK_SUFIX}
+        wget $LYFTP_SRC/$SRC_NAME.$PACK_SUFIX
         check_result "ERROR: download ${SRC_NAME} failure"
     fi
 
diff --git a/3rdparty/dnsmasq/build.sh b/3rdparty/dnsmasq/build.sh
index 190b75b..afb4ed1 100755
--- a/3rdparty/dnsmasq/build.sh
+++ b/3rdparty/dnsmasq/build.sh
@@ -9,9 +9,9 @@
 
 PREFIX_PATH=`pwd`/../install/bin
 
-if [ -z $CROSSTOOL ] ; then
-   CROSSTOOL=/opt/crosstool/cortex-a7/bin/arm-linux-gnueabi-
-fi
+LYFTP_SRC=ftp://master.iot-yun.club/src/
+
+CROSSTOOL=/opt/crosstool/cortex-a7/bin/arm-linux-gnueabi-
 
 function msg_banner()
 {
@@ -65,7 +65,8 @@
 
     msg_banner "Start donwload $SRC_NAME "
     if [ ! -f ${SRC_NAME}.${PACK_SUFIX} ] ; then
-        wget http://www.thekelleys.org.uk/dnsmasq/${SRC_NAME}.${PACK_SUFIX}
+        #wget http://www.thekelleys.org.uk/dnsmasq/${SRC_NAME}.${PACK_SUFIX}
+        wget $LYFTP_SRC/$SRC_NAME.$PACK_SUFIX
         check_result "ERROR: download ${SRC_NAME} failure"
     fi
 
diff --git a/3rdparty/dropbear/build.sh b/3rdparty/dropbear/build.sh
index dc6f027..6ceaebc 100755
--- a/3rdparty/dropbear/build.sh
+++ b/3rdparty/dropbear/build.sh
@@ -9,9 +9,9 @@
 
 PREFIX_PATH=`pwd`/../install/
 
-if [ -z $CROSSTOOL ] ; then
-   CROSSTOOL=/opt/crosstool/cortex-a7/bin/arm-linux-gnueabi-
-fi
+LYFTP_SRC=ftp://master.iot-yun.club/src/
+
+CROSSTOOL=/opt/crosstool/cortex-a7/bin/arm-linux-gnueabi-
 
 function msg_banner()
 {
@@ -76,7 +76,8 @@
 
     msg_banner "Start donwload $SRC_NAME "
     if [ ! -f ${SRC_NAME}.${PACK_SUFIX} ] ; then
-        wget http://matt.ucc.asn.au/dropbear/releases/${SRC_NAME}.${PACK_SUFIX}
+        #wget http://matt.ucc.asn.au/dropbear/releases/${SRC_NAME}.${PACK_SUFIX}
+        wget $LYFTP_SRC/$SRC_NAME.$PACK_SUFIX
         check_result "ERROR: download ${SRC_NAME} failure"
     fi
 
diff --git a/3rdparty/ethtool/build.sh b/3rdparty/ethtool/build.sh
index 1d7e69f..ad7b3d5 100755
--- a/3rdparty/ethtool/build.sh
+++ b/3rdparty/ethtool/build.sh
@@ -11,9 +11,7 @@
 
 LYFTP_SRC=ftp://master.iot-yun.club/src/
 
-if [ -z $CROSSTOOL ] ; then
-   CROSSTOOL=/opt/crosstool/cortex-a7/bin/arm-linux-gnueabi-
-fi
+CROSSTOOL=/opt/crosstool/cortex-a7/bin/arm-linux-gnueabi-
 
 function msg_banner()
 {
diff --git a/3rdparty/fbgrab/build.sh b/3rdparty/fbgrab/build.sh
index 05ec4f3..bcb37bc 100755
--- a/3rdparty/fbgrab/build.sh
+++ b/3rdparty/fbgrab/build.sh
@@ -12,9 +12,7 @@
 
 LYFTP_SRC=ftp://master.iot-yun.club/src/
 
-if [ -z $CROSSTOOL ] ; then
-   CROSSTOOL=/opt/crosstool/cortex-a7/bin/arm-linux-gnueabi-
-fi
+CROSSTOOL=/opt/crosstool/cortex-a7/bin/arm-linux-gnueabi-
 
 function msg_banner()
 {
diff --git a/3rdparty/ffmpeg/build.sh b/3rdparty/ffmpeg/build.sh
index a4b266c..6914cec 100755
--- a/3rdparty/ffmpeg/build.sh
+++ b/3rdparty/ffmpeg/build.sh
@@ -11,9 +11,7 @@
 
 LYFTP_SRC=ftp://master.iot-yun.club/src/
 
-if [ -z $CROSSTOOL ] ; then
-   CROSSTOOL=/opt/crosstool/cortex-a7/bin/arm-linux-gnueabi-
-fi
+CROSSTOOL=/opt/crosstool/cortex-a7/bin/arm-linux-gnueabi-
 
 function msg_banner()
 {
@@ -85,9 +83,9 @@
     check_result "ERROR: compile ${SRC_NAME} failure"
 
     ${STRIP} ${IMG_NAME}
-    ${STRIP} ffserver
-    cp ${IMG_NAME} ${PREFIX_PATH}
-    cp ffserver ${PREFIX_PATH}
+    #${STRIP} ffserver
+    #cp ${IMG_NAME} ${PREFIX_PATH}
+    #cp ffserver ${PREFIX_PATH}
 
     cd -
 }
diff --git a/3rdparty/file/build.sh b/3rdparty/file/build.sh
index b6808c1..27566d5 100755
--- a/3rdparty/file/build.sh
+++ b/3rdparty/file/build.sh
@@ -11,9 +11,7 @@
 
 LYFTP_SRC=ftp://master.iot-yun.club/src/
 
-if [ -z $CROSSTOOL ] ; then
-   CROSSTOOL=/opt/crosstool/cortex-a7/bin/arm-linux-gnueabi-
-fi
+CROSSTOOL=/opt/crosstool/cortex-a7/bin/arm-linux-gnueabi-
 
 function msg_banner()
 {
@@ -62,7 +60,7 @@
     SRC_NAME=file-5.04
     PACK_SUFIX=tar.gz
 
-    if [ -f ${PREFIX_PATH}/ethtool ] ; then
+    if [ -f ${PREFIX_PATH}/file ] ; then
         return 0;
     fi
 
diff --git a/3rdparty/imageMagick/build.sh b/3rdparty/imageMagick/build.sh
new file mode 100755
index 0000000..d373af6
--- /dev/null
+++ b/3rdparty/imageMagick/build.sh
@@ -0,0 +1,96 @@
+#!/bin/bash
+
+#+--------------------------------------------------------------------------------------------
+#|Description:  This shell script used download and compile imageMagick for ARM
+#|     Author:  GuoWenxue <guowenxue@gmail.com>
+#|  ChangeLog:
+#|           1, Initialize 1.0.0 on 2011.04.12
+#+--------------------------------------------------------------------------------------------
+
+PREFIX_PATH=`pwd`/../install/
+
+LYFTP_SRC=ftp://master.iot-yun.club/src/
+
+CROSSTOOL=/opt/crosstool/cortex-a7/bin/arm-linux-gnueabi-
+
+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_imageMagick()
+{
+    SRC_NAME=ImageMagick6-6.9.4-0
+    PACK_SUFIX=tar.gz
+
+    if [ -f $PREFIX_PATH/lib/libMagickCore-6.Q16.a ] ; then
+        return 0;
+    fi
+
+    msg_banner "Start cross compile $SRC_NAME "
+
+    if [ ! -f ${SRC_NAME}.${PACK_SUFIX} ] ; then
+        wget ${LYFTP_SRC}/${SRC_NAME}.${PACK_SUFIX}
+        check_result "ERROR: download ${SRC_NAME} failure"
+    fi
+
+    tar -xzf ${SRC_NAME}.${PACK_SUFIX}
+    cd ${SRC_NAME}
+
+    CFLAGS="-I${PREFIX_PATH}/include -DMAGICKCORE_QUANTUM_DEPTH=16" LDFLAGS=-L${PREFIX_PATH}/lib \
+    ./configure --host=arm-linux --enable-static --disable-shared --prefix=$PREFIX_PATH \
+    --without-magick-plus-plus --without-perl --without-x --without-dps --without-xml \
+    --without-pango --without-freetype --without-png
+
+    check_result "ERROR: configure ${SRC_NAME} failure"
+
+    make && make install
+    check_result "ERROR: compile ${SRC_NAME} failure"
+
+    cd -
+}
+
+
+export_cross
+
+compile_imageMagick
+
+
+
diff --git a/3rdparty/iptables/build.sh b/3rdparty/iptables/build.sh
index 075af85..9dd5c37 100755
--- a/3rdparty/iptables/build.sh
+++ b/3rdparty/iptables/build.sh
@@ -9,9 +9,9 @@
 
 PREFIX_PATH=`pwd`/../install/bin
 
-if [ -z $CROSSTOOL ] ; then
-   CROSSTOOL=/opt/crosstool/cortex-a7/bin/arm-linux-gnueabi-
-fi
+LYFTP_SRC=ftp://master.iot-yun.club/src/
+
+CROSSTOOL=/opt/crosstool/cortex-a7/bin/arm-linux-gnueabi-
 
 function msg_banner()
 {
@@ -67,7 +67,8 @@
     msg_banner "Start cross compile $SRC_NAME "
 
     if [ ! -f ${SRC_NAME}.${PACK_SUFIX} ] ; then
-        wget http://www.netfilter.org/projects/iptables/files/${SRC_NAME}.${PACK_SUFIX}
+        #wget http://www.netfilter.org/projects/iptables/files/${SRC_NAME}.${PACK_SUFIX}
+        wget $LYFTP_SRC/$SRC_NAME.$PACK_SUFIX
         check_result "ERROR: download ${SRC_NAME} failure"
     fi
 
diff --git a/3rdparty/libconfig/build.sh b/3rdparty/libconfig/build.sh
index e6e3110..9ab42b5 100755
--- a/3rdparty/libconfig/build.sh
+++ b/3rdparty/libconfig/build.sh
@@ -11,9 +11,7 @@
 
 LYFTP_SRC=ftp://master.iot-yun.club/src/
 
-if [ -z $CROSSTOOL ] ; then
-   CROSSTOOL=/opt/crosstool/cortex-a7/bin/arm-linux-gnueabi-
-fi
+CROSSTOOL=/opt/crosstool/cortex-a7/bin/arm-linux-gnueabi-
 
 function msg_banner()
 {
diff --git a/3rdparty/libevent/build.sh b/3rdparty/libevent/build.sh
index 19451ba..252ec3f 100755
--- a/3rdparty/libevent/build.sh
+++ b/3rdparty/libevent/build.sh
@@ -11,9 +11,7 @@
 
 LYFTP_SRC=ftp://master.iot-yun.club/src/
 
-if [ -z $CROSSTOOL ] ; then
-   CROSSTOOL=/opt/crosstool/cortex-a7/bin/arm-linux-gnueabi-
-fi
+CROSSTOOL=/opt/crosstool/cortex-a7/bin/arm-linux-gnueabi-
 
 function msg_banner()
 {
diff --git a/3rdparty/libpng/build.sh b/3rdparty/libpng/build.sh
index 33a1275..2eb9e68 100755
--- a/3rdparty/libpng/build.sh
+++ b/3rdparty/libpng/build.sh
@@ -12,9 +12,7 @@
 
 LYFTP_SRC=ftp://master.iot-yun.club/src/
 
-if [ -z $CROSSTOOL ] ; then
-   CROSSTOOL=/opt/crosstool/cortex-a7/bin/arm-linux-gnueabi-
-fi
+CROSSTOOL=/opt/crosstool/cortex-a7/bin/arm-linux-gnueabi-
 
 function msg_banner()
 {
diff --git a/3rdparty/libressl/build.sh b/3rdparty/libressl/build.sh
new file mode 100755
index 0000000..aac5b5c
--- /dev/null
+++ b/3rdparty/libressl/build.sh
@@ -0,0 +1,94 @@
+#!/bin/bash
+
+#+--------------------------------------------------------------------------------------------
+#|Description:  This shell script used download and compile libressl for ARM
+#|     Author:  GuoWenxue <guowenxue@gmail.com>
+#|  ChangeLog:
+#|           1, Initialize 1.0.0 on 2011.04.12
+#+--------------------------------------------------------------------------------------------
+
+PREFIX_PATH=`pwd`/../install
+
+LYFTP_SRC=ftp://master.iot-yun.club/src/
+
+CROSSTOOL=/opt/crosstool/cortex-a7/bin/arm-linux-gnueabi-
+
+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_libressl()
+{
+    SRC_NAME=libressl-2.9.2
+    PACK_SUFIX=tar.gz 
+
+    if [ -f ${PREFIX_PATH}/lib/libcrypto.a ] ; then 
+        return 0;
+    fi  
+    
+    msg_banner "Start cross compile $SRC_NAME " 
+    if [ ! -f ${SRC_NAME}.${PACK_SUFIX} ] ; then 
+        #wget https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/${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} 
+    touch *
+    
+    export CFLAGS=-fPIC
+    #./configure ${CONFIG_CROSS} --prefix=${PREFIX_PATH} --with-pic --disable-shared --enable-static LIBS="-lpthread"
+    ./configure ${CONFIG_CROSS} --prefix=${PREFIX_PATH} --with-pic LIBS="-lpthread"
+
+    make && make install 
+    check_result "ERROR: compile ${SRC_NAME} failure" 
+
+    cd - 
+} 
+
+printf "\nWARRNING: libressl is a candidate of openssl, so don't compile it if openssl enabled\n\n"
+exit;
+
+export_cross
+
+compile_libressl
+
+
diff --git a/3rdparty/lrzsz/build.sh b/3rdparty/lrzsz/build.sh
index e56b054..9e7bf9d 100755
--- a/3rdparty/lrzsz/build.sh
+++ b/3rdparty/lrzsz/build.sh
@@ -10,6 +10,8 @@
 PRJ_PATH=`pwd`
 PREFIX_PATH=`pwd`/../install
 
+LYFTP_SRC=ftp://master.iot-yun.club/src/
+
 CROSSTOOL=/opt/crosstool/cortex-a7/bin/arm-linux-gnueabi-
 
 function msg_banner()
@@ -66,7 +68,8 @@
     msg_banner "Start cross compile $SRC_NAME "
 
     if [ ! -f ${SRC_NAME}.${PACK_SUFIX} ] ; then
-        wget http://www.ohse.de/uwe/releases/${SRC_NAME}.${PACK_SUFIX}
+        #wget http://www.ohse.de/uwe/releases/${SRC_NAME}.${PACK_SUFIX}
+        wget $LYFTP_SRC/$SRC_NAME.$PACK_SUFIX
         check_result "ERROR: download ${SRC_NAME} failure"
     fi
 
diff --git a/3rdparty/mosquitto/build.sh b/3rdparty/mosquitto/build.sh
index 940dc2c..ebaa65d 100755
--- a/3rdparty/mosquitto/build.sh
+++ b/3rdparty/mosquitto/build.sh
@@ -11,9 +11,7 @@
 
 LYFTP_SRC=ftp://master.iot-yun.club/src/
 
-if [ -z $CROSSTOOL ] ; then
-   CROSSTOOL=/opt/crosstool/cortex-a7/bin/arm-linux-gnueabi- 
-fi
+CROSSTOOL=/opt/crosstool/cortex-a7/bin/arm-linux-gnueabi- 
 
 function msg_banner()
 {
diff --git a/3rdparty/ntpdate/build.sh b/3rdparty/ntpdate/build.sh
index 971d1bb..9b1dc2a 100755
--- a/3rdparty/ntpdate/build.sh
+++ b/3rdparty/ntpdate/build.sh
@@ -11,9 +11,7 @@
 
 LYFTP_SRC=ftp://master.iot-yun.club/src/
 
-if [ -z $CROSSTOOL ] ; then
-   CROSSTOOL=/opt/crosstool/cortex-a7/bin/arm-linux-gnueabi-
-fi
+CROSSTOOL=/opt/crosstool/cortex-a7/bin/arm-linux-gnueabi-
 
 function msg_banner()
 {
@@ -68,8 +66,8 @@
 
     msg_banner "Start donwload $SRC_NAME "
     if [ ! -f ${SRC_NAME}.${PACK_SUFIX} ] ; then
-        wget https://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/${SRC_NAME}.${PACK_SUFIX}
-        #wget ${LYFTP_SRC}/${SRC_NAME}.${PACK_SUFIX}
+        #wget https://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/${SRC_NAME}.${PACK_SUFIX}
+        wget ${LYFTP_SRC}/${SRC_NAME}.${PACK_SUFIX}
         check_result "ERROR: download ${SRC_NAME} failure"
     fi
 
diff --git a/3rdparty/opencv/build.sh b/3rdparty/opencv/build.sh
index a83583a..ee25270 100755
--- a/3rdparty/opencv/build.sh
+++ b/3rdparty/opencv/build.sh
@@ -4,13 +4,17 @@
 
 OPENCV_SRC=opencv-3.4.6
 
+LYFTP_SRC=ftp://master.iot-yun.club/src/
+
+CROSSTOOL=/opt/crosstool/cortex-a7/bin/arm-linux-gnueabi-
+
 TOOLCHAIN=cortexa7.toolchain.cmake
 
 JOBS=`cat /proc/cpuinfo  |  grep processor | wc -l`
 
 if [ ! -d $OPENCV_SRC ] ; then
     if [ ! -f $OPENCV_SRC.zip ] ; then
-        wget ftp://master.iot-yun.club/src/$OPENCV_SRC.zip
+        wget $LYFTP_SRC/$OPENCV_SRC.zip
     fi
 
     unzip $OPENCV_SRC.zip
@@ -22,7 +26,7 @@
 cat >platforms/linux/${TOOLCHAIN} <<EOF
 
 set(GCC_COMPILER_VERSION "" CACHE STRING "GCC Compiler version")
-set(GNU_MACHINE "/opt/crosstool/cortex-a7/bin/arm-linux-gnueabi" CACHE STRING "GNU compiler triple")
+set(GNU_MACHINE "${CROSSTOOL%*-}" CACHE STRING "GNU compiler triple")
 include("\${CMAKE_CURRENT_LIST_DIR}/arm.toolchain.cmake")
 
 EOF
diff --git a/3rdparty/openssh/build.sh b/3rdparty/openssh/build.sh
index 982895d..a2387cb 100755
--- a/3rdparty/openssh/build.sh
+++ b/3rdparty/openssh/build.sh
@@ -13,10 +13,7 @@
 
 LYFTP_SRC=ftp://master.iot-yun.club/src/
 
-if [ -z $CROSSTOOL ] ; then
-   CROSSTOOL=/opt/crosstool/cortex-a7/bin/arm-linux-gnueabi-
-  #  CROSSTOOL=/opt/rpi/arm-bcm2708/arm-linux-gnueabihf/bin/arm-linux-
-fi
+CROSSTOOL=/opt/crosstool/cortex-a7/bin/arm-linux-gnueabi-
 
 function msg_banner()
 {
diff --git a/3rdparty/openssh/openssl/build.sh b/3rdparty/openssh/openssl/build.sh
index 25784ca..17fe1d0 100755
--- a/3rdparty/openssh/openssl/build.sh
+++ b/3rdparty/openssh/openssl/build.sh
@@ -11,10 +11,7 @@
 
 LYFTP_SRC=ftp://master.iot-yun.club/src/
 
-if [ -z $CROSSTOOL ] ; then
-  CROSSTOOL=/opt/crosstool/cortex-a7/bin/arm-linux-gnueabi-
-  #CROSSTOOL=/opt/rpi/arm-bcm2708/arm-linux-gnueabihf/bin/arm-linux-
-fi
+CROSSTOOL=/opt/crosstool/cortex-a7/bin/arm-linux-gnueabi-
 
 function msg_banner()
 {
diff --git a/3rdparty/openssh/zlib/build.sh b/3rdparty/openssh/zlib/build.sh
index a983c7f..3db8762 100755
--- a/3rdparty/openssh/zlib/build.sh
+++ b/3rdparty/openssh/zlib/build.sh
@@ -11,10 +11,7 @@
 
 LYFTP_SRC=ftp://master.iot-yun.club/src/
 
-if [ -z $CROSSTOOL ] ; then
-   CROSSTOOL=/opt/crosstool/cortex-a7/bin/arm-linux-gnueabi-
-   #CROSSTOOL=/opt/rpi/arm-bcm2708/arm-linux-gnueabihf/bin/arm-linux-
-fi
+CROSSTOOL=/opt/crosstool/cortex-a7/bin/arm-linux-gnueabi-
 
 function msg_banner()
 {
diff --git a/3rdparty/openssl/build.sh b/3rdparty/openssl/build.sh
index 123eb10..b9a551b 100755
--- a/3rdparty/openssl/build.sh
+++ b/3rdparty/openssl/build.sh
@@ -11,9 +11,7 @@
 
 LYFTP_SRC=ftp://master.iot-yun.club/src/
 
-if [ -z $CROSSTOOL ] ; then
-   CROSSTOOL=/opt/crosstool/cortex-a7/bin/arm-linux-gnueabi-
-fi
+CROSSTOOL=/opt/crosstool/cortex-a7/bin/arm-linux-gnueabi-
 
 function msg_banner()
 {
diff --git a/3rdparty/pppd/build.sh b/3rdparty/pppd/build.sh
index e3b8c88..650b9e9 100755
--- a/3rdparty/pppd/build.sh
+++ b/3rdparty/pppd/build.sh
@@ -11,9 +11,7 @@
 
 LYFTP_SRC=ftp://master.iot-yun.club/src/
 
-if [ -z $CROSSTOOL ] ; then
-   CROSSTOOL=/opt/crosstool/cortex-a7/bin/arm-linux-gnueabi-
-fi
+CROSSTOOL=/opt/crosstool/cortex-a7/bin/arm-linux-gnueabi-
 
 function msg_banner()
 {
@@ -61,7 +59,7 @@
     SRC_NAME=ppp-2.4.7
     PACK_SUFIX=tar.gz
 
-    if [ -f ${PREFIX_PATH}/ethtool ] ; then
+    if [ -f ${PREFIX_PATH}/pppd ] ; then
         return 0;
     fi
 
diff --git a/3rdparty/qt/build_QT5.sh b/3rdparty/qt/build_QT5.sh
index b8b5dfd..e25d7b7 100755
--- a/3rdparty/qt/build_QT5.sh
+++ b/3rdparty/qt/build_QT5.sh
@@ -18,9 +18,10 @@
 
 QT_INST_PATH=/apps/QT5.9_A8
 
+LYFTP_SRC=ftp://master.iot-yun.club/src/
+
 CROSSTOOL=/opt/crosstool/cortex-a7/bin/arm-linux-gnueabi-
 
-LYFTP_SRC=ftp://master.iot-yun.club/src/
 
 function msg_banner()
 {
diff --git a/3rdparty/sqlite/build.sh b/3rdparty/sqlite/build.sh
index e2f68ea..77454ba 100755
--- a/3rdparty/sqlite/build.sh
+++ b/3rdparty/sqlite/build.sh
@@ -11,9 +11,7 @@
 
 LYFTP_SRC=ftp://master.iot-yun.club/src/
 
-if [ -z $CROSSTOOL ] ; then
-   CROSSTOOL=/opt/crosstool/cortex-a7/bin/arm-linux-gnueabi-
-fi
+CROSSTOOL=/opt/crosstool/cortex-a7/bin/arm-linux-gnueabi-
 
 function msg_banner()
 {
diff --git a/3rdparty/stunnel/build.sh b/3rdparty/stunnel/build.sh
index f2088fd..05877df 100755
--- a/3rdparty/stunnel/build.sh
+++ b/3rdparty/stunnel/build.sh
@@ -11,9 +11,7 @@
 
 LYFTP_SRC=ftp://master.iot-yun.club/src/
 
-if [ -z $CROSSTOOL ] ; then
-   CROSSTOOL=/opt/crosstool/cortex-a7/bin/arm-linux-gnueabi-
-fi
+CROSSTOOL=/opt/crosstool/cortex-a7/bin/arm-linux-gnueabi-
 
 function msg_banner()
 {
@@ -70,8 +68,8 @@
     msg_banner "Start cross compile $SRC_NAME "
 
     if [ ! -f ${SRC_NAME}.${PACK_SUFIX} ] ; then
-        wget http://www.usenix.org.uk/mirrors/stunnel/${SRC_NAME}.${PACK_SUFIX}
-        #wget ${LYFTP_SRC}/${SRC_NAME}.${PACK_SUFIX}
+        #wget http://www.usenix.org.uk/mirrors/stunnel/${SRC_NAME}.${PACK_SUFIX}
+        wget ${LYFTP_SRC}/${SRC_NAME}.${PACK_SUFIX}
 
         check_result "ERROR: download ${SRC_NAME} failure"
     fi
diff --git a/3rdparty/tree/build.sh b/3rdparty/tree/build.sh
index 11fd569..e16a50d 100755
--- a/3rdparty/tree/build.sh
+++ b/3rdparty/tree/build.sh
@@ -11,9 +11,7 @@
 
 LYFTP_SRC=ftp://master.iot-yun.club/src/
 
-if [ -z $CROSSTOOL ] ; then
-   CROSSTOOL=/opt/crosstool/cortex-a7/bin/arm-linux-gnueabi-
-fi
+CROSSTOOL=/opt/crosstool/cortex-a7/bin/arm-linux-gnueabi-
 
 function msg_banner()
 {
@@ -61,7 +59,7 @@
     SRC_NAME=tree-1.8.0
     PACK_SUFIX=tgz
 
-    if [ -f ${PREFIX_PATH}/ethtool ] ; then
+    if [ -f ${PREFIX_PATH}/tree ] ; then
         return 0;
     fi
 
diff --git a/3rdparty/vsftpd/build.sh b/3rdparty/vsftpd/build.sh
index d5549af..3d3d998 100755
--- a/3rdparty/vsftpd/build.sh
+++ b/3rdparty/vsftpd/build.sh
@@ -11,9 +11,7 @@
 
 LYFTP_SRC=ftp://master.iot-yun.club/src/
 
-if [ -z $CROSSTOOL ] ; then
-   CROSSTOOL=/opt/crosstool/cortex-a7/bin/arm-linux-gnueabi-
-fi
+CROSSTOOL=/opt/crosstool/cortex-a7/bin/arm-linux-gnueabi-
 
 function msg_banner()
 {
diff --git a/3rdparty/zbar/build.sh b/3rdparty/zbar/build.sh
index 86512b3..f16d794 100755
--- a/3rdparty/zbar/build.sh
+++ b/3rdparty/zbar/build.sh
@@ -1,221 +1,115 @@
 #!/bin/bash
 
 #+--------------------------------------------------------------------------------------------
-#|Description:  This is shell script used to download a zbarapplication
-#|             and cross compile it.
+#|Description:  This shell script used download and compile zbar for ARM
 #|     Author:  GuoWenxue <guowenxue@gmail.com>
 #|  ChangeLog:
-#|           1, Initialize 1.0.0 on 2011.12.26
+#|           1, Initialize 1.0.0 on 2018.08.16
 #+--------------------------------------------------------------------------------------------
 
-set -e
-
-PRJ_PATH=`pwd`
-
-APP_NAME=zbar-latest
-APP_PACK=$APP_NAME.tar.bz2
-
-INST_PATH=$PRJ_PATH/../install
-
-CROSS=/opt/crosstool/cortex-a7/bin/arm-linux-gnueabi-
+PREFIX_PATH=`pwd`/../install/
 
 LYFTP_SRC=ftp://master.iot-yun.club/src/
 
-# arg1 is the packet download address
-# arg2 is the download packet rename name
-function download_packet()
+CROSSTOOL=/opt/crosstool/cortex-a7/bin/arm-linux-gnueabi-
+
+function msg_banner()
 {
-    if [ $# -lt 1 ] ; then
-        echo "ERROR: $0 without argument for packet download address"
-        exit;
+    echo ""
+    echo "+-----------------------------------------------------------------------"
+    echo "|  $1 "
+    echo "+-----------------------------------------------------------------------"
+    echo ""
+}
+
+function check_result()
+{
+    if [ $? != 0 ] ; then
+       echo ""
+       echo "+-----------------------------------------------------------------------"
+       echo "|  $1 "
+       echo "+-----------------------------------------------------------------------"
+       echo ""
+       exit ;
     fi
+}
 
-    rename=0
+function export_cross()
+{
+    # export cross toolchain
+    export CC=${CROSSTOOL}gcc
+    export CXX=${CROSSTOOL}g++
+    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
 
-    dl_addr=$1
-    dl_file=`basename $dl_addr`
+    # export cross configure 
+    export CONFIG_CROSS=" --build=i686-pc-linux --host=arm-linux "
 
-    if [ $# -ge 2 ] ; then
-        pack=$2
-        rename=1
-    else
-        pack=$dl_file
-    fi
+    # Clear LDFLAGS and CFLAGS
+    export LDFLAGS=
+    export CFLAGS=
+}
 
-    if [ -s $pack ] ; then
-        echo "INFO: $pack already exist, skip download it"
+
+function compile_zbar()
+{
+    SRC_NAME=zbar-latest
+    PACK_SUFIX=tar.bz2
+
+    if [ -f ${PREFIX_PATH}/bin/zbarcam ] ; then
+        echo "$SRC_NAME already compile and installed"
         return 0;
     fi
 
-    echo "INFO: Start to download packet $pack now"
-    wget $dl_addr 
+    msg_banner "Start cross compile $SRC_NAME "
 
-    if [ $? != 0  ] ; then
-        echo "ERROR: Download $pack failure, exit now..."
-        exit;
-    fi 
-    echo "INFO: Download $pack ok!"
+    if [ ! -f ${SRC_NAME}.${PACK_SUFIX} ] ; then
+        wget ${LYFTP_SRC}/${SRC_NAME}.${PACK_SUFIX}
 
-    if [ $rename != 0 ] ; then
-        mv  $dl_file $pack
+        check_result "ERROR: download ${SRC_NAME} failure"
     fi
 
-    return 0;
+    tar -xjf ${SRC_NAME}.${PACK_SUFIX}
+
+    cd ${SRC_NAME}
+
+
+    git checkout 8edfa5f8c4d11a54 && rm -rf * && git checkout .
+
+    autoreconf --install
+
+    CFLAGS="-DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16" \
+    ./configure --host=arm-linux --enable-static --enable-shared --prefix=$PREFIX_PATH \
+    --without-gtk --without-python --without-qt --without-x --without-java  \
+    --with-imagemagick=${PREFIX_PATH}/ --without-graphicsmagick \
+    MAGICK_CFLAGS=-I${PREFIX_PATH}//include/ImageMagick-6 \
+    MAGICK_LIBS="-L${PREFIX_PATH}/lib -lMagickWand-6.Q16 -lMagickCore-6.Q16 -lm -lz -L`pwd`/zbar/.libs/ -lzbar "
+
+     mkdir -p ./doc/man/ 
+     touch ./doc/man/zbarimg.1 
+     touch ./doc/man/zbarcam.1 
+     make all && make install
+
+    cd -
 }
 
-function decompress_packet()
-(
-   echo "+---------------------------------------------+"
-   echo "|  Decompress $1 now"  
-   echo "+---------------------------------------------+"
-   rv=0;
-
-    ftype=`file "$1"`
-    case "$ftype" in
-       "$1: Zip archive"*)
-           unzip "$1" ;;
-
-       "$1: gzip compressed"*)
-           if [ 0 != `expr "$1" : ".*.tar.*" ` ] ; then
-               tar -xzf $1
-           else
-               gzip -d "$1"
-           fi ;;
-
-       "$1: bzip2 compressed"*)
-           if [ 0 != `expr "$1" : ".*.tar.*" ` ] ; then
-               tar -xjf $1
-           else
-               bunzip2 "$1"
-           fi ;;
-
-       "$1: POSIX tar archive"*)
-           tar -xf "$1" ;;
-
-       "$1: LZMA compressed data, streamed"*)
-           xz -d $1 && tar -xf `ls *.tar` ;;
-
-       *)
-           rv=1;
-           echo "$1 is unknow compress format";;
-    esac
-
-    if [ $rv != 0 ] ; then
-        echo "ERROR: Decompress $1 failure, exit now..."
-        exit 1;
-    fi
-
-    return $rv;
-)
-
-export CC=${CROSS}gcc 
-export CXX=${CROSS}g++ 
-export AR=${CROSS}ar 
-export AS=${CROSS}as 
-export LD=${CROSS}ld 
-export NM=${CROSS}nm 
-export RANLIB=${CROSS}ranlib 
-export STRIP=${CROSS}strip
-
-if [ -d $INST_PATH ] ; then
-    echo "INFO: $APP_NAME already cross compiled, exit now ..."
-    #exit;
-fi
-
-
-LIB_ZLIB=zlib-1.2.11
-PACK_ZLIB=$LIB_ZLIB.tar.gz
-
-if [ ! -f $INST_PATH/lib/libz.so ] ; then
-
-    download_packet  ${LYFTP_SRC}/${PACK_ZLIB} 
-
-    if [ ! -d $LIB_ZLIB ] ; then
-        decompress_packet $PACK_ZLIB
-        if [ $? != 0 ] ; then
-            exit 1;
-        fi
-    fi
-
-    echo "+------------------------------------------------------------------+"
-    echo "|          Build $LIB_ZLIB for $ARCH "
-    echo "| Crosstool:  $CROSS"
-    echo "+------------------------------------------------------------------+"
-
-    cd $LIB_ZLIB
-    ./configure --prefix=$INST_PATH 
-    make && make install
-    cd -
-else
-    echo "+------------------------------------------------------------------+"
-    echo "|          $LIB_ZLIB already ready "
-    echo "+------------------------------------------------------------------+"
-fi
-
-LIB_IMGIC=ImageMagick6-6.9.4-0 
-PACK_IMGIC=$LIB_IMGIC.tar.gz
-
-if [ ! -f $INST_PATH/lib/libMagickCore-6.Q16.a ] ; then
-
-    download_packet  ${LYFTP_SRC}/${PACK_IMGIC}
-
-    if [ ! -d $LIB_IMGIC ] ; then
-        decompress_packet $PACK_IMGIC
-        if [ $? != 0 ] ; then
-            exit 1;
-        fi
-    fi
-
-    echo "+------------------------------------------------------------------+"
-    echo "|          Build $LIB_IMGIC for $ARCH "
-    echo "| Crosstool:  $CROSS"
-    echo "+------------------------------------------------------------------+"
-
-    cd $LIB_IMGIC
-
-    CFLAGS="-I${INST_PATH}/include -DMAGICKCORE_QUANTUM_DEPTH=16" LDFLAGS=-L${INST_PATH}/lib \
-    ./configure --host=arm-linux --enable-static --disable-shared --prefix=$INST_PATH \
-    --without-magick-plus-plus --without-perl --without-x --without-dps --without-xml \
-    --without-pango --without-freetype --without-png
-  
-    make && make install
-    cd -
-else
-    echo "+------------------------------------------------------------------+"
-    echo "|          $LIB_IMGIC already ready "
-    echo "+------------------------------------------------------------------+"
-fi
-
-
-# Download source code packet
-download_packet ${LYFTP_SRC}/zbar-latest.tar.bz2
-
-# Decompress source code packet 
-if [ ! -d $APP_NAME ] ; then 
-    decompress_packet $APP_PACK
-    if [ $? != 0 ] ; then
-        exit 1;
-    fi
-fi
-
-
-echo "+------------------------------------------------------------------+"
-echo "|          Build $APP_NAME for $ARCH "
-echo "| Crosstool:  $CROSS"
-echo "+------------------------------------------------------------------+"
-
-cd $APP_NAME
-   git checkout 8edfa5f8c4d11a54 && rm -rf * && git checkout .
-   autoreconf --install
-   CFLAGS="-DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16" \
-       ./configure --host=arm-linux --enable-static --enable-shared --prefix=$INST_PATH \
-   --without-gtk --without-python --without-qt --without-x --without-java  \
-   --with-imagemagick=${INST_PATH}/ --without-graphicsmagick \
-   MAGICK_CFLAGS=-I${INST_PATH}//include/ImageMagick-6  MAGICK_LIBS="-L${INST_PATH}/lib -lMagickWand-6.Q16 -lMagickCore-6.Q16 -lm -lz -L`pwd`/zbar/.libs/ -lzbar "
-  
-   mkdir -p ./doc/man/
-   touch ./doc/man/zbarimg.1
-   touch ./doc/man/zbarcam.1
-   make all && make install
+cd ../zlib 
+    ./build.sh 
 cd -
 
+
+cd ../imageMagick
+    ./build.sh 
+cd -
+
+
+export_cross
+
+compile_zbar
+
+
diff --git a/3rdparty/zlib/build.sh b/3rdparty/zlib/build.sh
index bbe204e..3db8762 100755
--- a/3rdparty/zlib/build.sh
+++ b/3rdparty/zlib/build.sh
@@ -11,9 +11,7 @@
 
 LYFTP_SRC=ftp://master.iot-yun.club/src/
 
-if [ -z $CROSSTOOL ] ; then
-   CROSSTOOL=/opt/crosstool/cortex-a7/bin/arm-linux-gnueabi-
-fi
+CROSSTOOL=/opt/crosstool/cortex-a7/bin/arm-linux-gnueabi-
 
 function msg_banner()
 {

--
Gitblit v1.9.1