#!/bin/bash
|
|
CROSSTOOL=arm-linux-gnueabihf-
|
|
# display in red
|
function pr_error() {
|
echo ""
|
echo -e "\033[40;31m --E-- $1 \033[0m"
|
echo ""
|
}
|
|
# display in yellow
|
function pr_warn() {
|
echo ""
|
echo -e "\033[40;33m --W-- $1 \033[0m"
|
echo ""
|
}
|
|
# display in green
|
function pr_info() {
|
echo -e "\033[40;32m --I-- $1 \033[0m"
|
}
|
|
function check_depend()
|
{
|
ARCH=`uname -m`
|
echo ${ARCH} | grep "x86" > /dev/null
|
if [ $? != 0 ] ; then
|
pr_error "This folder must compile on X86 server ";
|
exit 1;
|
fi
|
|
|
${CROSSTOOL}g++ -v > /dev/null 2>&1
|
if [ $? != 0 ] ; then
|
pr_error "Crosstool not installed, please install it by follow command:"
|
pr_info "sudo apt install gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf"
|
exit 1;
|
fi
|
}
|
|
function do_compile
|
{
|
for dir in `ls`
|
do
|
if [ -f $dir/build*.sh ] ; then
|
cd $dir
|
bash ./build*.sh
|
cd -
|
fi
|
done
|
}
|
|
function do_clean
|
{
|
for dir in `ls`
|
do
|
if [ -f $dir/build*.sh ] ; then
|
cd $dir
|
bash ./build*.sh clean
|
cd -
|
fi
|
done
|
|
rm -rf install
|
}
|
|
if [[ $# == 1 ]] && [[ $1 == "clean" ]] ; then
|
do_clean
|
exit;
|
fi
|
|
check_depend
|
|
do_compile
|