LingYun open library local/cross compile shell scripts
14 files modified
7 files deleted
3 files added
3326 ■■■■ changed files
build.sh 106 ●●●●● patch | view | raw | blame | history
busybox/build.sh 163 ●●●● patch | view | raw | blame | history
cjson/build.sh 163 ●●●● patch | view | raw | blame | history
libevdev/build.sh 135 ●●●●● 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 170 ●●●●● patch | view | raw | blame | history
lvgl/libs_lvgl/build.sh 72 ●●●●● patch | view | raw | blame | history
lvgl/libs_lvgl/patches/gen_patch.sh 55 ●●●●● patch | view | raw | blame | history
lvgl/libs_lvgl/patches/lv_demos-8.0.1-imx6ull.patch 49 ●●●●● patch | view | raw | blame | history
lvgl/libs_lvgl/patches/lv_drivers-8.0.1-imx6ull.patch 103 ●●●●● patch | view | raw | blame | history
lvgl/libs_lvgl/patches/lvgl-8.0.2-imx6ull.patch 92 ●●●●● patch | view | raw | blame | history
lvgl/lvgl_demo.c 91 ●●●●● patch | view | raw | blame | history
lvgl/makefile 46 ●●●●● 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
build.sh
New file
@@ -0,0 +1,106 @@
#!/bin/bash
# Cross compiler for cross compile on Linux server
CROSS_COMPILE=/opt/gcc-aarch32-10.3-2021.07/bin/arm-none-linux-gnueabihf-
# this project absolute path
PRJ_PATH=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd)
# binaries install path
PREFIX_PATH=$PRJ_PATH/install
# shell script will exit once get command error
set -e
#+-------------------------+
#| Shell script functions  |
#+-------------------------+
function pr_error() {
    echo -e "\033[40;31m $1 \033[0m"
}
function pr_warn() {
    echo -e "\033[40;33m $1 \033[0m"
}
function pr_info() {
    echo -e "\033[40;32m $1 \033[0m"
}
function check_result()
{
    if [ $? != 0 ] ; then
        pr_error $1
    fi
}
do_build()
{
    pr_warn "build all the project..."
    for dir in */; do
        [ -d "$dir" ] || continue
        if [ -x "$dir/build.sh" ]; then
            (
                cd "$dir" || exit 1
                ./build.sh
            )
        fi
    done
    pr_info "==== Build: done ===="
}
do_clean()
{
    pr_warn "clean all the project..."
    for dir in */; do
        [ -d "$dir" ] || continue
        if [ -x "$dir/build.sh" ]; then
            (
                cd "$dir" || exit 1
                ./build.sh -c
            )
        fi
    done
    pr_info "==== Clean: install ===="
    rm -rf $PREFIX_PATH
}
do_cross()
{
    pr_warn "update crosstool $CROSS_COMPILE..."
    for dir in */; do
        [ -d "$dir" ] || continue
        if [ -x "$dir/build.sh" ]; then
            echo "==== update: ${dir%/} ===="
            (
                cd "$dir" || exit 1
                sed -i "s|^CROSS_COMPILE=.*|CROSS_COMPILE=${CROSS_COMPILE}|g" build.sh
            )
        fi
    done
}
case "$1" in
    build)
        do_build
        ;;
    clean)
        do_clean
        ;;
    cross)
        do_cross
        ;;
    *)
        echo "Usage: $0 {build|clean|cross}"
        exit 1
        ;;
esac
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
New file
@@ -0,0 +1,135 @@
#!/bin/bash
# Git url
GITURL=https://gitlab.freedesktop.org/libevdev/libevdev.git
# branch
BRANCH=master
# library name
LIB_NAME=$(basename "$GITURL" .git)
# Cross compiler for cross compile on Linux server
CROSS_COMPILE=/opt/gcc-aarch32-10.3-2021.07/bin/arm-none-linux-gnueabihf-
# compile jobs
JOBS=`cat /proc/cpuinfo |grep "processor"|wc -l`
# this project absolute path
PRJ_PATH=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd)
# top project absolute path
TOP_PATH=$(realpath $PRJ_PATH/..)
# binaries build prefix install path
PREFIX_PATH=$TOP_PATH/install
# binaries finally install path if needed
#INST_PATH=/tftp
# 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
#+-------------------------+
#| Shell script functions  |
#+-------------------------+
function pr_error() {
    echo -e "\033[40;31m $1 \033[0m"
}
function pr_warn() {
    echo -e "\033[40;33m $1 \033[0m"
}
function pr_info() {
    echo -e "\033[40;32m $1 \033[0m"
}
function do_export()
{
    pr_warn "cross(${CROSS_COMPILE}) compile $LIB_NAME"
    export CC=${CROSS_COMPILE}gcc
    export CXX=${CROSS_COMPILE}g++
    export AR=${CROSS_COMPILE}ar
    export LD=${CROSS_COMPILE}ld
    export STRIP=${CROSS_COMPILE}strip
    export CROSS_FILE=cross.txt
}
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;
    fi
    pr_info "start fetch $LIB_NAME source code"
    if [ ! -d $LIB_NAME ] ; then
        git clone -b $BRANCH $GITURL
    fi
    cd $PRJ_PATH
}
function do_build()
{
    BUILD_DIR="build"
    cd "$LIB_NAME" || exit 1
    rm -rf "$BUILD_DIR" && mkdir -p $BUILD_DIR && cd $BUILD_DIR
    cat > "$CROSS_FILE" <<EOF
[binaries]
c = '${CC}'
cpp = '${CXX}'
ar = '${AR}'
strip = '${STRIP}'
pkgconfig = 'pkg-config'
[host_machine]
system = 'linux'
cpu_family = 'arm'
cpu = 'armv7'
endian = 'little'
EOF
    meson setup .. --cross-file "$CROSS_FILE" --prefix="$PREFIX_PATH" -Ddocumentation=disabled -Dtests=disabled
    ninja -j$(nproc) && ninja install
    cd "$PRJ_PATH" || exit 1
}
function do_clean()
{
    rm -rf *${LIB_NAME}*
}
if [[ $# == 1 && $1 == -c ]] ;then
    pr_warn "start clean ${LIB_NAME}"
    do_clean
    exit;
fi
do_fetch
do_export
do_build
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
New file
@@ -0,0 +1,170 @@
#!/bin/bash
# Git url
GITURL=https://github.com/lvgl/lv_port_linux.git
# branch
BRANCH=release/v9.5
# library name
LIB_NAME=$(basename "$GITURL" .git)
# Cross compiler for cross compile on Linux server
CROSS_COMPILE=/opt/gcc-aarch32-10.3-2021.07/bin/arm-none-linux-gnueabihf-
# compile jobs
JOBS=`cat /proc/cpuinfo |grep "processor"|wc -l`
# this project absolute path
PRJ_PATH=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd)
# top project absolute path
TOP_PATH=$(realpath $PRJ_PATH/..)
# binaries build prefix install path
PREFIX_PATH=$TOP_PATH/install
# binaries finally install path if needed
#INST_PATH=/tftp
# 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
#+-------------------------+
#| Shell script functions  |
#+-------------------------+
function pr_error() {
    echo -e "\033[40;31m $1 \033[0m"
}
function pr_warn() {
    echo -e "\033[40;33m $1 \033[0m"
}
function pr_info() {
    echo -e "\033[40;32m $1 \033[0m"
}
function do_export()
{
    pr_warn "cross(${CROSS_COMPILE}) compile $LIB_NAME"
    export CC=${CROSS_COMPILE}gcc
    export CXX=${CROSS_COMPILE}g++
    export AR=${CROSS_COMPILE}ar
    export LD=${CROSS_COMPILE}ld
    export STRIP=${CROSS_COMPILE}strip
    export PKG_CONFIG_PATH=$PREFIX_PATH/lib/pkgconfig:$PKG_CONFIG_PATH
    export LIBRARY_PATH=$PREFIX_PATH/lib/:$LIBRARY_PATH
    export LDFLAGS="-L$PREFIX_PATH/lib"
}
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;
    fi
    pr_info "start fetch $LIB_NAME source code"
    if [ ! -d $LIB_NAME ] ; then
        git clone -b $BRANCH $GITURL
    fi
    cd $LIB_NAME
    git submodule update --init --recursive
    cd $PRJ_PATH
}
function do_patch()
{
    FILE=user_cross_compile_setup.cmake
    TOOLCHAIN_ROOT=$(dirname $(dirname $CROSS_COMPILE))
    TOOLCHAIN_PREFIX=$(basename $CROSS_COMPILE)
    cd "$LIB_NAME" || exit 1
    if grep -q "${TOOLCHAIN_PREFIX}" $FILE; then
        pr_warn "toolchain already updated"
        cd "$PRJ_PATH" || exit 1
        return 0
    fi
    pr_info "modify toolchain config..."
    sed -i \
        -e "s#^set(tools .*#set(tools ${TOOLCHAIN_ROOT})#" \
        -e "s#arm-openwrt-linux-gnueabi-gcc#${TOOLCHAIN_PREFIX}gcc#" \
        -e "s#arm-openwrt-linux-gnueabi-g++#${TOOLCHAIN_PREFIX}g++#" \
        $FILE
    cd "$PRJ_PATH" || exit 1
}
function do_build()
{
    BUILD_DIR="build"
    cd "$LIB_NAME" || exit 1
    if [ ! -f "$BUILD_DIR/CMakeCache.txt" ]; then
        pr_info "configuring 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
    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
}
function do_depends()
{
    cd $TOP_PATH/libevdev || exit 1
    pr_info "build depend libevdev..."
    ./build.sh
    cd $PRJ_PATH || exit 1
}
function do_clean()
{
    rm -rf *${LIB_NAME}*
}
if [[ $# == 1 && $1 == -c ]] ;then
    pr_warn "start clean ${LIB_NAME}"
    do_clean
    exit;
fi
do_depends
do_fetch
do_export
do_patch
do_build
lvgl/libs_lvgl/build.sh
File was deleted
lvgl/libs_lvgl/patches/gen_patch.sh
File was deleted
lvgl/libs_lvgl/patches/lv_demos-8.0.1-imx6ull.patch
File was deleted
lvgl/libs_lvgl/patches/lv_drivers-8.0.1-imx6ull.patch
File was deleted
lvgl/libs_lvgl/patches/lvgl-8.0.2-imx6ull.patch
File was deleted
lvgl/lvgl_demo.c
File was deleted
lvgl/makefile
File was deleted
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}* ${SRC_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