Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1637920
  • 博文数量: 126
  • 博客积分: 1541
  • 博客等级: 上尉
  • 技术积分: 1914
  • 用 户 组: 普通用户
  • 注册时间: 2012-05-20 11:14
文章分类

全部博文(126)

文章存档

2014年(21)

2013年(42)

2012年(63)

分类: LINUX

2013-03-13 21:55:33

#/bin/sh
function_help()
{


echo "please run command in project root directories"
echo "options:
              1: -j*
              2: -l          un repo sync code
              3: --help
              4: r/n         new or remake
              5: -p          un upload to server                "
echo "usage:
      example 1: ./zprojects/auto_make.sh  --help
              2: ./zprojects/auto_make.sh  E615-JMD
              3: ./zprojects/auto_make.sh  E615-JMD  r
              4: ./zprojects/auto_make.sh  E615-JMD  eng       "


}
for i in  "$@"
do
       if [  "$i" == "--help"  ];then
              function_help
              exit
       elif
              [ "$i" == "-l" ];then
              un_repo_sync="yes"
       elif
              [ "$i" == "r" -o "$i" == "n" ];then
              new_or_remake="$i"
       elif
              [  "$i" == "eng" ];then
              build_variant="$i"
       elif
              [  "$i" == "-p"  ];then
              un_upload_to_server="yes"
       elif
#             sed -n -r  "/^e(777|771|666|333|775).*/p" <<<$i
              build_proj=$(sed -n -r "/^[Ee][0-9]{3}.*/p" <<<$i)
                     [  ! -z $build_proj ];then
                      project="$( echo "$build_proj" | tr '[a-z]' '[A-Z]' )"
                     # project="$build_proj"
       elif
              for j in $(seq 1 12)
              do
              build_pthread=$(sed -n  "/^-j${j}$/p" <<<$i)
                     if [  !  -z "$build_pthread" ];then
                     pthread="$build_pthread"
                     fi
              done;then
              :
       else
              :
       fi
done




if [ -z "$project" ];then
       read -p "which project do you want to build:" project
fi


if [ -z "$new_or_remake" ];then
       new_or_remake=n
fi


if [ -z "$pthread" ];then
      cpu_pthread=$(cat /proc/cpuinfo |grep processor|wc -l)
      if [ $cpu_pthread -gt 8 ];then
             let pthread=$cpu_pthread-4
      elif [ $cpu_pthread -gt 4 ];then
             let pthread=$cpu_pthread-2
      else
             pthread=$cpu_pthread
      fi
      pthread_set=-j$pthread
else
      pthread_set=$pthread
fi


project_path=$(pwd | awk -F "/" '{print $4}')
if [ $project_path"yes" != "yes" ];then
       project_path=$HOME/$project_path
fi


pwd_path=$(pwd)


if [ "$pwd_path" != "$project_path" ];then
        echo "please comeback $project_path run command!!! "
        exit
fi






if [ "$un_repo_sync" != "yes" ];then
        repo sync -d -f $pthread_set
        if [ $? -ne 0 ];then
                 echo "Please hand synchronization code"
                 exit
        fi
else
#        echo -e  '\e[33mare you sure un synchronize code [y/n]  \e[m'
#        read ch
#        if [ $ch"yes" == "yyes" -o $ch"yes" == "Yyes" -o $ch"yes" == "yes" ];then
                        :
#        fi
fi


export RL_BUILD_RELEASE=true




. zprojects/envsetup.sh $project


if [ $? -ne 0 ];then
        echo "error:build environment setting error"
                 exit
fi


custer_name=$CUSTOM_NAME


custer=${custer_name%%-*}
name=${custer_name#*-}


if [ "$custer" == "$name" ];then
       custer_name=$custer
else
       custer_name=$custer[$name]
fi


custer_name_exist=$(ls $project_path/mediatek/config/ | grep $custer_name )


if [ ! -z $custer_name_exist ];then
       echo "Please confirm the project exists"
       exit
fi


if [ "$build_variant" == "eng" ];then
        export TARGET_BUILD_VARIANT="eng"
        echo "TARGET_BUILD_VARIANT=$ARGET_BUILD_VARIANT"
fi


proj=$FULL_PDT_NAME


if [ -e "out_$proj" ]; then
         rm -rf out_$proj/
else
        mkdir out_$proj
fi


if [ -e "out" ];then
        rm -rf out
        mkdir out
fi


ln -s out_$proj out -f


echo ./makeMtk -t $custer_name $new_or_remake


time ./makeMtk -t $custer_name $new_or_remake


if [ $? -ne 0 ];then
        echo "error:please eliminate errors then make"
                exit
fi


repo manifest -r -o out/target/product/$TARGET_PRODUCT/tag.xml


if [ "$un_upload_to_server" != "yes" ];then
./gg.py ci
fi

阅读(689) | 评论(0) | 转发(0) |
0

上一篇:shell 练习 随笔

下一篇:c语言实验

给主人留下些什么吧!~~