init.sh 1.53 KB
#!/bin/bash

read -p "Build hi3519 or hi3516cv500 or s2(h/c/s)?(h)" PLAT
if [ -z $PLAT ]; then
	PLAT="h"
fi

if [[ $PLAT =~ ^([hH][iI][3][5][1][9]|[hH])$ ]]; then
	PLAT=hi3519
	PLAT_MAKEFILE=appweb-linux-default-hi3519-32.mk
	BUILD_DIR=linux-hi3519-32-default
	COMPILER=/opt/hisi-linux/x86-arm/arm-hisiv500-linux/bin/arm-hisiv500-linux-uclibcgnueabi-gcc
elif [[ $PLAT =~ ^([sS][2]|[sS])$ ]]; then
	PLAT=s2
	PLAT_MAKEFILE=appweb-linux-default-s2-32.mk
	BUILD_DIR=linux-s2-32-default
	COMPILER=/usr/local/linaro-multilib-2014.06-gcc4.9/bin/arm-linux-gnueabihf-gcc
elif [[ $PLAT =~ ^([cC][vV]|[cC])$ ]]; then
        PLAT=hi3516cv500
        PLAT_MAKEFILE=appweb-linux-default-hi3516cv500-32.mk
        BUILD_DIR=linux-hi3516cv500-32-default
        COMPILER=/opt/hisi-linux/x86-arm/arm-himix200-linux/bin/arm-himix200-linux-gcc
else
	echo -e "\033[0;31;40mInput error \033[0m"
	exit -1
fi

if [[ ! -f ../projects/$PLAT_MAKEFILE ]]; then
	echo -e "\033[0;31;40mBuild error \033[0m"
	echo -e "\033[0;31;40mMake sure the file ../projects/$PLAT_MAKEFILE exists\033[0m"
	echo -e "\033[0;31;40mPlease check the svn\033[0m"
	exit -1
fi

#build appweb
cd ..
make -f projects/$PLAT_MAKEFILE
if [[ $? -ne 0 ]]; then
	echo -e "\033[0;31;40mBuild $PLAT appweb error \033[0m"
	exit -1
fi
cd -

#build business
export CC=$COMPILER
appesp --platform ../build/$BUILD_DIR clean
appesp --platform ../build/$BUILD_DIR compile
if [[ $? -ne 0 ]]; then
	echo -e "\033[0;31;40mBuild $PLAT error \033[0m"
else
	echo -e "\033[0;32;40mBuild $PLAT done! \033[0m"
fi

#-Wunused-local-typedefs