LingYun open library local/cross compile shell scripts
guowenxue
yesterday 1ee652137c90cec0c3ff4ea34194cdf7d98202e6
update table to space for all the build shell scripts
16 files modified
2439 ■■■■ changed files
busybox/build.sh 163 ●●●● patch | view | raw | blame | history
cjson/build.sh 163 ●●●● patch | view | raw | blame | history
libevdev/build.sh 13 ●●●●● patch | view | raw | blame | history
libevent/build.sh 165 ●●●● patch | view | raw | blame | history
libgpiod/build.sh 169 ●●●● patch | view | raw | blame | history
libxml2/build.sh 165 ●●●● patch | view | raw | blame | history
lrzsz/build.sh 167 ●●●● patch | view | raw | blame | history
lvgl/build.sh 19 ●●●●● patch | view | raw | blame | history
mosquitto/build.sh 188 ●●●● patch | view | raw | blame | history
opencv/build.sh 180 ●●●● patch | view | raw | blame | history
openssl/build.sh 165 ●●●● patch | view | raw | blame | history
pppd/build.sh 192 ●●●● patch | view | raw | blame | history
qt/build.sh 184 ●●●● patch | view | raw | blame | history
sqlite/build.sh 163 ●●●● patch | view | raw | blame | history
stunnel/build.sh 178 ●●●● patch | view | raw | blame | history
valgrind/build.sh 165 ●●●● patch | view | raw | blame | history
busybox/build.sh
@@ -40,140 +40,141 @@
#+-------------------------+
function pr_error() {
    echo -e "\033[40;31m $1 \033[0m"
    echo -e "\033[40;31m $1 \033[0m"
}
function pr_warn() {
    echo -e "\033[40;33m $1 \033[0m"
    echo -e "\033[40;33m $1 \033[0m"
}
function pr_info() {
    echo -e "\033[40;32m $1 \033[0m"
    echo -e "\033[40;32m $1 \033[0m"
}
function check_result()
{
    if [ $? != 0 ] ; then
        pr_error $1
    fi
    if [ $? != 0 ] ; then
        pr_error $1
    fi
}
# decompress a packet to destination path
function do_unpack()
{
    tarball=$1
    dstpath=`pwd`
    tarball=$1
    dstpath=`pwd`
    if [[ $# == 2 ]] ; then
        dstpath=$2
    fi
    if [[ $# == 2 ]] ; then
        dstpath=$2
    fi
    pr_info "decompress $tarball => $dstpath"
    pr_info "decompress $tarball => $dstpath"
    mkdir -p $dstpath
    case $tarball in
        *.tar.gz)
            tar -xzf $tarball -C $dstpath
            ;;
    mkdir -p $dstpath
    case $tarball in
        *.tar.gz)
            tar -xzf $tarball -C $dstpath
            ;;
        *.tar.bz2)
            tar -xjf $tarball -C $dstpath
            ;;
        *.tar.bz2)
            tar -xjf $tarball -C $dstpath
            ;;
        *.tar.xz)
            tar -xJf $tarball -C $dstpath
            ;;
        *.tar.xz)
            tar -xJf $tarball -C $dstpath
            ;;
        *.tar.zst)
            tar -I zstd -xf $tarball -C $dstpath
            ;;
        *.tar.zst)
            tar -I zstd -xf $tarball -C $dstpath
            ;;
        *.tar)
            tar -xf $tarball -C $dstpath
            ;;
        *.tar)
            tar -xf $tarball -C $dstpath
            ;;
        *.zip)
            unzip -qo $tarball -d $dstpath
            ;;
        *.zip)
            unzip -qo $tarball -d $dstpath
            ;;
        *)
            pr_error "decompress Unsupport packet: $tarball"
            return 1;
            ;;
    esac
        *)
            pr_error "decompress Unsupport packet: $tarball"
            return 1;
            ;;
    esac
}
function do_export()
{
    BUILD_ARCH=$(uname -m)
    if [[ $BUILD_ARCH =~ "arm" ]] ; then
        pr_warn "local($BUILD_ARCH) compile $LIB_NAME"
        return ;
    fi
    BUILD_ARCH=$(uname -m)
    if [[ $BUILD_ARCH =~ "arm" ]] ; then
        pr_warn "local($BUILD_ARCH) compile $LIB_NAME"
        return ;
    fi
    pr_warn "cross(${CROSS_COMPILE}) compile $LIB_NAME"
    pr_warn "cross(${CROSS_COMPILE}) compile $LIB_NAME"
    # export cross toolchain
    export CC=${CROSS_COMPILE}gcc
    export CXX=${CROSS_COMPILE}g++
    export AS=${CROSS_COMPILE}as
    export AR=${CROSS_COMPILE}ar
    export LD=${CROSS_COMPILE}ld
    export NM=${CROSS_COMPILE}nm
    export RANLIB=${CROSS_COMPILE}ranlib
    export OBJDUMP=${CROSS_COMPILE}objdump
    export STRIP=${CROSS_COMPILE}strip
    # export cross toolchain
    export CC=${CROSS_COMPILE}gcc
    export CXX=${CROSS_COMPILE}g++
    export AS=${CROSS_COMPILE}as
    export AR=${CROSS_COMPILE}ar
    export LD=${CROSS_COMPILE}ld
    export NM=${CROSS_COMPILE}nm
    export RANLIB=${CROSS_COMPILE}ranlib
    export OBJDUMP=${CROSS_COMPILE}objdump
    export STRIP=${CROSS_COMPILE}strip
    # export cross configure
    export CONFIG_CROSS=" --build=i686-pc-linux --host=arm-linux "
    # export cross configure
    export CONFIG_CROSS=" --build=i686-pc-linux --host=arm-linux "
    # Clear LDFLAGS and CFLAGS
    export LDFLAGS=
    export CFLAGS=
    # Clear LDFLAGS and CFLAGS
    export LDFLAGS=
    export CFLAGS=
}
function do_fetch()
{
    if [ -e ${INST_FILE} ] ; then
        pr_warn "$LIB_NAME compile and installed alredy"
        exit ;
    fi
    if [ -e ${INST_FILE} ] ; then
        pr_warn "$LIB_NAME compile and installed alredy"
        exit ;
    fi
    if [ -d $LIB_NAME ] ; then
        pr_warn "$LIB_NAME fetch already"
        return ;
    fi
    if [ -d $LIB_NAME ] ; then
        pr_warn "$LIB_NAME fetch already"
        return ;
    fi
    if [ ! -f ${LIB_NAME}.${PACK_SUFIX} ] ; then
        wget ${LIB_URL}/${LIB_NAME}.${PACK_SUFIX}
        check_result "ERROR: download ${LIB_NAME} failure"
    fi
    if [ ! -f ${LIB_NAME}.${PACK_SUFIX} ] ; then
        wget ${LIB_URL}/${LIB_NAME}.${PACK_SUFIX}
        check_result "ERROR: download ${LIB_NAME} failure"
    fi
    do_unpack ${LIB_NAME}.${PACK_SUFIX}
    do_unpack ${LIB_NAME}.${PACK_SUFIX}
}
function do_build()
{
    cd $LIB_NAME
    cd $LIB_NAME
    cp $PRJ_PATH/config/${LIB_NAME}.config .config
    cp $PRJ_PATH/config/${LIB_NAME}.config .config
    do_export
    do_export
    make -j ${JOBS} CROSS_COMPILE=$CROSS_COMPILE
    check_result "ERROR: compile ${LIB_NAME} failure"
    make -j ${JOBS} CROSS_COMPILE=$CROSS_COMPILE
    check_result "ERROR: compile ${LIB_NAME} failure"
    cp busybox $PREFIX_PATH/bin
    install -m 755 -D busybox $PREFIX_PATH/bin/busybox
}
function do_clean()
{
    rm -rf *${LIB_NAME}*
    rm -rf *${LIB_NAME}*
}
if [[ $# == 1 && $1 == -c ]] ;then
    pr_warn "start clean ${LIB_NAME}"
    do_clean
    exit;
    pr_warn "start clean ${LIB_NAME}"
    do_clean
    exit;
fi
do_fetch
cjson/build.sh
@@ -40,140 +40,141 @@
#+-------------------------+
function pr_error() {
    echo -e "\033[40;31m $1 \033[0m"
    echo -e "\033[40;31m $1 \033[0m"
}
function pr_warn() {
    echo -e "\033[40;33m $1 \033[0m"
    echo -e "\033[40;33m $1 \033[0m"
}
function pr_info() {
    echo -e "\033[40;32m $1 \033[0m"
    echo -e "\033[40;32m $1 \033[0m"
}
function check_result()
{
    if [ $? != 0 ] ; then
        pr_error $1
    fi
    if [ $? != 0 ] ; then
        pr_error $1
    fi
}
# decompress a packet to destination path
function do_unpack()
{
    tarball=$1
    dstpath=`pwd`
    tarball=$1
    dstpath=`pwd`
    if [[ $# == 2 ]] ; then
        dstpath=$2
    fi
    if [[ $# == 2 ]] ; then
        dstpath=$2
    fi
    pr_info "decompress $tarball => $dstpath"
    pr_info "decompress $tarball => $dstpath"
    mkdir -p $dstpath
    case $tarball in
        *.tar.gz)
            tar -xzf $tarball -C $dstpath
            ;;
    mkdir -p $dstpath
    case $tarball in
        *.tar.gz)
            tar -xzf $tarball -C $dstpath
            ;;
        *.tar.bz2)
            tar -xjf $tarball -C $dstpath
            ;;
        *.tar.bz2)
            tar -xjf $tarball -C $dstpath
            ;;
        *.tar.xz)
            tar -xJf $tarball -C $dstpath
            ;;
        *.tar.xz)
            tar -xJf $tarball -C $dstpath
            ;;
        *.tar.zst)
            tar -I zstd -xf $tarball -C $dstpath
            ;;
        *.tar.zst)
            tar -I zstd -xf $tarball -C $dstpath
            ;;
        *.tar)
            tar -xf $tarball -C $dstpath
            ;;
        *.tar)
            tar -xf $tarball -C $dstpath
            ;;
        *.zip)
            unzip -qo $tarball -d $dstpath
            ;;
        *.zip)
            unzip -qo $tarball -d $dstpath
            ;;
        *)
            pr_error "decompress Unsupport packet: $tarball"
            return 1;
            ;;
    esac
        *)
            pr_error "decompress Unsupport packet: $tarball"
            return 1;
            ;;
    esac
}
function do_export()
{
    BUILD_ARCH=$(uname -m)
    if [[ $BUILD_ARCH =~ "arm" ]] ; then
        pr_warn "local($BUILD_ARCH) compile $LIB_NAME"
        return ;
    fi
    BUILD_ARCH=$(uname -m)
    if [[ $BUILD_ARCH =~ "arm" ]] ; then
        pr_warn "local($BUILD_ARCH) compile $LIB_NAME"
        return ;
    fi
    pr_warn "cross(${CROSS_COMPILE}) compile $LIB_NAME"
    pr_warn "cross(${CROSS_COMPILE}) compile $LIB_NAME"
    # export cross toolchain
    export CC=${CROSS_COMPILE}gcc
    export CXX=${CROSS_COMPILE}g++
    export AS=${CROSS_COMPILE}as
    export AR=${CROSS_COMPILE}ar
    export LD=${CROSS_COMPILE}ld
    export NM=${CROSS_COMPILE}nm
    export RANLIB=${CROSS_COMPILE}ranlib
    export OBJDUMP=${CROSS_COMPILE}objdump
    export STRIP=${CROSS_COMPILE}strip
    # export cross toolchain
    export CC=${CROSS_COMPILE}gcc
    export CXX=${CROSS_COMPILE}g++
    export AS=${CROSS_COMPILE}as
    export AR=${CROSS_COMPILE}ar
    export LD=${CROSS_COMPILE}ld
    export NM=${CROSS_COMPILE}nm
    export RANLIB=${CROSS_COMPILE}ranlib
    export OBJDUMP=${CROSS_COMPILE}objdump
    export STRIP=${CROSS_COMPILE}strip
    # export cross configure
    export CONFIG_CROSS=" --build=i686-pc-linux --host=arm-linux "
    # export cross configure
    export CONFIG_CROSS=" --build=i686-pc-linux --host=arm-linux "
    # Clear LDFLAGS and CFLAGS
    export LDFLAGS=
    export CFLAGS=
    # Clear LDFLAGS and CFLAGS
    export LDFLAGS=
    export CFLAGS=
}
function do_fetch()
{
    if [ -e ${INST_FILE} ] ; then
        pr_warn "$LIB_NAME compile and installed alredy"
        exit ;
    fi
    if [ -e ${INST_FILE} ] ; then
        pr_warn "$LIB_NAME compile and installed alredy"
        exit ;
    fi
    if [ -d $LIB_NAME ] ; then
        pr_warn "$LIB_NAME fetch already"
        return ;
    fi
    if [ -d $LIB_NAME ] ; then
        pr_warn "$LIB_NAME fetch already"
        return ;
    fi
    if [ ! -f ${LIB_NAME}.${PACK_SUFIX} ] ; then
        wget ${LIB_URL}/${LIB_NAME}.${PACK_SUFIX}
        check_result "ERROR: download ${LIB_NAME} failure"
    fi
    if [ ! -f ${LIB_NAME}.${PACK_SUFIX} ] ; then
        wget ${LIB_URL}/${LIB_NAME}.${PACK_SUFIX}
        check_result "ERROR: download ${LIB_NAME} failure"
    fi
    do_unpack ${LIB_NAME}.${PACK_SUFIX}
    do_unpack ${LIB_NAME}.${PACK_SUFIX}
}
function do_build()
{
    cd $LIB_NAME
    cd $LIB_NAME
    do_export
    do_export
    sed -i "s|^CC =.*|CC = ${CROSS_COMPILE}gcc -std=c89|" Makefile
    sed -i "s|^CC =.*|CC = ${CROSS_COMPILE}gcc -std=c89|" Makefile
    make && make PREFIX=$PREFIX_PATH install
    check_result "ERROR: compile ${LIB_NAME} failure"
    make && make PREFIX=$PREFIX_PATH install
    check_result "ERROR: compile ${LIB_NAME} failure"
    cp libcjson.a $PREFIX_PATH/lib
    install -D libcjson.a $PREFIX_PATH/lib/libcjson.a
}
function do_clean()
{
    rm -rf *${LIB_NAME}*
    rm -rf *${LIB_NAME}*
}
if [[ $# == 1 && $1 == -c ]] ;then
    pr_warn "start clean ${LIB_NAME}"
    do_clean
    exit;
    pr_warn "start clean ${LIB_NAME}"
    do_clean
    exit;
fi
do_fetch
libevdev/build.sh
@@ -30,6 +30,9 @@
# download taballs path
TARBALL_PATH=$PRJ_PATH/tarballs
# check installed or not file
INST_FILE=$PREFIX_PATH/lib/libevdev.so
# shell script will exit once get command error
set -e
@@ -64,6 +67,11 @@
function do_fetch()
{
    if [ -e ${INST_FILE} ] ; then
        pr_warn "$LIB_NAME compiled already, exit..."
        exit;
    fi
    if [ -d $LIB_NAME ] ; then
        pr_warn "$LIB_NAME source code fetched already"
        return 0;
@@ -119,11 +127,6 @@
    exit;
fi
if [ -e $PREFIX_PATH/lib/libevdev.so ] ; then
    pr_warn "$LIB_NAME compiled already, exit..."
    exit;
fi
do_fetch
do_export
libevent/build.sh
@@ -40,140 +40,141 @@
#+-------------------------+
function pr_error() {
    echo -e "\033[40;31m $1 \033[0m"
    echo -e "\033[40;31m $1 \033[0m"
}
function pr_warn() {
    echo -e "\033[40;33m $1 \033[0m"
    echo -e "\033[40;33m $1 \033[0m"
}
function pr_info() {
    echo -e "\033[40;32m $1 \033[0m"
    echo -e "\033[40;32m $1 \033[0m"
}
function check_result()
{
    if [ $? != 0 ] ; then
        pr_error $1
    fi
    if [ $? != 0 ] ; then
        pr_error $1
    fi
}
# decompress a packet to destination path
function do_unpack()
{
    tarball=$1
    dstpath=`pwd`
    tarball=$1
    dstpath=`pwd`
    if [[ $# == 2 ]] ; then
        dstpath=$2
    fi
    if [[ $# == 2 ]] ; then
        dstpath=$2
    fi
    pr_info "decompress $tarball => $dstpath"
    pr_info "decompress $tarball => $dstpath"
    mkdir -p $dstpath
    case $tarball in
        *.tar.gz)
            tar -xzf $tarball -C $dstpath
            ;;
    mkdir -p $dstpath
    case $tarball in
        *.tar.gz)
            tar -xzf $tarball -C $dstpath
            ;;
        *.tar.bz2)
            tar -xjf $tarball -C $dstpath
            ;;
        *.tar.bz2)
            tar -xjf $tarball -C $dstpath
            ;;
        *.tar.xz)
            tar -xJf $tarball -C $dstpath
            ;;
        *.tar.xz)
            tar -xJf $tarball -C $dstpath
            ;;
        *.tar.zst)
            tar -I zstd -xf $tarball -C $dstpath
            ;;
        *.tar.zst)
            tar -I zstd -xf $tarball -C $dstpath
            ;;
        *.tar)
            tar -xf $tarball -C $dstpath
            ;;
        *.tar)
            tar -xf $tarball -C $dstpath
            ;;
        *.zip)
            unzip -qo $tarball -d $dstpath
            ;;
        *.zip)
            unzip -qo $tarball -d $dstpath
            ;;
        *)
            pr_error "decompress Unsupport packet: $tarball"
            return 1;
            ;;
    esac
        *)
            pr_error "decompress Unsupport packet: $tarball"
            return 1;
            ;;
    esac
}
function do_export()
{
    BUILD_ARCH=$(uname -m)
    if [[ $BUILD_ARCH =~ "arm" ]] ; then
        pr_warn "local($BUILD_ARCH) compile $LIB_NAME"
        return ;
    fi
    BUILD_ARCH=$(uname -m)
    if [[ $BUILD_ARCH =~ "arm" ]] ; then
        pr_warn "local($BUILD_ARCH) compile $LIB_NAME"
        return ;
    fi
    pr_warn "cross(${CROSS_COMPILE}) compile $LIB_NAME"
    pr_warn "cross(${CROSS_COMPILE}) compile $LIB_NAME"
    # export cross toolchain
    export CC=${CROSS_COMPILE}gcc
    export CXX=${CROSS_COMPILE}g++
    export AS=${CROSS_COMPILE}as
    export AR=${CROSS_COMPILE}ar
    export LD=${CROSS_COMPILE}ld
    export NM=${CROSS_COMPILE}nm
    export RANLIB=${CROSS_COMPILE}ranlib
    export OBJDUMP=${CROSS_COMPILE}objdump
    export STRIP=${CROSS_COMPILE}strip
    # export cross toolchain
    export CC=${CROSS_COMPILE}gcc
    export CXX=${CROSS_COMPILE}g++
    export AS=${CROSS_COMPILE}as
    export AR=${CROSS_COMPILE}ar
    export LD=${CROSS_COMPILE}ld
    export NM=${CROSS_COMPILE}nm
    export RANLIB=${CROSS_COMPILE}ranlib
    export OBJDUMP=${CROSS_COMPILE}objdump
    export STRIP=${CROSS_COMPILE}strip
    # export cross configure
    export CONFIG_CROSS=" --build=i686-pc-linux --host=arm-linux "
    # export cross configure
    export CONFIG_CROSS=" --build=i686-pc-linux --host=arm-linux "
    # Clear LDFLAGS and CFLAGS
    export LDFLAGS=
    export CFLAGS=
    # Clear LDFLAGS and CFLAGS
    export LDFLAGS=
    export CFLAGS=
}
function do_fetch()
{
    if [ -e ${INST_FILE} ] ; then
        pr_warn "$LIB_NAME compile and installed alredy"
        exit ;
    fi
    if [ -e ${INST_FILE} ] ; then
        pr_warn "$LIB_NAME compile and installed alredy"
        exit ;
    fi
    if [ -d $LIB_NAME ] ; then
        pr_warn "$LIB_NAME fetch already"
        return ;
    fi
    if [ -d $LIB_NAME ] ; then
        pr_warn "$LIB_NAME fetch already"
        return ;
    fi
    if [ ! -f ${LIB_NAME}.${PACK_SUFIX} ] ; then
        wget ${LIB_URL}/${LIB_NAME}.${PACK_SUFIX}
        check_result "ERROR: download ${LIB_NAME} failure"
    fi
    if [ ! -f ${LIB_NAME}.${PACK_SUFIX} ] ; then
        wget ${LIB_URL}/${LIB_NAME}.${PACK_SUFIX}
        check_result "ERROR: download ${LIB_NAME} failure"
    fi
    do_unpack ${LIB_NAME}.${PACK_SUFIX}
    do_unpack ${LIB_NAME}.${PACK_SUFIX}
}
function do_build()
{
    cd $LIB_NAME
    cd $LIB_NAME
    do_export
    do_export
    ./configure --prefix=${PREFIX_PATH} ${CONFIG_CROSS} --enable-static \
        --enable-thread-support --enable-openssl --enable-function-sections
    check_result "ERROR: configure ${LIB_NAME} failure"
    ./configure --prefix=${PREFIX_PATH} ${CONFIG_CROSS} --enable-static \
        --enable-thread-support --enable-openssl --enable-function-sections
    check_result "ERROR: configure ${LIB_NAME} failure"
    make && make install
    check_result "ERROR: compile ${LIB_NAME} failure"
    make -j ${JOBS} && make install
    check_result "ERROR: compile ${LIB_NAME} failure"
}
function do_clean()
{
    rm -rf *${LIB_NAME}*
    rm -rf *${LIB_NAME}*
}
if [[ $# == 1 && $1 == -c ]] ;then
    pr_warn "start clean ${LIB_NAME}"
    do_clean
    exit;
    pr_warn "start clean ${LIB_NAME}"
    do_clean
    exit;
fi
do_fetch
libgpiod/build.sh
@@ -40,143 +40,144 @@
#+-------------------------+
function pr_error() {
    echo -e "\033[40;31m $1 \033[0m"
    echo -e "\033[40;31m $1 \033[0m"
}
function pr_warn() {
    echo -e "\033[40;33m $1 \033[0m"
    echo -e "\033[40;33m $1 \033[0m"
}
function pr_info() {
    echo -e "\033[40;32m $1 \033[0m"
    echo -e "\033[40;32m $1 \033[0m"
}
function check_result()
{
    if [ $? != 0 ] ; then
        pr_error $1
    fi
    if [ $? != 0 ] ; then
        pr_error $1
    fi
}
# decompress a packet to destination path
function do_unpack()
{
    tarball=$1
    dstpath=`pwd`
    tarball=$1
    dstpath=`pwd`
    if [[ $# == 2 ]] ; then
        dstpath=$2
    fi
    if [[ $# == 2 ]] ; then
        dstpath=$2
    fi
    pr_info "decompress $tarball => $dstpath"
    pr_info "decompress $tarball => $dstpath"
    mkdir -p $dstpath
    case $tarball in
        *.tar.gz)
            tar -xzf $tarball -C $dstpath
            ;;
    mkdir -p $dstpath
    case $tarball in
        *.tar.gz)
            tar -xzf $tarball -C $dstpath
            ;;
        *.tar.bz2)
            tar -xjf $tarball -C $dstpath
            ;;
        *.tar.bz2)
            tar -xjf $tarball -C $dstpath
            ;;
        *.tar.xz)
            tar -xJf $tarball -C $dstpath
            ;;
        *.tar.xz)
            tar -xJf $tarball -C $dstpath
            ;;
        *.tar.zst)
            tar -I zstd -xf $tarball -C $dstpath
            ;;
        *.tar.zst)
            tar -I zstd -xf $tarball -C $dstpath
            ;;
        *.tar)
            tar -xf $tarball -C $dstpath
            ;;
        *.tar)
            tar -xf $tarball -C $dstpath
            ;;
        *.zip)
            unzip -qo $tarball -d $dstpath
            ;;
        *.zip)
            unzip -qo $tarball -d $dstpath
            ;;
        *)
            pr_error "decompress Unsupport packet: $tarball"
            return 1;
            ;;
    esac
        *)
            pr_error "decompress Unsupport packet: $tarball"
            return 1;
            ;;
    esac
}
function do_export()
{
    BUILD_ARCH=$(uname -m)
    if [[ $BUILD_ARCH =~ "arm" ]] ; then
        pr_warn "local($BUILD_ARCH) compile $LIB_NAME"
        return ;
    fi
    BUILD_ARCH=$(uname -m)
    if [[ $BUILD_ARCH =~ "arm" ]] ; then
        pr_warn "local($BUILD_ARCH) compile $LIB_NAME"
        return ;
    fi
    pr_warn "cross(${CROSS_COMPILE}) compile $LIB_NAME"
    pr_warn "cross(${CROSS_COMPILE}) compile $LIB_NAME"
    # export cross toolchain
    export CC=${CROSS_COMPILE}gcc
    export CXX=${CROSS_COMPILE}g++
    export AS=${CROSS_COMPILE}as
    export AR=${CROSS_COMPILE}ar
    export LD=${CROSS_COMPILE}ld
    export NM=${CROSS_COMPILE}nm
    export RANLIB=${CROSS_COMPILE}ranlib
    export OBJDUMP=${CROSS_COMPILE}objdump
    export STRIP=${CROSS_COMPILE}strip
    # export cross toolchain
    export CC=${CROSS_COMPILE}gcc
    export CXX=${CROSS_COMPILE}g++
    export AS=${CROSS_COMPILE}as
    export AR=${CROSS_COMPILE}ar
    export LD=${CROSS_COMPILE}ld
    export NM=${CROSS_COMPILE}nm
    export RANLIB=${CROSS_COMPILE}ranlib
    export OBJDUMP=${CROSS_COMPILE}objdump
    export STRIP=${CROSS_COMPILE}strip
    # export cross configure
    export CONFIG_CROSS=" --build=i686-pc-linux --host=arm-linux "
    # export cross configure
    export CONFIG_CROSS=" --build=i686-pc-linux --host=arm-linux "
    # Clear LDFLAGS and CFLAGS
    export LDFLAGS=
    export CFLAGS=
    # Clear LDFLAGS and CFLAGS
    export LDFLAGS=
    export CFLAGS=
}
function do_fetch()
{
    if [ -e ${INST_FILE} ] ; then
        pr_warn "$LIB_NAME compile and installed alredy"
        exit ;
    fi
    if [ -e ${INST_FILE} ] ; then
        pr_warn "$LIB_NAME compile and installed alredy"
        exit ;
    fi
    if [ -d $LIB_NAME ] ; then
        pr_warn "$LIB_NAME fetch already"
        return ;
    fi
    if [ -d $LIB_NAME ] ; then
        pr_warn "$LIB_NAME fetch already"
        return ;
    fi
    if [ ! -f ${LIB_NAME}.${PACK_SUFIX} ] ; then
        wget ${LIB_URL}/${LIB_NAME}.${PACK_SUFIX}
        check_result "ERROR: download ${LIB_NAME} failure"
    fi
    if [ ! -f ${LIB_NAME}.${PACK_SUFIX} ] ; then
        wget ${LIB_URL}/${LIB_NAME}.${PACK_SUFIX}
        check_result "ERROR: download ${LIB_NAME} failure"
    fi
    do_unpack ${LIB_NAME}.${PACK_SUFIX}
    do_unpack ${LIB_NAME}.${PACK_SUFIX}
}
function do_build()
{
    cd $LIB_NAME
    cd $LIB_NAME
    ./autogen.sh
    ./autogen.sh
    do_export
    do_export
    echo "ac_cv_func_malloc_0_nonnull=yes" > arm-linux.cache
    ./configure --prefix=${PREFIX_PATH} ${CONFIG_CROSS} --enable-static \
        --cache-file=arm-linux.cache --enable-tools
    check_result "ERROR: configure ${LIB_NAME} failure"
    echo "ac_cv_func_malloc_0_nonnull=yes" > arm-linux.cache
    ./configure --prefix=${PREFIX_PATH} ${CONFIG_CROSS} --enable-static \
        --cache-file=arm-linux.cache --enable-tools
    check_result "ERROR: configure ${LIB_NAME} failure"
    make -j ${JOBS} && make install
    check_result "ERROR: compile ${LIB_NAME} failure"
    make -j ${JOBS} && make install
    check_result "ERROR: compile ${LIB_NAME} failure"
}
function do_clean()
{
    rm -rf *${LIB_NAME}*
    rm -rf *${LIB_NAME}*
}
if [[ $# == 1 && $1 == -c ]] ;then
    pr_warn "start clean ${LIB_NAME}"
    do_clean
    exit;
    pr_warn "start clean ${LIB_NAME}"
    do_clean
    exit;
fi
do_fetch
libxml2/build.sh
@@ -40,140 +40,141 @@
#+-------------------------+
function pr_error() {
    echo -e "\033[40;31m $1 \033[0m"
    echo -e "\033[40;31m $1 \033[0m"
}
function pr_warn() {
    echo -e "\033[40;33m $1 \033[0m"
    echo -e "\033[40;33m $1 \033[0m"
}
function pr_info() {
    echo -e "\033[40;32m $1 \033[0m"
    echo -e "\033[40;32m $1 \033[0m"
}
function check_result()
{
    if [ $? != 0 ] ; then
        pr_error $1
    fi
    if [ $? != 0 ] ; then
        pr_error $1
    fi
}
# decompress a packet to destination path
function do_unpack()
{
    tarball=$1
    dstpath=`pwd`
    tarball=$1
    dstpath=`pwd`
    if [[ $# == 2 ]] ; then
        dstpath=$2
    fi
    if [[ $# == 2 ]] ; then
        dstpath=$2
    fi
    pr_info "decompress $tarball => $dstpath"
    pr_info "decompress $tarball => $dstpath"
    mkdir -p $dstpath
    case $tarball in
        *.tar.gz)
            tar -xzf $tarball -C $dstpath
            ;;
    mkdir -p $dstpath
    case $tarball in
        *.tar.gz)
            tar -xzf $tarball -C $dstpath
            ;;
        *.tar.bz2)
            tar -xjf $tarball -C $dstpath
            ;;
        *.tar.bz2)
            tar -xjf $tarball -C $dstpath
            ;;
        *.tar.xz)
            tar -xJf $tarball -C $dstpath
            ;;
        *.tar.xz)
            tar -xJf $tarball -C $dstpath
            ;;
        *.tar.zst)
            tar -I zstd -xf $tarball -C $dstpath
            ;;
        *.tar.zst)
            tar -I zstd -xf $tarball -C $dstpath
            ;;
        *.tar)
            tar -xf $tarball -C $dstpath
            ;;
        *.tar)
            tar -xf $tarball -C $dstpath
            ;;
        *.zip)
            unzip -qo $tarball -d $dstpath
            ;;
        *.zip)
            unzip -qo $tarball -d $dstpath
            ;;
        *)
            pr_error "decompress Unsupport packet: $tarball"
            return 1;
            ;;
    esac
        *)
            pr_error "decompress Unsupport packet: $tarball"
            return 1;
            ;;
    esac
}
function do_export()
{
    BUILD_ARCH=$(uname -m)
    if [[ $BUILD_ARCH =~ "arm" ]] ; then
        pr_warn "local($BUILD_ARCH) compile $LIB_NAME"
        return ;
    fi
    BUILD_ARCH=$(uname -m)
    if [[ $BUILD_ARCH =~ "arm" ]] ; then
        pr_warn "local($BUILD_ARCH) compile $LIB_NAME"
        return ;
    fi
    pr_warn "cross(${CROSS_COMPILE}) compile $LIB_NAME"
    pr_warn "cross(${CROSS_COMPILE}) compile $LIB_NAME"
    # export cross toolchain
    export CC=${CROSS_COMPILE}gcc
    export CXX=${CROSS_COMPILE}g++
    export AS=${CROSS_COMPILE}as
    export AR=${CROSS_COMPILE}ar
    export LD=${CROSS_COMPILE}ld
    export NM=${CROSS_COMPILE}nm
    export RANLIB=${CROSS_COMPILE}ranlib
    export OBJDUMP=${CROSS_COMPILE}objdump
    export STRIP=${CROSS_COMPILE}strip
    # export cross toolchain
    export CC=${CROSS_COMPILE}gcc
    export CXX=${CROSS_COMPILE}g++
    export AS=${CROSS_COMPILE}as
    export AR=${CROSS_COMPILE}ar
    export LD=${CROSS_COMPILE}ld
    export NM=${CROSS_COMPILE}nm
    export RANLIB=${CROSS_COMPILE}ranlib
    export OBJDUMP=${CROSS_COMPILE}objdump
    export STRIP=${CROSS_COMPILE}strip
    # export cross configure
    export CONFIG_CROSS=" --build=i686-pc-linux --host=arm-linux "
    # export cross configure
    export CONFIG_CROSS=" --build=i686-pc-linux --host=arm-linux "
    # Clear LDFLAGS and CFLAGS
    export LDFLAGS=
    export CFLAGS=
    # Clear LDFLAGS and CFLAGS
    export LDFLAGS=
    export CFLAGS=
}
function do_fetch()
{
    if [ -e ${INST_FILE} ] ; then
        pr_warn "$LIB_NAME compile and installed alredy"
        exit ;
    fi
    if [ -e ${INST_FILE} ] ; then
        pr_warn "$LIB_NAME compile and installed alredy"
        exit ;
    fi
    if [ -d $LIB_NAME ] ; then
        pr_warn "$LIB_NAME fetch already"
        return ;
    fi
    if [ -d $LIB_NAME ] ; then
        pr_warn "$LIB_NAME fetch already"
        return ;
    fi
    if [ ! -f ${LIB_NAME}.${PACK_SUFIX} ] ; then
        wget ${LIB_URL}/${LIB_NAME}.${PACK_SUFIX}
        check_result "ERROR: download ${LIB_NAME} failure"
    fi
    if [ ! -f ${LIB_NAME}.${PACK_SUFIX} ] ; then
        wget ${LIB_URL}/${LIB_NAME}.${PACK_SUFIX}
        check_result "ERROR: download ${LIB_NAME} failure"
    fi
    do_unpack ${LIB_NAME}.${PACK_SUFIX}
    do_unpack ${LIB_NAME}.${PACK_SUFIX}
}
function do_build()
{
    cd $LIB_NAME
    cd $LIB_NAME
    do_export
    do_export
    ./configure --prefix=${PREFIX_PATH} ${CONFIG_CROSS} --enable-static \
        --without-python --without-zlib --without-lzma
    check_result "ERROR: configure ${LIB_NAME} failure"
    ./configure --prefix=${PREFIX_PATH} ${CONFIG_CROSS} --enable-static \
        --without-python --without-zlib --without-lzma
    check_result "ERROR: configure ${LIB_NAME} failure"
    make && make install
    check_result "ERROR: compile ${LIB_NAME} failure"
    make -j ${JOBS} && make install
    check_result "ERROR: compile ${LIB_NAME} failure"
}
function do_clean()
{
    rm -rf *${LIB_NAME}*
    rm -rf *${LIB_NAME}*
}
if [[ $# == 1 && $1 == -c ]] ;then
    pr_warn "start clean ${LIB_NAME}"
    do_clean
    exit;
    pr_warn "start clean ${LIB_NAME}"
    do_clean
    exit;
fi
do_fetch
lrzsz/build.sh
@@ -40,142 +40,143 @@
#+-------------------------+
function pr_error() {
    echo -e "\033[40;31m $1 \033[0m"
    echo -e "\033[40;31m $1 \033[0m"
}
function pr_warn() {
    echo -e "\033[40;33m $1 \033[0m"
    echo -e "\033[40;33m $1 \033[0m"
}
function pr_info() {
    echo -e "\033[40;32m $1 \033[0m"
    echo -e "\033[40;32m $1 \033[0m"
}
function check_result()
{
    if [ $? != 0 ] ; then
        pr_error $1
    fi
    if [ $? != 0 ] ; then
        pr_error $1
    fi
}
# decompress a packet to destination path
function do_unpack()
{
    tarball=$1
    dstpath=`pwd`
    tarball=$1
    dstpath=`pwd`
    if [[ $# == 2 ]] ; then
        dstpath=$2
    fi
    if [[ $# == 2 ]] ; then
        dstpath=$2
    fi
    pr_info "decompress $tarball => $dstpath"
    pr_info "decompress $tarball => $dstpath"
    mkdir -p $dstpath
    case $tarball in
        *.tar.gz)
            tar -xzf $tarball -C $dstpath
            ;;
    mkdir -p $dstpath
    case $tarball in
        *.tar.gz)
            tar -xzf $tarball -C $dstpath
            ;;
        *.tar.bz2)
            tar -xjf $tarball -C $dstpath
            ;;
        *.tar.bz2)
            tar -xjf $tarball -C $dstpath
            ;;
        *.tar.xz)
            tar -xJf $tarball -C $dstpath
            ;;
        *.tar.xz)
            tar -xJf $tarball -C $dstpath
            ;;
        *.tar.zst)
            tar -I zstd -xf $tarball -C $dstpath
            ;;
        *.tar.zst)
            tar -I zstd -xf $tarball -C $dstpath
            ;;
        *.tar)
            tar -xf $tarball -C $dstpath
            ;;
        *.tar)
            tar -xf $tarball -C $dstpath
            ;;
        *.zip)
            unzip -qo $tarball -d $dstpath
            ;;
        *.zip)
            unzip -qo $tarball -d $dstpath
            ;;
        *)
            pr_error "decompress Unsupport packet: $tarball"
            return 1;
            ;;
    esac
        *)
            pr_error "decompress Unsupport packet: $tarball"
            return 1;
            ;;
    esac
}
function do_export()
{
    BUILD_ARCH=$(uname -m)
    if [[ $BUILD_ARCH =~ "arm" ]] ; then
        pr_warn "local($BUILD_ARCH) compile $LIB_NAME"
        return ;
    fi
    BUILD_ARCH=$(uname -m)
    if [[ $BUILD_ARCH =~ "arm" ]] ; then
        pr_warn "local($BUILD_ARCH) compile $LIB_NAME"
        return ;
    fi
    pr_warn "cross(${CROSS_COMPILE}) compile $LIB_NAME"
    pr_warn "cross(${CROSS_COMPILE}) compile $LIB_NAME"
    # export cross toolchain
    export CC=${CROSS_COMPILE}gcc
    export CXX=${CROSS_COMPILE}g++
    export AS=${CROSS_COMPILE}as
    export AR=${CROSS_COMPILE}ar
    export LD=${CROSS_COMPILE}ld
    export NM=${CROSS_COMPILE}nm
    export RANLIB=${CROSS_COMPILE}ranlib
    export OBJDUMP=${CROSS_COMPILE}objdump
    export STRIP=${CROSS_COMPILE}strip
    # export cross toolchain
    export CC=${CROSS_COMPILE}gcc
    export CXX=${CROSS_COMPILE}g++
    export AS=${CROSS_COMPILE}as
    export AR=${CROSS_COMPILE}ar
    export LD=${CROSS_COMPILE}ld
    export NM=${CROSS_COMPILE}nm
    export RANLIB=${CROSS_COMPILE}ranlib
    export OBJDUMP=${CROSS_COMPILE}objdump
    export STRIP=${CROSS_COMPILE}strip
    # export cross configure
    export CONFIG_CROSS=" --build=i686-pc-linux --host=arm-linux "
    # export cross configure
    export CONFIG_CROSS=" --build=i686-pc-linux --host=arm-linux "
    # Clear LDFLAGS and CFLAGS
    export LDFLAGS=
    export CFLAGS=
    # Clear LDFLAGS and CFLAGS
    export LDFLAGS=
    export CFLAGS=
}
function do_fetch()
{
    if [ -e ${INST_FILE} ] ; then
        pr_warn "$LIB_NAME compile and installed alredy"
        exit ;
    fi
    if [ -e ${INST_FILE} ] ; then
        pr_warn "$LIB_NAME compile and installed alredy"
        exit ;
    fi
    if [ -d $LIB_NAME ] ; then
        pr_warn "$LIB_NAME fetch already"
        return ;
    fi
    if [ -d $LIB_NAME ] ; then
        pr_warn "$LIB_NAME fetch already"
        return ;
    fi
    if [ ! -f ${LIB_NAME}.${PACK_SUFIX} ] ; then
        wget ${LIB_URL}/${LIB_NAME}.${PACK_SUFIX}
        check_result "ERROR: download ${LIB_NAME} failure"
    fi
    if [ ! -f ${LIB_NAME}.${PACK_SUFIX} ] ; then
        wget ${LIB_URL}/${LIB_NAME}.${PACK_SUFIX}
        check_result "ERROR: download ${LIB_NAME} failure"
    fi
    do_unpack ${LIB_NAME}.${PACK_SUFIX}
    do_unpack ${LIB_NAME}.${PACK_SUFIX}
}
function do_build()
{
    cd $LIB_NAME
    cd $LIB_NAME
    do_export
    do_export
    ./configure --prefix=${PREFIX_PATH} ${CONFIG_CROSS}
    check_result "ERROR: configure ${LIB_NAME} failure"
    ./configure --prefix=${PREFIX_PATH} ${CONFIG_CROSS}
    check_result "ERROR: configure ${LIB_NAME} failure"
    make
    check_result "ERROR: compile ${LIB_NAME} failure"
    make -j ${JOBS}
    check_result "ERROR: compile ${LIB_NAME} failure"
    cp src/lsz ${BIN_PATH}/sz
    cp src/lrz ${BIN_PATH}/rz
    mkdir -p $BIN_PATH
    install -m 755 -D src/lsz ${BIN_PATH}/sz
    install -m 755 -D src/lrz ${BIN_PATH}/rz
}
function do_clean()
{
    rm -rf *${LIB_NAME}*
    rm -rf *${LIB_NAME}*
}
if [[ $# == 1 && $1 == -c ]] ;then
    pr_warn "start clean ${LIB_NAME}"
    do_clean
    exit;
    pr_warn "start clean ${LIB_NAME}"
    do_clean
    exit;
fi
do_fetch
lvgl/build.sh
@@ -30,6 +30,9 @@
# download taballs path
TARBALL_PATH=$PRJ_PATH/tarballs
# check installed or not file
INST_FILE=$PREFIX_PATH/bin/lvglsim
# shell script will exit once get command error
set -e
@@ -66,6 +69,11 @@
function do_fetch()
{
    if [ -e ${INST_FILE} ] ; then
        pr_warn "$LIB_NAME compiled already, exit..."
        exit;
    fi
    if [ -d $LIB_NAME/lvgl ] ; then
        pr_warn "$LIB_NAME source code fetched already"
        return 0;
@@ -115,7 +123,7 @@
    if [ ! -f "$BUILD_DIR/CMakeCache.txt" ]; then
        pr_info "configuring cmake..."
        cmake -B "$BUILD_DIR" -S . -DCMAKE_TOOLCHAIN_FILE=./user_cross_compile_setup.cmake
        cmake -B "$BUILD_DIR" -S . -DCMAKE_TOOLCHAIN_FILE=./user_cross_compile_setup.cmake -DCMAKE_INSTALL_PREFIX=${PREFIX_PATH}
    else
        pr_warn "cmake already configured"
    fi
@@ -123,6 +131,9 @@
    pr_info "building..."
    cmake --build "$BUILD_DIR" -j$(nproc)
    cmake --install build
    install -m 755 -D build/bin/lvglsim $PREFIX_PATH/bin/lvglsim
    cd "$PRJ_PATH" || exit 1
}
@@ -147,11 +158,6 @@
    exit;
fi
if [ -e $LIB_NAME/build/bin/lvglsim  ] ; then
    pr_warn "$LIB_NAME compiled already, exit..."
    exit;
fi
do_depends
do_fetch
@@ -161,3 +167,4 @@
do_patch
do_build
mosquitto/build.sh
@@ -40,148 +40,164 @@
#+-------------------------+
function pr_error() {
    echo -e "\033[40;31m $1 \033[0m"
    echo -e "\033[40;31m $1 \033[0m"
}
function pr_warn() {
    echo -e "\033[40;33m $1 \033[0m"
    echo -e "\033[40;33m $1 \033[0m"
}
function pr_info() {
    echo -e "\033[40;32m $1 \033[0m"
    echo -e "\033[40;32m $1 \033[0m"
}
function check_result()
{
    if [ $? != 0 ] ; then
        pr_error $1
    fi
    if [ $? != 0 ] ; then
        pr_error $1
    fi
}
# decompress a packet to destination path
function do_unpack()
{
    tarball=$1
    dstpath=`pwd`
    tarball=$1
    dstpath=`pwd`
    if [[ $# == 2 ]] ; then
        dstpath=$2
    fi
    if [[ $# == 2 ]] ; then
        dstpath=$2
    fi
    pr_info "decompress $tarball => $dstpath"
    pr_info "decompress $tarball => $dstpath"
    mkdir -p $dstpath
    case $tarball in
        *.tar.gz)
            tar -xzf $tarball -C $dstpath
            ;;
    mkdir -p $dstpath
    case $tarball in
        *.tar.gz)
            tar -xzf $tarball -C $dstpath
            ;;
        *.tar.bz2)
            tar -xjf $tarball -C $dstpath
            ;;
        *.tar.bz2)
            tar -xjf $tarball -C $dstpath
            ;;
        *.tar.xz)
            tar -xJf $tarball -C $dstpath
            ;;
        *.tar.xz)
            tar -xJf $tarball -C $dstpath
            ;;
        *.tar.zst)
            tar -I zstd -xf $tarball -C $dstpath
            ;;
        *.tar.zst)
            tar -I zstd -xf $tarball -C $dstpath
            ;;
        *.tar)
            tar -xf $tarball -C $dstpath
            ;;
        *.tar)
            tar -xf $tarball -C $dstpath
            ;;
        *.zip)
            unzip -qo $tarball -d $dstpath
            ;;
        *.zip)
            unzip -qo $tarball -d $dstpath
            ;;
        *)
            pr_error "decompress Unsupport packet: $tarball"
            return 1;
            ;;
    esac
        *)
            pr_error "decompress Unsupport packet: $tarball"
            return 1;
            ;;
    esac
}
function do_export()
{
    BUILD_ARCH=$(uname -m)
    if [[ $BUILD_ARCH =~ "arm" ]] ; then
        pr_warn "local($BUILD_ARCH) compile $LIB_NAME"
        return ;
    fi
    BUILD_ARCH=$(uname -m)
    if [[ $BUILD_ARCH =~ "arm" ]] ; then
        pr_warn "local($BUILD_ARCH) compile $LIB_NAME"
        return ;
    fi
    pr_warn "cross(${CROSS_COMPILE}) compile $LIB_NAME"
    pr_warn "cross(${CROSS_COMPILE}) compile $LIB_NAME"
    # export cross toolchain
    export CC=${CROSS_COMPILE}gcc
    export CXX=${CROSS_COMPILE}g++
    export AS=${CROSS_COMPILE}as
    export AR=${CROSS_COMPILE}ar
    export LD=${CROSS_COMPILE}ld
    export NM=${CROSS_COMPILE}nm
    export RANLIB=${CROSS_COMPILE}ranlib
    export OBJDUMP=${CROSS_COMPILE}objdump
    export STRIP=${CROSS_COMPILE}strip
    # export cross toolchain
    export CC=${CROSS_COMPILE}gcc
    export CXX=${CROSS_COMPILE}g++
    export AS=${CROSS_COMPILE}as
    export AR=${CROSS_COMPILE}ar
    export LD=${CROSS_COMPILE}ld
    export NM=${CROSS_COMPILE}nm
    export RANLIB=${CROSS_COMPILE}ranlib
    export OBJDUMP=${CROSS_COMPILE}objdump
    export STRIP=${CROSS_COMPILE}strip
    # export cross configure
    export CONFIG_CROSS=" --build=i686-pc-linux --host=arm-linux "
    # export cross configure
    export CONFIG_CROSS=" --build=i686-pc-linux --host=arm-linux "
    # Clear LDFLAGS and CFLAGS
    export LDFLAGS=
    export CFLAGS=
    # Clear LDFLAGS and CFLAGS
    export LDFLAGS=
    export CFLAGS=
}
function do_fetch()
{
    if [ -e ${INST_FILE} ] ; then
        pr_warn "$LIB_NAME compile and installed alredy"
        exit ;
    fi
    if [ -e ${INST_FILE} ] ; then
        pr_warn "$LIB_NAME compile and installed alredy"
        exit ;
    fi
    if [ -d $LIB_NAME ] ; then
        pr_warn "$LIB_NAME fetch already"
        return ;
    fi
    if [ -d $LIB_NAME ] ; then
        pr_warn "$LIB_NAME fetch already"
        return ;
    fi
    if [ ! -f ${LIB_NAME}.${PACK_SUFIX} ] ; then
        wget ${LIB_URL}/${LIB_NAME}.${PACK_SUFIX}
        check_result "ERROR: download ${LIB_NAME} failure"
    fi
    if [ ! -f ${LIB_NAME}.${PACK_SUFIX} ] ; then
        wget ${LIB_URL}/${LIB_NAME}.${PACK_SUFIX}
        check_result "ERROR: download ${LIB_NAME} failure"
    fi
    do_unpack ${LIB_NAME}.${PACK_SUFIX}
    do_unpack ${LIB_NAME}.${PACK_SUFIX}
}
function do_build()
{
    cd $LIB_NAME
    cd $LIB_NAME
    do_export
    do_export
    export CFLAGS=-I${PREFIX_PATH}/include
    export LDFLAGS="-L${PREFIX_PATH}/lib -lcrypto -lssl -ldl -lpthread"
    export DESTDIR=${PREFIX_PATH}
    export CFLAGS=-I${PREFIX_PATH}/include
    export LDFLAGS="-L${PREFIX_PATH}/lib -lcrypto -lssl -ldl -lpthread"
    export DESTDIR=${PREFIX_PATH}
    make WITH_UUID=no WITH_STATIC_LIBRARIES=yes
    check_result "ERROR: compile ${LIB_NAME} failure"
    make -j ${JOBS} WITH_UUID=no WITH_STATIC_LIBRARIES=yes
    check_result "ERROR: compile ${LIB_NAME} failure"
    make DESTDIR=${PREFIX_PATH} prefix=/ install
    check_result "ERROR: compile ${LIB_NAME} failure"
    make -j ${JOBS} DESTDIR=${PREFIX_PATH} prefix=/ install
    check_result "ERROR: compile ${LIB_NAME} failure"
    install -m 755 src/mosquitto $BIN_PATH
    install -m 644 lib/libmosquitto.a $LIB_PATH
    install -m 755 -D src/mosquitto $BIN_PATH/mosquitto
    install -m 644 -D lib/libmosquitto.a $LIB_PATH/libmosquitto.a
}
function do_depend()
{
    cd $TOP_PATH/openssl || exit 1
    pr_info "build depend openssl..."
    ./build.sh
    cd $TOP_PATH/cjson || exit 1
    pr_info "build depend cjson..."
    ./build.sh
    cd $PRJ_PATH || exit 1
}
function do_clean()
{
    rm -rf *${LIB_NAME}*
    rm -rf *${LIB_NAME}*
}
if [[ $# == 1 && $1 == -c ]] ;then
    pr_warn "start clean ${LIB_NAME}"
    do_clean
    exit;
    pr_warn "start clean ${LIB_NAME}"
    do_clean
    exit;
fi
do_depend
do_fetch
do_build
opencv/build.sh
@@ -30,7 +30,7 @@
INC_PATH=$PREFIX_PATH/include
# check installed or not file
INST_FILE=$PREFIX_PATH/lib/opencv
INST_FILE=$PREFIX_PATH/lib/libopencv_core.so
# shell script will exit once get command error
set -e
@@ -40,158 +40,158 @@
#+-------------------------+
function pr_error() {
    echo -e "\033[40;31m $1 \033[0m"
    echo -e "\033[40;31m $1 \033[0m"
}
function pr_warn() {
    echo -e "\033[40;33m $1 \033[0m"
    echo -e "\033[40;33m $1 \033[0m"
}
function pr_info() {
    echo -e "\033[40;32m $1 \033[0m"
    echo -e "\033[40;32m $1 \033[0m"
}
function check_result()
{
    if [ $? != 0 ] ; then
        pr_error $1
    fi
    if [ $? != 0 ] ; then
        pr_error $1
    fi
}
# decompress a packet to destination path
function do_unpack()
{
    tarball=$1
    dstpath=`pwd`
    tarball=$1
    dstpath=`pwd`
    if [[ $# == 2 ]] ; then
        dstpath=$2
    fi
    if [[ $# == 2 ]] ; then
        dstpath=$2
    fi
    pr_info "decompress $tarball => $dstpath"
    pr_info "decompress $tarball => $dstpath"
    mkdir -p $dstpath
    case $tarball in
        *.tar.gz)
            tar -xzf $tarball -C $dstpath
            ;;
    mkdir -p $dstpath
    case $tarball in
        *.tar.gz)
            tar -xzf $tarball -C $dstpath
            ;;
        *.tar.bz2)
            tar -xjf $tarball -C $dstpath
            ;;
        *.tar.bz2)
            tar -xjf $tarball -C $dstpath
            ;;
        *.tar.xz)
            tar -xJf $tarball -C $dstpath
            ;;
        *.tar.xz)
            tar -xJf $tarball -C $dstpath
            ;;
        *.tar.zst)
            tar -I zstd -xf $tarball -C $dstpath
            ;;
        *.tar.zst)
            tar -I zstd -xf $tarball -C $dstpath
            ;;
        *.tar)
            tar -xf $tarball -C $dstpath
            ;;
        *.tar)
            tar -xf $tarball -C $dstpath
            ;;
        *.zip)
            unzip -qo $tarball -d $dstpath
            ;;
        *.zip)
            unzip -qo $tarball -d $dstpath
            ;;
        *)
            pr_error "decompress Unsupport packet: $tarball"
            return 1;
            ;;
    esac
        *)
            pr_error "decompress Unsupport packet: $tarball"
            return 1;
            ;;
    esac
}
function do_export()
{
    BUILD_ARCH=$(uname -m)
    if [[ $BUILD_ARCH =~ "arm" ]] ; then
        pr_error "ERROR: local($BUILD_ARCH) compile $LIB_NAME not support for it's too slow"
        exit 0;
    fi
    BUILD_ARCH=$(uname -m)
    if [[ $BUILD_ARCH =~ "arm" ]] ; then
        pr_error "ERROR: local($BUILD_ARCH) compile $LIB_NAME not support for it's too slow"
        exit 0;
    fi
    pr_warn "cross(${CROSS_COMPILE}) compile $LIB_NAME"
    pr_warn "cross(${CROSS_COMPILE}) compile $LIB_NAME"
    # export cross toolchain
    export CC=${CROSS_COMPILE}gcc
    export CXX=${CROSS_COMPILE}g++
    export AS=${CROSS_COMPILE}as
    export AR=${CROSS_COMPILE}ar
    export LD=${CROSS_COMPILE}ld
    export NM=${CROSS_COMPILE}nm
    export RANLIB=${CROSS_COMPILE}ranlib
    export OBJDUMP=${CROSS_COMPILE}objdump
    export STRIP=${CROSS_COMPILE}strip
    # export cross toolchain
    export CC=${CROSS_COMPILE}gcc
    export CXX=${CROSS_COMPILE}g++
    export AS=${CROSS_COMPILE}as
    export AR=${CROSS_COMPILE}ar
    export LD=${CROSS_COMPILE}ld
    export NM=${CROSS_COMPILE}nm
    export RANLIB=${CROSS_COMPILE}ranlib
    export OBJDUMP=${CROSS_COMPILE}objdump
    export STRIP=${CROSS_COMPILE}strip
    # export cross configure
    export CONFIG_CROSS=" --build=i686-pc-linux --host=arm-linux "
    # export cross configure
    export CONFIG_CROSS=" --build=i686-pc-linux --host=arm-linux "
    # Clear LDFLAGS and CFLAGS
    export LDFLAGS=
    export CFLAGS=
    # Clear LDFLAGS and CFLAGS
    export LDFLAGS=
    export CFLAGS=
}
function do_fetch()
{
    if [ -e ${INST_FILE} ] ; then
        pr_warn "$LIB_NAME compile and installed alredy"
        exit ;
    fi
    if [ -e ${INST_FILE} ] ; then
        pr_warn "$LIB_NAME compile and installed alredy"
        exit ;
    fi
    if [ -d $LIB_NAME ] ; then
        pr_warn "$LIB_NAME fetch already"
        return ;
    fi
    if [ -d $LIB_NAME ] ; then
        pr_warn "$LIB_NAME fetch already"
        return ;
    fi
    if [ ! -f ${LIB_NAME}.${PACK_SUFIX} ] ; then
        wget ${LIB_URL}/${LIB_NAME}.${PACK_SUFIX}
        check_result "ERROR: download ${LIB_NAME} failure"
    fi
    if [ ! -f ${LIB_NAME}.${PACK_SUFIX} ] ; then
        wget ${LIB_URL}/${LIB_NAME}.${PACK_SUFIX}
        check_result "ERROR: download ${LIB_NAME} failure"
    fi
    do_unpack ${LIB_NAME}.${PACK_SUFIX}
    do_unpack ${LIB_NAME}.${PACK_SUFIX}
}
function do_build()
{
    cd $LIB_NAME
    cd $LIB_NAME
    do_export
    do_export
    TOOLCHAIN=armlinux.toolchain.cmake
    rm -f platforms/linux/${TOOLCHAIN}
    TOOLCHAIN=armlinux.toolchain.cmake
    rm -f platforms/linux/${TOOLCHAIN}
    cat >platforms/linux/${TOOLCHAIN} <<EOF
    cat >platforms/linux/${TOOLCHAIN} <<EOF
set(GCC_COMPILER_VERSION "" CACHE STRING "GCC Compiler version")
set(GNU_MACHINE "${CROSS_COMPILE%*-}" CACHE STRING "GNU compiler triple")
include("\${CMAKE_CURRENT_LIST_DIR}/arm.toolchain.cmake")
EOF
    mkdir -p build && cd build
    mkdir -p build && cd build
    cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$PREFIX_PATH \
        -DCMAKE_TOOLCHAIN_FILE="../platforms/linux/${TOOLCHAIN}" -DSOFTFP=ON -DENABLE_PROFILING=OFF \
        -DWITH_OPENCL=OFF -DWITH_TBB=ON  -DWITH_V4L=ON -DHAVE_CAMV4L2=ON -DBUILD_TESTS=OFF \
        -DINSTALL_PYTHON_EXAMPLES=OFF -DBUILD_EXAMPLES=OFF -DWITH_FFMPEG=OFF -DHAVE_FFMPEG=OFF \
        -DBUILD_opencv_js=OFF ../
    cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$PREFIX_PATH \
        -DCMAKE_TOOLCHAIN_FILE="../platforms/linux/${TOOLCHAIN}" -DSOFTFP=ON -DENABLE_PROFILING=OFF \
        -DWITH_OPENCL=OFF -DWITH_TBB=ON  -DWITH_V4L=ON -DHAVE_CAMV4L2=ON -DBUILD_TESTS=OFF \
        -DINSTALL_PYTHON_EXAMPLES=OFF -DBUILD_EXAMPLES=OFF -DWITH_FFMPEG=OFF -DHAVE_FFMPEG=OFF \
        -DBUILD_opencv_js=OFF ../
    make -j ${JOBS} && make install
    check_result "ERROR: compile ${LIB_NAME} failure"
    make -j ${JOBS} && make install
    check_result "ERROR: compile ${LIB_NAME} failure"
}
function do_clean()
{
    rm -rf *${LIB_NAME}*
    rm -rf *${LIB_NAME}*
}
if [[ $# == 1 && $1 == -c ]] ;then
    pr_warn "start clean ${LIB_NAME}"
    do_clean
    exit;
    pr_warn "start clean ${LIB_NAME}"
    do_clean
    exit;
fi
do_fetch
do_build
openssl/build.sh
@@ -40,140 +40,141 @@
#+-------------------------+
function pr_error() {
    echo -e "\033[40;31m $1 \033[0m"
    echo -e "\033[40;31m $1 \033[0m"
}
function pr_warn() {
    echo -e "\033[40;33m $1 \033[0m"
    echo -e "\033[40;33m $1 \033[0m"
}
function pr_info() {
    echo -e "\033[40;32m $1 \033[0m"
    echo -e "\033[40;32m $1 \033[0m"
}
function check_result()
{
    if [ $? != 0 ] ; then
        pr_error $1
    fi
    if [ $? != 0 ] ; then
        pr_error $1
    fi
}
# decompress a packet to destination path
function do_unpack()
{
    tarball=$1
    dstpath=`pwd`
    tarball=$1
    dstpath=`pwd`
    if [[ $# == 2 ]] ; then
        dstpath=$2
    fi
    if [[ $# == 2 ]] ; then
        dstpath=$2
    fi
    pr_info "decompress $tarball => $dstpath"
    pr_info "decompress $tarball => $dstpath"
    mkdir -p $dstpath
    case $tarball in
        *.tar.gz)
            tar -xzf $tarball -C $dstpath
            ;;
    mkdir -p $dstpath
    case $tarball in
        *.tar.gz)
            tar -xzf $tarball -C $dstpath
            ;;
        *.tar.bz2)
            tar -xjf $tarball -C $dstpath
            ;;
        *.tar.bz2)
            tar -xjf $tarball -C $dstpath
            ;;
        *.tar.xz)
            tar -xJf $tarball -C $dstpath
            ;;
        *.tar.xz)
            tar -xJf $tarball -C $dstpath
            ;;
        *.tar.zst)
            tar -I zstd -xf $tarball -C $dstpath
            ;;
        *.tar.zst)
            tar -I zstd -xf $tarball -C $dstpath
            ;;
        *.tar)
            tar -xf $tarball -C $dstpath
            ;;
        *.tar)
            tar -xf $tarball -C $dstpath
            ;;
        *.zip)
            unzip -qo $tarball -d $dstpath
            ;;
        *.zip)
            unzip -qo $tarball -d $dstpath
            ;;
        *)
            pr_error "decompress Unsupport packet: $tarball"
            return 1;
            ;;
    esac
        *)
            pr_error "decompress Unsupport packet: $tarball"
            return 1;
            ;;
    esac
}
function do_export()
{
    BUILD_ARCH=$(uname -m)
    if [[ $BUILD_ARCH =~ "arm" ]] ; then
        pr_warn "local($BUILD_ARCH) compile $LIB_NAME"
        return ;
    fi
    BUILD_ARCH=$(uname -m)
    if [[ $BUILD_ARCH =~ "arm" ]] ; then
        pr_warn "local($BUILD_ARCH) compile $LIB_NAME"
        return ;
    fi
    pr_warn "cross(${CROSS_COMPILE}) compile $LIB_NAME"
    pr_warn "cross(${CROSS_COMPILE}) compile $LIB_NAME"
    # export cross toolchain
    export CC=${CROSS_COMPILE}gcc
    export CXX=${CROSS_COMPILE}g++
    export AS=${CROSS_COMPILE}as
    export AR=${CROSS_COMPILE}ar
    export LD=${CROSS_COMPILE}ld
    export NM=${CROSS_COMPILE}nm
    export RANLIB=${CROSS_COMPILE}ranlib
    export OBJDUMP=${CROSS_COMPILE}objdump
    export STRIP=${CROSS_COMPILE}strip
    # export cross toolchain
    export CC=${CROSS_COMPILE}gcc
    export CXX=${CROSS_COMPILE}g++
    export AS=${CROSS_COMPILE}as
    export AR=${CROSS_COMPILE}ar
    export LD=${CROSS_COMPILE}ld
    export NM=${CROSS_COMPILE}nm
    export RANLIB=${CROSS_COMPILE}ranlib
    export OBJDUMP=${CROSS_COMPILE}objdump
    export STRIP=${CROSS_COMPILE}strip
    # export cross configure
    export CONFIG_CROSS=" --build=i686-pc-linux --host=arm-linux "
    # export cross configure
    export CONFIG_CROSS=" --build=i686-pc-linux --host=arm-linux "
    # Clear LDFLAGS and CFLAGS
    export LDFLAGS=
    export CFLAGS=
    # Clear LDFLAGS and CFLAGS
    export LDFLAGS=
    export CFLAGS=
}
function do_fetch()
{
    if [ -e ${INST_FILE} ] ; then
        pr_warn "$LIB_NAME compile and installed alredy"
        exit ;
    fi
    if [ -e ${INST_FILE} ] ; then
        pr_warn "$LIB_NAME compile and installed alredy"
        exit ;
    fi
    if [ -d $LIB_NAME ] ; then
        pr_warn "$LIB_NAME fetch already"
        return ;
    fi
    if [ -d $LIB_NAME ] ; then
        pr_warn "$LIB_NAME fetch already"
        return ;
    fi
    if [ ! -f ${LIB_NAME}.${PACK_SUFIX} ] ; then
        wget ${LIB_URL}/${LIB_NAME}.${PACK_SUFIX}
        check_result "ERROR: download ${LIB_NAME} failure"
    fi
    if [ ! -f ${LIB_NAME}.${PACK_SUFIX} ] ; then
        wget ${LIB_URL}/${LIB_NAME}.${PACK_SUFIX}
        check_result "ERROR: download ${LIB_NAME} failure"
    fi
    do_unpack ${LIB_NAME}.${PACK_SUFIX}
    do_unpack ${LIB_NAME}.${PACK_SUFIX}
}
function do_build()
{
    cd $LIB_NAME
    cd $LIB_NAME
    do_export
    do_export
    CROSS_COMPILE=${CROSSTOOL} ./Configure linux-armv4 \
        threads -shared -no-zlib --prefix=$PREFIX_PATH --openssldir=$PREFIX_PATH
    check_result "ERROR: configure ${LIB_NAME} failure"
    CROSS_COMPILE=${CROSSTOOL} ./Configure linux-armv4 \
        threads -shared -no-zlib --prefix=$PREFIX_PATH --openssldir=$PREFIX_PATH
    check_result "ERROR: configure ${LIB_NAME} failure"
    make -j ${JOBS} && make install
    check_result "ERROR: compile ${LIB_NAME} failure"
    make -j ${JOBS} && make install
    check_result "ERROR: compile ${LIB_NAME} failure"
}
function do_clean()
{
    rm -rf *${LIB_NAME}*
    rm -rf *${LIB_NAME}*
}
if [[ $# == 1 && $1 == -c ]] ;then
    pr_warn "start clean ${LIB_NAME}"
    do_clean
    exit;
    pr_warn "start clean ${LIB_NAME}"
    do_clean
    exit;
fi
do_fetch
pppd/build.sh
@@ -40,153 +40,165 @@
#+-------------------------+
function pr_error() {
    echo -e "\033[40;31m $1 \033[0m"
    echo -e "\033[40;31m $1 \033[0m"
}
function pr_warn() {
    echo -e "\033[40;33m $1 \033[0m"
    echo -e "\033[40;33m $1 \033[0m"
}
function pr_info() {
    echo -e "\033[40;32m $1 \033[0m"
    echo -e "\033[40;32m $1 \033[0m"
}
function check_result()
{
    if [ $? != 0 ] ; then
        pr_error $1
    fi
    if [ $? != 0 ] ; then
        pr_error $1
    fi
}
# decompress a packet to destination path
function do_unpack()
{
    tarball=$1
    dstpath=`pwd`
    tarball=$1
    dstpath=`pwd`
    if [[ $# == 2 ]] ; then
        dstpath=$2
    fi
    if [[ $# == 2 ]] ; then
        dstpath=$2
    fi
    pr_info "decompress $tarball => $dstpath"
    pr_info "decompress $tarball => $dstpath"
    mkdir -p $dstpath
    case $tarball in
        *.tar.gz)
            tar -xzf $tarball -C $dstpath
            ;;
    mkdir -p $dstpath
    case $tarball in
        *.tar.gz)
            tar -xzf $tarball -C $dstpath
            ;;
        *.tar.bz2)
            tar -xjf $tarball -C $dstpath
            ;;
        *.tar.bz2)
            tar -xjf $tarball -C $dstpath
            ;;
        *.tar.xz)
            tar -xJf $tarball -C $dstpath
            ;;
        *.tar.xz)
            tar -xJf $tarball -C $dstpath
            ;;
        *.tar.zst)
            tar -I zstd -xf $tarball -C $dstpath
            ;;
        *.tar.zst)
            tar -I zstd -xf $tarball -C $dstpath
            ;;
        *.tar)
            tar -xf $tarball -C $dstpath
            ;;
        *.tar)
            tar -xf $tarball -C $dstpath
            ;;
        *.zip)
            unzip -qo $tarball -d $dstpath
            ;;
        *.zip)
            unzip -qo $tarball -d $dstpath
            ;;
        *)
            pr_error "decompress Unsupport packet: $tarball"
            return 1;
            ;;
    esac
        *)
            pr_error "decompress Unsupport packet: $tarball"
            return 1;
            ;;
    esac
}
function do_export()
{
    BUILD_ARCH=$(uname -m)
    if [[ $BUILD_ARCH =~ "arm" ]] ; then
        pr_warn "local($BUILD_ARCH) compile $LIB_NAME"
        return ;
    fi
    BUILD_ARCH=$(uname -m)
    if [[ $BUILD_ARCH =~ "arm" ]] ; then
        pr_warn "local($BUILD_ARCH) compile $LIB_NAME"
        return ;
    fi
    pr_warn "cross(${CROSS_COMPILE}) compile $LIB_NAME"
    pr_warn "cross(${CROSS_COMPILE}) compile $LIB_NAME"
    # export cross toolchain
    export CC=${CROSS_COMPILE}gcc
    export CXX=${CROSS_COMPILE}g++
    export AS=${CROSS_COMPILE}as
    export AR=${CROSS_COMPILE}ar
    export LD=${CROSS_COMPILE}ld
    export NM=${CROSS_COMPILE}nm
    export RANLIB=${CROSS_COMPILE}ranlib
    export OBJDUMP=${CROSS_COMPILE}objdump
    export STRIP=${CROSS_COMPILE}strip
    # export cross toolchain
    export CC=${CROSS_COMPILE}gcc
    export CXX=${CROSS_COMPILE}g++
    export AS=${CROSS_COMPILE}as
    export AR=${CROSS_COMPILE}ar
    export LD=${CROSS_COMPILE}ld
    export NM=${CROSS_COMPILE}nm
    export RANLIB=${CROSS_COMPILE}ranlib
    export OBJDUMP=${CROSS_COMPILE}objdump
    export STRIP=${CROSS_COMPILE}strip
    # export cross configure
    export CONFIG_CROSS=" --build=i686-pc-linux --host=arm-linux "
    # export cross configure
    export CONFIG_CROSS=" --build=i686-pc-linux --host=arm-linux "
    # Clear LDFLAGS and CFLAGS
    export LDFLAGS=
    export CFLAGS=
    # Clear LDFLAGS and CFLAGS
    export LDFLAGS=
    export CFLAGS=
}
function do_fetch()
{
    if [ -e ${INST_FILE} ] ; then
        pr_warn "$LIB_NAME compile and installed alredy"
        exit ;
    fi
    if [ -e ${INST_FILE} ] ; then
        pr_warn "$LIB_NAME compile and installed alredy"
        exit ;
    fi
    if [ -d $LIB_NAME ] ; then
        pr_warn "$LIB_NAME fetch already"
        return ;
    fi
    if [ -d $LIB_NAME ] ; then
        pr_warn "$LIB_NAME fetch already"
        return ;
    fi
    if [ ! -f ${LIB_NAME}.${PACK_SUFIX} ] ; then
        wget ${LIB_URL}/${LIB_NAME}.${PACK_SUFIX}
        check_result "ERROR: download ${LIB_NAME} failure"
    fi
    if [ ! -f ${LIB_NAME}.${PACK_SUFIX} ] ; then
        wget ${LIB_URL}/${LIB_NAME}.${PACK_SUFIX}
        check_result "ERROR: download ${LIB_NAME} failure"
    fi
    do_unpack ${LIB_NAME}.${PACK_SUFIX}
    do_unpack ${LIB_NAME}.${PACK_SUFIX}
}
function do_build()
{
    cd $LIB_NAME
    cd $LIB_NAME
    if [ ! -e configure ] ; then
        ./autogen.sh
    fi
    if [ ! -e configure ] ; then
        ./autogen.sh
    fi
    do_export
    do_export
    ./configure --prefix=${PREFIX_PATH} ${CONFIG_CROSS} \
        --disable-plugins --disable-eaptls --disable-peap \
        --with-openssl=${PREFIX_PATH}
    ./configure --prefix=${PREFIX_PATH} ${CONFIG_CROSS} \
        --disable-plugins --disable-eaptls --disable-peap \
        --with-openssl=${PREFIX_PATH}
    check_result "ERROR: configure ${LIB_NAME} failure"
    check_result "ERROR: configure ${LIB_NAME} failure"
    sed -i -e "/HAVE_CRYPT_H/d" pppd/config.h
    make -j ${JOBS} CFLAGS="-I ${INC_PATH}" && make install
    check_result "ERROR: compile ${LIB_NAME} failure"
    sed -i -e "/HAVE_CRYPT_H/d" pppd/config.h
    make -j ${JOBS} CFLAGS="-I ${INC_PATH}" && make install
    check_result "ERROR: compile ${LIB_NAME} failure"
    pr_info "${LIB_NAME} installed to '${BIN_PATH}'"
    install -m 755 pppd/pppd ${BIN_PATH}
    install -m 755 chat/chat ${BIN_PATH}
    pr_info "${LIB_NAME} installed to '${BIN_PATH}'"
    install -m 755 pppd/pppd -D ${BIN_PATH}/pppd
    install -m 755 chat/chat -D ${BIN_PATH}/chat
}
function do_depend()
{
    cd $TOP_PATH/openssl || exit 1
    pr_info "build depend openssl..."
    ./build.sh
    cd $PRJ_PATH || exit 1
}
function do_clean()
{
    rm -rf *${LIB_NAME}*
    rm -rf *${LIB_NAME}*
}
if [[ $# == 1 && $1 == -c ]] ;then
    pr_warn "start clean ${LIB_NAME}"
    do_clean
    exit;
    pr_warn "start clean ${LIB_NAME}"
    do_clean
    exit;
fi
do_depend
do_fetch
do_build
qt/build.sh
@@ -2,7 +2,11 @@
#+--------------------------------------------------------------------------------------------
#|   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++
#|
#| guowenxue@ubuntu22:~$ sudo apt install -y gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf
#| guowenxue@ubuntu22:~$ sudo update-alternatives --config g++
#| guowenxue@ubuntu22:~$ arm-linux-gnueabihf-g++ -v
#| gcc version 11.4.0 (Ubuntu 11.4.0-1ubuntu1~22.04.3)
#+--------------------------------------------------------------------------------------------
# library name and version
@@ -11,14 +15,11 @@
SRC_NAME=qt-everywhere-src-5.15.10
PACK_SUFIX=tar.xz
# LingYun source code FTP server
LY_FTP=http://master.weike-iot.com:8021/src/qt
# library download URL address
LIB_URL=$LY_FTP
LIB_URL=http://master.weike-iot.com:8021/src/qt
# Cross compiler for cross compile on Linux server
CROSS_COMPILE=/opt/gcc-aarch32-10.3-2021.07/bin/arm-none-linux-gnueabihf-
# QT should use this cross compiler
CROSS_TOOLS=arm-linux-gnueabihf-
# compile jobs
JOBS=`cat /proc/cpuinfo |grep "processor"|wc -l`
@@ -36,7 +37,7 @@
INC_PATH=$PREFIX_PATH/include
# check installed or not file
INST_FILE=$PREFIX_PATH/lib/libQt5Core.so
INST_FILE=$PREFIX_PATH/lib/libqlinuxfb.so
# shell script will exit once get command error
set -e
@@ -46,132 +47,133 @@
#+-------------------------+
function pr_error() {
    echo -e "\033[40;31m $1 \033[0m"
    echo -e "\033[40;31m $1 \033[0m"
}
function pr_warn() {
    echo -e "\033[40;33m $1 \033[0m"
    echo -e "\033[40;33m $1 \033[0m"
}
function pr_info() {
    echo -e "\033[40;32m $1 \033[0m"
    echo -e "\033[40;32m $1 \033[0m"
}
function check_result()
{
    if [ $? != 0 ] ; then
        pr_error $1
    fi
    if [ $? != 0 ] ; then
        pr_error $1
    fi
}
# decompress a packet to destination path
function do_unpack()
{
    tarball=$1
    dstpath=`pwd`
    tarball=$1
    dstpath=`pwd`
    if [[ $# == 2 ]] ; then
        dstpath=$2
    fi
    if [[ $# == 2 ]] ; then
        dstpath=$2
    fi
    pr_info "decompress $tarball => $dstpath"
    pr_info "decompress $tarball => $dstpath"
    mkdir -p $dstpath
    case $tarball in
        *.tar.gz)
            tar -xzf $tarball -C $dstpath
            ;;
    mkdir -p $dstpath
    case $tarball in
        *.tar.gz)
            tar -xzf $tarball -C $dstpath
            ;;
        *.tar.bz2)
            tar -xjf $tarball -C $dstpath
            ;;
        *.tar.bz2)
            tar -xjf $tarball -C $dstpath
            ;;
        *.tar.xz)
            tar -xJf $tarball -C $dstpath
            ;;
        *.tar.xz)
            tar -xJf $tarball -C $dstpath
            ;;
        *.tar.zst)
            tar -I zstd -xf $tarball -C $dstpath
            ;;
        *.tar.zst)
            tar -I zstd -xf $tarball -C $dstpath
            ;;
        *.tar)
            tar -xf $tarball -C $dstpath
            ;;
        *.tar)
            tar -xf $tarball -C $dstpath
            ;;
        *.zip)
            unzip -qo $tarball -d $dstpath
            ;;
        *.zip)
            unzip -qo $tarball -d $dstpath
            ;;
        *)
            pr_error "decompress Unsupport packet: $tarball"
            return 1;
            ;;
    esac
        *)
            pr_error "decompress Unsupport packet: $tarball"
            return 1;
            ;;
    esac
}
function do_export()
{
    BUILD_ARCH=$(uname -m)
    if [[ $BUILD_ARCH =~ "arm" ]] ; then
        pr_warn "local($BUILD_ARCH) compile $LIB_NAME"
        return ;
    fi
    BUILD_ARCH=$(uname -m)
    if [[ $BUILD_ARCH =~ "arm" ]] ; then
        pr_warn "local($BUILD_ARCH) compile $LIB_NAME"
        return ;
    fi
    pr_warn "cross(${CROSS_COMPILE}) compile $LIB_NAME"
    pr_warn "cross(${CROSS_TOOLS}) compile $LIB_NAME"
    # export cross toolchain
    export CC=${CROSS_COMPILE}gcc
    export CXX=${CROSS_COMPILE}g++
    export AS=${CROSS_COMPILE}as
    export AR=${CROSS_COMPILE}ar
    export LD=${CROSS_COMPILE}ld
    export NM=${CROSS_COMPILE}nm
    export RANLIB=${CROSS_COMPILE}ranlib
    export OBJDUMP=${CROSS_COMPILE}objdump
    export STRIP=${CROSS_COMPILE}strip
    # export cross toolchain
    export CC=${CROSS_TOOLS}gcc
    export CXX=${CROSS_TOOLS}g++
    export AS=${CROSS_TOOLS}as
    export AR=${CROSS_TOOLS}ar
    export LD=${CROSS_TOOLS}ld
    export NM=${CROSS_TOOLS}nm
    export RANLIB=${CROSS_TOOLS}ranlib
    export OBJDUMP=${CROSS_TOOLS}objdump
    export STRIP=${CROSS_TOOLS}strip
    # export cross configure
    export CONFIG_CROSS=" --build=i686-pc-linux --host=arm-linux "
    # export cross configure
    export CONFIG_CROSS=" --build=i686-pc-linux --host=arm-linux "
    # Clear LDFLAGS and CFLAGS
    export LDFLAGS=
    export CFLAGS=
    # Clear LDFLAGS and CFLAGS
    export LDFLAGS=
    export CFLAGS=
}
function do_fetch()
{
    if [ -e ${INST_FILE} ] ; then
        pr_warn "$LIB_NAME compile and installed alredy"
        exit ;
    fi
    if [ -e ${INST_FILE} ] ; then
        pr_warn "$LIB_NAME compile and installed alredy"
        exit ;
    fi
    if [ -d $SRC_NAME ] ; then
        pr_warn "$LIB_NAME fetch already"
        return ;
    fi
    if [ -d $SRC_NAME ] ; then
        pr_warn "$LIB_NAME fetch already"
        return ;
    fi
    if [ ! -f ${LIB_NAME}.${PACK_SUFIX} ] ; then
        wget ${LIB_URL}/${LIB_NAME}.${PACK_SUFIX}
        check_result "ERROR: download ${LIB_NAME} failure"
    fi
    if [ ! -f ${LIB_NAME}.${PACK_SUFIX} ] ; then
        wget ${LIB_URL}/${LIB_NAME}.${PACK_SUFIX}
        check_result "ERROR: download ${LIB_NAME} failure"
    fi
    do_unpack ${LIB_NAME}.${PACK_SUFIX}
    do_unpack ${LIB_NAME}.${PACK_SUFIX}
}
function do_build()
{
    cd $SRC_NAME
    cd $SRC_NAME
    QMAKE_FILE=qtbase/mkspecs/linux-arm-gnueabi-g++/qmake.conf
    set +e
    grep "`basename ${CROSS_COMPILE}`" ${QMAKE_FILE} > /dev/null 2>&1
    set +e
    grep "`basename ${CROSS_TOOLS}`" ${QMAKE_FILE} > /dev/null 2>&1
    if [ $? != 0 ] ; then
        sed -i "s|arm-linux-gnueabi-|`basename $CROSS_COMPILE`|" ${QMAKE_FILE}
        sed -i "s|arm-linux-gnueabi-|`basename $CROSS_TOOLS`|" ${QMAKE_FILE}
    fi
    set -e
    set -e
    QT_INST_PATH=$PREFIX_PATH
    export CROSS_SYSROOT=`${CROSS_COMPILE}gcc -print-sysroot`
    QT_INST_PATH=$PREFIX_PATH
    export CROSS_SYSROOT=`${CROSS_TOOLS}gcc -print-sysroot`
    ./configure -opensource -confirm-license -release -shared -strip \
        -extprefix ${QT_INST_PATH} -prefix ${QT_INST_PATH} -sysroot ${CROSS_SYSROOT} -pkg-config \
@@ -189,19 +191,19 @@
    make -j${JOBS} && make install
    check_result "ERROR: compile ${LIB_NAME} failure"
    cp ./qtbase/plugins/platforms/libqlinuxfb.so  ${QT_INST_PATH}/lib
    install -D ./qtbase/plugins/platforms/libqlinuxfb.so  ${QT_INST_PATH}/lib/libqlinuxfb.so
    #cp -af ${LIB_PATH}/lib/libts*so* ${QT_INST_PATH}/lib
}
function do_clean()
{
    rm -rf *${LIB_NAME}*
    rm -rf *${LIB_NAME}*
}
if [[ $# == 1 && $1 == -c ]] ;then
    pr_warn "start clean ${LIB_NAME}"
    do_clean
    exit;
    pr_warn "start clean ${LIB_NAME}"
    do_clean
    exit;
fi
do_fetch
sqlite/build.sh
@@ -40,139 +40,140 @@
#+-------------------------+
function pr_error() {
    echo -e "\033[40;31m $1 \033[0m"
    echo -e "\033[40;31m $1 \033[0m"
}
function pr_warn() {
    echo -e "\033[40;33m $1 \033[0m"
    echo -e "\033[40;33m $1 \033[0m"
}
function pr_info() {
    echo -e "\033[40;32m $1 \033[0m"
    echo -e "\033[40;32m $1 \033[0m"
}
function check_result()
{
    if [ $? != 0 ] ; then
        pr_error $1
    fi
    if [ $? != 0 ] ; then
        pr_error $1
    fi
}
# decompress a packet to destination path
function do_unpack()
{
    tarball=$1
    dstpath=`pwd`
    tarball=$1
    dstpath=`pwd`
    if [[ $# == 2 ]] ; then
        dstpath=$2
    fi
    if [[ $# == 2 ]] ; then
        dstpath=$2
    fi
    pr_info "decompress $tarball => $dstpath"
    pr_info "decompress $tarball => $dstpath"
    mkdir -p $dstpath
    case $tarball in
        *.tar.gz)
            tar -xzf $tarball -C $dstpath
            ;;
    mkdir -p $dstpath
    case $tarball in
        *.tar.gz)
            tar -xzf $tarball -C $dstpath
            ;;
        *.tar.bz2)
            tar -xjf $tarball -C $dstpath
            ;;
        *.tar.bz2)
            tar -xjf $tarball -C $dstpath
            ;;
        *.tar.xz)
            tar -xJf $tarball -C $dstpath
            ;;
        *.tar.xz)
            tar -xJf $tarball -C $dstpath
            ;;
        *.tar.zst)
            tar -I zstd -xf $tarball -C $dstpath
            ;;
        *.tar.zst)
            tar -I zstd -xf $tarball -C $dstpath
            ;;
        *.tar)
            tar -xf $tarball -C $dstpath
            ;;
        *.tar)
            tar -xf $tarball -C $dstpath
            ;;
        *.zip)
            unzip -qo $tarball -d $dstpath
            ;;
        *.zip)
            unzip -qo $tarball -d $dstpath
            ;;
        *)
            pr_error "decompress Unsupport packet: $tarball"
            return 1;
            ;;
    esac
        *)
            pr_error "decompress Unsupport packet: $tarball"
            return 1;
            ;;
    esac
}
function do_export()
{
    BUILD_ARCH=$(uname -m)
    if [[ $BUILD_ARCH =~ "arm" ]] ; then
        pr_warn "local($BUILD_ARCH) compile $LIB_NAME"
        return ;
    fi
    BUILD_ARCH=$(uname -m)
    if [[ $BUILD_ARCH =~ "arm" ]] ; then
        pr_warn "local($BUILD_ARCH) compile $LIB_NAME"
        return ;
    fi
    pr_warn "cross(${CROSS_COMPILE}) compile $LIB_NAME"
    pr_warn "cross(${CROSS_COMPILE}) compile $LIB_NAME"
    # export cross toolchain
    export CC=${CROSS_COMPILE}gcc
    export CXX=${CROSS_COMPILE}g++
    export AS=${CROSS_COMPILE}as
    export AR=${CROSS_COMPILE}ar
    export LD=${CROSS_COMPILE}ld
    export NM=${CROSS_COMPILE}nm
    export RANLIB=${CROSS_COMPILE}ranlib
    export OBJDUMP=${CROSS_COMPILE}objdump
    export STRIP=${CROSS_COMPILE}strip
    # export cross toolchain
    export CC=${CROSS_COMPILE}gcc
    export CXX=${CROSS_COMPILE}g++
    export AS=${CROSS_COMPILE}as
    export AR=${CROSS_COMPILE}ar
    export LD=${CROSS_COMPILE}ld
    export NM=${CROSS_COMPILE}nm
    export RANLIB=${CROSS_COMPILE}ranlib
    export OBJDUMP=${CROSS_COMPILE}objdump
    export STRIP=${CROSS_COMPILE}strip
    # export cross configure
    export CONFIG_CROSS=" --build=i686-pc-linux --host=arm-linux "
    # export cross configure
    export CONFIG_CROSS=" --build=i686-pc-linux --host=arm-linux "
    # Clear LDFLAGS and CFLAGS
    export LDFLAGS=
    export CFLAGS=
    # Clear LDFLAGS and CFLAGS
    export LDFLAGS=
    export CFLAGS=
}
function do_fetch()
{
    if [ -e ${INST_FILE} ] ; then
        pr_warn "$LIB_NAME compile and installed alredy"
        exit ;
    fi
    if [ -e ${INST_FILE} ] ; then
        pr_warn "$LIB_NAME compile and installed alredy"
        exit ;
    fi
    if [ -d $LIB_NAME ] ; then
        pr_warn "$LIB_NAME fetch already"
        return ;
    fi
    if [ -d $LIB_NAME ] ; then
        pr_warn "$LIB_NAME fetch already"
        return ;
    fi
    if [ ! -f ${LIB_NAME}.${PACK_SUFIX} ] ; then
        wget ${LIB_URL}/${LIB_NAME}.${PACK_SUFIX}
        check_result "ERROR: download ${LIB_NAME} failure"
    fi
    if [ ! -f ${LIB_NAME}.${PACK_SUFIX} ] ; then
        wget ${LIB_URL}/${LIB_NAME}.${PACK_SUFIX}
        check_result "ERROR: download ${LIB_NAME} failure"
    fi
    do_unpack ${LIB_NAME}.${PACK_SUFIX}
    do_unpack ${LIB_NAME}.${PACK_SUFIX}
}
function do_build()
{
    cd $LIB_NAME
    cd $LIB_NAME
    do_export
    do_export
    ./configure --prefix=${PREFIX_PATH} ${CONFIG_CROSS} --enable-static
    check_result "ERROR: configure ${LIB_NAME} failure"
    ./configure --prefix=${PREFIX_PATH} ${CONFIG_CROSS} --enable-static
    check_result "ERROR: configure ${LIB_NAME} failure"
    make && make install
    check_result "ERROR: compile ${LIB_NAME} failure"
    make && make install
    check_result "ERROR: compile ${LIB_NAME} failure"
}
function do_clean()
{
    rm -rf *${LIB_NAME}*
    rm -rf *${LIB_NAME}*
}
if [[ $# == 1 && $1 == -c ]] ;then
    pr_warn "start clean ${LIB_NAME}"
    do_clean
    exit;
    pr_warn "start clean ${LIB_NAME}"
    do_clean
    exit;
fi
do_fetch
stunnel/build.sh
@@ -40,143 +40,155 @@
#+-------------------------+
function pr_error() {
    echo -e "\033[40;31m $1 \033[0m"
    echo -e "\033[40;31m $1 \033[0m"
}
function pr_warn() {
    echo -e "\033[40;33m $1 \033[0m"
    echo -e "\033[40;33m $1 \033[0m"
}
function pr_info() {
    echo -e "\033[40;32m $1 \033[0m"
    echo -e "\033[40;32m $1 \033[0m"
}
function check_result()
{
    if [ $? != 0 ] ; then
        pr_error $1
    fi
    if [ $? != 0 ] ; then
        pr_error $1
    fi
}
# decompress a packet to destination path
function do_unpack()
{
    tarball=$1
    dstpath=`pwd`
    tarball=$1
    dstpath=`pwd`
    if [[ $# == 2 ]] ; then
        dstpath=$2
    fi
    if [[ $# == 2 ]] ; then
        dstpath=$2
    fi
    pr_info "decompress $tarball => $dstpath"
    pr_info "decompress $tarball => $dstpath"
    mkdir -p $dstpath
    case $tarball in
        *.tar.gz)
            tar -xzf $tarball -C $dstpath
            ;;
    mkdir -p $dstpath
    case $tarball in
        *.tar.gz)
            tar -xzf $tarball -C $dstpath
            ;;
        *.tar.bz2)
            tar -xjf $tarball -C $dstpath
            ;;
        *.tar.bz2)
            tar -xjf $tarball -C $dstpath
            ;;
        *.tar.xz)
            tar -xJf $tarball -C $dstpath
            ;;
        *.tar.xz)
            tar -xJf $tarball -C $dstpath
            ;;
        *.tar.zst)
            tar -I zstd -xf $tarball -C $dstpath
            ;;
        *.tar.zst)
            tar -I zstd -xf $tarball -C $dstpath
            ;;
        *.tar)
            tar -xf $tarball -C $dstpath
            ;;
        *.tar)
            tar -xf $tarball -C $dstpath
            ;;
        *.zip)
            unzip -qo $tarball -d $dstpath
            ;;
        *.zip)
            unzip -qo $tarball -d $dstpath
            ;;
        *)
            pr_error "decompress Unsupport packet: $tarball"
            return 1;
            ;;
    esac
        *)
            pr_error "decompress Unsupport packet: $tarball"
            return 1;
            ;;
    esac
}
function do_export()
{
    BUILD_ARCH=$(uname -m)
    if [[ $BUILD_ARCH =~ "arm" ]] ; then
        pr_warn "local($BUILD_ARCH) compile $LIB_NAME"
        return ;
    fi
    BUILD_ARCH=$(uname -m)
    if [[ $BUILD_ARCH =~ "arm" ]] ; then
        pr_warn "local($BUILD_ARCH) compile $LIB_NAME"
        return ;
    fi
    pr_warn "cross(${CROSS_COMPILE}) compile $LIB_NAME"
    pr_warn "cross(${CROSS_COMPILE}) compile $LIB_NAME"
    # export cross toolchain
    export CC=${CROSS_COMPILE}gcc
    export CXX=${CROSS_COMPILE}g++
    export AS=${CROSS_COMPILE}as
    export AR=${CROSS_COMPILE}ar
    export LD=${CROSS_COMPILE}ld
    export NM=${CROSS_COMPILE}nm
    export RANLIB=${CROSS_COMPILE}ranlib
    export OBJDUMP=${CROSS_COMPILE}objdump
    export STRIP=${CROSS_COMPILE}strip
    # export cross toolchain
    export CC=${CROSS_COMPILE}gcc
    export CXX=${CROSS_COMPILE}g++
    export AS=${CROSS_COMPILE}as
    export AR=${CROSS_COMPILE}ar
    export LD=${CROSS_COMPILE}ld
    export NM=${CROSS_COMPILE}nm
    export RANLIB=${CROSS_COMPILE}ranlib
    export OBJDUMP=${CROSS_COMPILE}objdump
    export STRIP=${CROSS_COMPILE}strip
    # export cross configure
    export CONFIG_CROSS=" --build=i686-pc-linux --host=arm-linux "
    # export cross configure
    export CONFIG_CROSS=" --build=i686-pc-linux --host=arm-linux "
    # Clear LDFLAGS and CFLAGS
    export LDFLAGS=
    export CFLAGS=
    # Clear LDFLAGS and CFLAGS
    export LDFLAGS=
    export CFLAGS=
}
function do_fetch()
{
    if [ -e ${INST_FILE} ] ; then
        pr_warn "$LIB_NAME compile and installed alredy"
        exit ;
    fi
    if [ -e ${INST_FILE} ] ; then
        pr_warn "$LIB_NAME compile and installed alredy"
        exit ;
    fi
    if [ -d $LIB_NAME ] ; then
        pr_warn "$LIB_NAME fetch already"
        return ;
    fi
    if [ -d $LIB_NAME ] ; then
        pr_warn "$LIB_NAME fetch already"
        return ;
    fi
    if [ ! -f ${LIB_NAME}.${PACK_SUFIX} ] ; then
        wget ${LIB_URL}/${LIB_NAME}.${PACK_SUFIX}
        check_result "ERROR: download ${LIB_NAME} failure"
    fi
    if [ ! -f ${LIB_NAME}.${PACK_SUFIX} ] ; then
        wget ${LIB_URL}/${LIB_NAME}.${PACK_SUFIX}
        check_result "ERROR: download ${LIB_NAME} failure"
    fi
    do_unpack ${LIB_NAME}.${PACK_SUFIX}
    do_unpack ${LIB_NAME}.${PACK_SUFIX}
}
function do_build()
{
    cd $LIB_NAME
    cd $LIB_NAME
    do_export
    do_export
    ./configure --prefix=${PREFIX_PATH} ${CONFIG_CROSS} --enable-static \
        --disable-shared --disable-largefile --disable-ipv6 \
        --disable-systemd --disable-libwrap --with-ssl=${PREFIX_PATH}
    check_result "ERROR: configure ${LIB_NAME} failure"
    ./configure --prefix=${PREFIX_PATH} ${CONFIG_CROSS} --enable-static \
        --disable-shared --disable-largefile --disable-ipv6 \
        --disable-systemd --disable-libwrap --with-ssl=${PREFIX_PATH}
    check_result "ERROR: configure ${LIB_NAME} failure"
    make -j ${JOBS} && make install
    check_result "ERROR: compile ${LIB_NAME} failure"
    make -j ${JOBS} && make install
    check_result "ERROR: compile ${LIB_NAME} failure"
}
function do_depend()
{
    cd $TOP_PATH/openssl || exit 1
    pr_info "build depend openssl..."
    ./build.sh
    cd $PRJ_PATH || exit 1
}
function do_clean()
{
    rm -rf *${LIB_NAME}*
    rm -rf *${LIB_NAME}*
}
if [[ $# == 1 && $1 == -c ]] ;then
    pr_warn "start clean ${LIB_NAME}"
    do_clean
    exit;
    pr_warn "start clean ${LIB_NAME}"
    do_clean
    exit;
fi
do_depend
do_fetch
do_build
valgrind/build.sh
@@ -40,140 +40,141 @@
#+-------------------------+
function pr_error() {
    echo -e "\033[40;31m $1 \033[0m"
    echo -e "\033[40;31m $1 \033[0m"
}
function pr_warn() {
    echo -e "\033[40;33m $1 \033[0m"
    echo -e "\033[40;33m $1 \033[0m"
}
function pr_info() {
    echo -e "\033[40;32m $1 \033[0m"
    echo -e "\033[40;32m $1 \033[0m"
}
function check_result()
{
    if [ $? != 0 ] ; then
        pr_error $1
    fi
    if [ $? != 0 ] ; then
        pr_error $1
    fi
}
# decompress a packet to destination path
function do_unpack()
{
    tarball=$1
    dstpath=`pwd`
    tarball=$1
    dstpath=`pwd`
    if [[ $# == 2 ]] ; then
        dstpath=$2
    fi
    if [[ $# == 2 ]] ; then
        dstpath=$2
    fi
    pr_info "decompress $tarball => $dstpath"
    pr_info "decompress $tarball => $dstpath"
    mkdir -p $dstpath
    case $tarball in
        *.tar.gz)
            tar -xzf $tarball -C $dstpath
            ;;
    mkdir -p $dstpath
    case $tarball in
        *.tar.gz)
            tar -xzf $tarball -C $dstpath
            ;;
        *.tar.bz2)
            tar -xjf $tarball -C $dstpath
            ;;
        *.tar.bz2)
            tar -xjf $tarball -C $dstpath
            ;;
        *.tar.xz)
            tar -xJf $tarball -C $dstpath
            ;;
        *.tar.xz)
            tar -xJf $tarball -C $dstpath
            ;;
        *.tar.zst)
            tar -I zstd -xf $tarball -C $dstpath
            ;;
        *.tar.zst)
            tar -I zstd -xf $tarball -C $dstpath
            ;;
        *.tar)
            tar -xf $tarball -C $dstpath
            ;;
        *.tar)
            tar -xf $tarball -C $dstpath
            ;;
        *.zip)
            unzip -qo $tarball -d $dstpath
            ;;
        *.zip)
            unzip -qo $tarball -d $dstpath
            ;;
        *)
            pr_error "decompress Unsupport packet: $tarball"
            return 1;
            ;;
    esac
        *)
            pr_error "decompress Unsupport packet: $tarball"
            return 1;
            ;;
    esac
}
function do_export()
{
    BUILD_ARCH=$(uname -m)
    if [[ $BUILD_ARCH =~ "arm" ]] ; then
        pr_warn "local($BUILD_ARCH) compile $LIB_NAME"
        return ;
    fi
    BUILD_ARCH=$(uname -m)
    if [[ $BUILD_ARCH =~ "arm" ]] ; then
        pr_warn "local($BUILD_ARCH) compile $LIB_NAME"
        return ;
    fi
    pr_warn "cross(${CROSS_COMPILE}) compile $LIB_NAME"
    pr_warn "cross(${CROSS_COMPILE}) compile $LIB_NAME"
    # export cross toolchain
    export CC=${CROSS_COMPILE}gcc
    export CXX=${CROSS_COMPILE}g++
    export AS=${CROSS_COMPILE}as
    export AR=${CROSS_COMPILE}ar
    export LD=${CROSS_COMPILE}ld
    export NM=${CROSS_COMPILE}nm
    export RANLIB=${CROSS_COMPILE}ranlib
    export OBJDUMP=${CROSS_COMPILE}objdump
    export STRIP=${CROSS_COMPILE}strip
    # export cross toolchain
    export CC=${CROSS_COMPILE}gcc
    export CXX=${CROSS_COMPILE}g++
    export AS=${CROSS_COMPILE}as
    export AR=${CROSS_COMPILE}ar
    export LD=${CROSS_COMPILE}ld
    export NM=${CROSS_COMPILE}nm
    export RANLIB=${CROSS_COMPILE}ranlib
    export OBJDUMP=${CROSS_COMPILE}objdump
    export STRIP=${CROSS_COMPILE}strip
    # export cross configure
    export CONFIG_CROSS=" --build=i686-pc-linux --host=armv7-linux "
    # export cross configure
    export CONFIG_CROSS=" --build=i686-pc-linux --host=armv7-linux "
    # Clear LDFLAGS and CFLAGS
    export LDFLAGS=
    export CFLAGS=
    # Clear LDFLAGS and CFLAGS
    export LDFLAGS=
    export CFLAGS=
}
function do_fetch()
{
    if [ -e ${INST_FILE} ] ; then
        pr_warn "$LIB_NAME compile and installed alredy"
        exit ;
    fi
    if [ -e ${INST_FILE} ] ; then
        pr_warn "$LIB_NAME compile and installed alredy"
        exit ;
    fi
    if [ -d $LIB_NAME ] ; then
        pr_warn "$LIB_NAME fetch already"
        return ;
    fi
    if [ -d $LIB_NAME ] ; then
        pr_warn "$LIB_NAME fetch already"
        return ;
    fi
    if [ ! -f ${LIB_NAME}.${PACK_SUFIX} ] ; then
        wget ${LIB_URL}/${LIB_NAME}.${PACK_SUFIX}
        check_result "ERROR: download ${LIB_NAME} failure"
    fi
    if [ ! -f ${LIB_NAME}.${PACK_SUFIX} ] ; then
        wget ${LIB_URL}/${LIB_NAME}.${PACK_SUFIX}
        check_result "ERROR: download ${LIB_NAME} failure"
    fi
    do_unpack ${LIB_NAME}.${PACK_SUFIX}
    do_unpack ${LIB_NAME}.${PACK_SUFIX}
}
function do_build()
{
    cd $LIB_NAME
    cd $LIB_NAME
    do_export
    do_export
    ./configure --prefix=${PREFIX_PATH} ${CONFIG_CROSS} \
        --enable-only32bit --disable-tls
    check_result "ERROR: configure ${LIB_NAME} failure"
    ./configure --prefix=${PREFIX_PATH} ${CONFIG_CROSS} \
        --enable-only32bit --disable-tls
    check_result "ERROR: configure ${LIB_NAME} failure"
    make -j ${JOBS} && make install
    check_result "ERROR: compile ${LIB_NAME} failure"
    make -j ${JOBS} && make install
    check_result "ERROR: compile ${LIB_NAME} failure"
}
function do_clean()
{
    rm -rf *${LIB_NAME}*
    rm -rf *${LIB_NAME}*
}
if [[ $# == 1 && $1 == -c ]] ;then
    pr_warn "start clean ${LIB_NAME}"
    do_clean
    exit;
    pr_warn "start clean ${LIB_NAME}"
    do_clean
    exit;
fi
do_fetch