From ce4ca18443a69785c81095bdecbd3db22da73ef9 Mon Sep 17 00:00:00 2001
From: guowenxue <guowenxue@gmail.com>
Date: Mon, 05 Aug 2019 20:22:13 +0800
Subject: [PATCH] Add fbgrab libpng zlib build shell script, and update dnsmasq file tree build shell script for copy bug

---
 3rdparty/libpng/build.sh  |  104 +++++++++++++++++
 3rdparty/tree/build.sh    |    3 
 3rdparty/zlib/build.sh    |   96 ++++++++++++++++
 3rdparty/dnsmasq/build.sh |    3 
 3rdparty/fbgrab/build.sh  |  107 +++++++++++++++++
 3rdparty/file/build.sh    |    3 
 6 files changed, 313 insertions(+), 3 deletions(-)

diff --git a/3rdparty/dnsmasq/build.sh b/3rdparty/dnsmasq/build.sh
index a92b1ee..190b75b 100755
--- a/3rdparty/dnsmasq/build.sh
+++ b/3rdparty/dnsmasq/build.sh
@@ -78,7 +78,8 @@
     check_result "ERROR: compile ${SRC_NAME} failure"
 
     ${STRIP} src/dnsmasq
-    cp src/dnsmasq ${PREFIX_PATH} ../
+    cp src/dnsmasq ../
+    cp src/dnsmasq ${PREFIX_PATH} 
 
     cd -
 }
diff --git a/3rdparty/fbgrab/build.sh b/3rdparty/fbgrab/build.sh
new file mode 100755
index 0000000..05ec4f3
--- /dev/null
+++ b/3rdparty/fbgrab/build.sh
@@ -0,0 +1,107 @@
+#!/bin/bash
+
+#+--------------------------------------------------------------------------------------------
+#|Description:  This shell script used download and compile fbgrab for ARM
+#|     Author:  GuoWenxue <guowenxue@gmail.com>
+#|  ChangeLog:
+#|           1, Initialize 1.0.0 on 2011.04.12
+#+--------------------------------------------------------------------------------------------
+
+PRJ_PATH=`pwd`
+PREFIX_PATH=`pwd`/../install/
+
+LYFTP_SRC=ftp://master.iot-yun.club/src/
+
+if [ -z $CROSSTOOL ] ; then
+   CROSSTOOL=/opt/crosstool/cortex-a7/bin/arm-linux-gnueabi-
+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_fbgrab()
+{
+    IMG_NAME=fbgrab
+    SRC_NAME=fbgrab-1.3
+    PACK_SUFIX=tar.gz
+
+    if [ -f ${PREFIX_PATH}/bin/${IMG_NAME} ] ; then
+        return 0;
+    fi
+
+    msg_banner "Start cross compile $SRC_NAME "
+
+    if [ ! -f ${SRC_NAME}.${PACK_SUFIX} ] ; then
+        #wget https://fbgrab.monells.se/${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}
+
+    export LDFLAGS=" -L${PREFIX_PATH}/lib -static "
+    export CFLAGS+=" -I${PREFIX_PATH}/include "
+    sed -i "s/-lpng -lz/-lpng -lz -lm/g" Makefile 
+    make
+    check_result "ERROR: compile ${SRC_NAME} failure"
+
+    set -x
+    ${STRIP} ${IMG_NAME}
+    cp ${IMG_NAME} ..
+    cp ${IMG_NAME} ${PREFIX_PATH}/bin 
+
+    cd -
+}
+
+
+export_cross
+
+if [ ! -f ${PREFIX_PATH}/lib/libpng.a ] ; then
+    cd ../libpng
+    ./build.sh
+    cd -
+fi
+
+compile_fbgrab
+
+
diff --git a/3rdparty/file/build.sh b/3rdparty/file/build.sh
index eecd69a..b6808c1 100755
--- a/3rdparty/file/build.sh
+++ b/3rdparty/file/build.sh
@@ -84,7 +84,8 @@
     check_result "ERROR: compile ${SRC_NAME} failure"
 
     ${STRIP} src/file
-    cp src/file ${PREFIX_PATH} ..
+    cp src/file ..
+    cp src/file ${PREFIX_PATH} 
 
     cd -
 }
diff --git a/3rdparty/libpng/build.sh b/3rdparty/libpng/build.sh
new file mode 100755
index 0000000..33a1275
--- /dev/null
+++ b/3rdparty/libpng/build.sh
@@ -0,0 +1,104 @@
+#!/bin/bash
+
+#+--------------------------------------------------------------------------------------------
+#|Description:  This shell script used download and compile libpng for ARM
+#|     Author:  GuoWenxue <guowenxue@gmail.com>
+#|  ChangeLog:
+#|           1, Initialize 1.0.0 on 2011.04.12
+#+--------------------------------------------------------------------------------------------
+
+PRJ_PATH=`pwd`
+PREFIX_PATH=`pwd`/../install/
+
+LYFTP_SRC=ftp://master.iot-yun.club/src/
+
+if [ -z $CROSSTOOL ] ; then
+   CROSSTOOL=/opt/crosstool/cortex-a7/bin/arm-linux-gnueabi-
+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_png()
+{
+    SRC_NAME=libpng-1.6.37
+    PACK_SUFIX=tar.gz
+
+    if [ -f ${PREFIX_PATH}/lib/libpng.a ] ; then
+        return 0;
+    fi
+
+    msg_banner "Start cross compile $SRC_NAME "
+
+    if [ ! -f ${SRC_NAME}.${PACK_SUFIX} ] ; then
+        #wget https://nchc.dl.sourceforge.net/project/libpng/libpng16/1.6.37/${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}
+
+    export CFLAGS=" -I${PREFIX_PATH}/include" 
+    export CPPFLAGS=" -I${PREFIX_PATH}/include" 
+    export LDFLAGS=" -L${PREFIX_PATH}/lib" 
+    ./configure --prefix=${PREFIX_PATH} ${CONFIG_CROSS} --enable-static  --enable-shared --enable-arm-neon 
+    check_result "ERROR: configure ${SRC_NAME} failure"
+
+    make && make install
+    check_result "ERROR: compile ${SRC_NAME} failure"
+
+    cd -
+}
+
+export_cross
+
+if [ ! -f ${PREFIX_PATH}/lib/libz.a ] ; then 
+    cd ../zlib
+    ./build.sh
+    cd -
+fi
+
+compile_png
+
+
+
diff --git a/3rdparty/tree/build.sh b/3rdparty/tree/build.sh
index 2786783..11fd569 100755
--- a/3rdparty/tree/build.sh
+++ b/3rdparty/tree/build.sh
@@ -82,7 +82,8 @@
     check_result "ERROR: compile ${SRC_NAME} failure"
 
     ${STRIP} tree
-    cp tree ${PREFIX_PATH} ..
+    cp tree ${PREFIX_PATH} 
+    cp tree ..
 
     cd -
 }
diff --git a/3rdparty/zlib/build.sh b/3rdparty/zlib/build.sh
new file mode 100755
index 0000000..d5e0a9a
--- /dev/null
+++ b/3rdparty/zlib/build.sh
@@ -0,0 +1,96 @@
+#!/bin/bash
+
+#+--------------------------------------------------------------------------------------------
+#|Description:  This shell script used download and compile zlib for ARM
+#|     Author:  GuoWenxue <guowenxue@gmail.com>
+#|  ChangeLog:
+#|           1, Initialize 1.0.0 on 2011.04.12
+#+--------------------------------------------------------------------------------------------
+
+PRJ_PATH=`pwd`
+PREFIX_PATH=`pwd`/../install/
+
+LYFTP_SRC=ftp://master.iot-yun.club/src/
+
+if [ -z $CROSSTOOL ] ; then
+   CROSSTOOL=/opt/crosstool/cortex-a7/bin/arm-linux-gnueabi-
+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_zlib()
+{
+    SRC_NAME=zlib-1.2.11
+    PACK_SUFIX=tar.gz
+
+    if [ -f ${PREFIX_PATH}/lib/libz.a ] ; then
+        return 0;
+    fi
+
+    msg_banner "Start cross compile $SRC_NAME "
+
+    if [ ! -f ${SRC_NAME}.${PACK_SUFIX} ] ; then
+        #wget https://zlib.net/${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=${PREFIX_PATH}
+    check_result "ERROR: configure ${SRC_NAME} failure"
+
+    make && make install
+    check_result "ERROR: compile ${SRC_NAME} failure"
+
+    cd -
+}
+
+
+export_cross
+
+compile_zlib
+
+
+

--
Gitblit v1.9.1