制作ide(2)

#!/bin/sh
if [ "$#" -lt 1 -o  "$#" -gt 3 ];then
    echo "error:"
    echo "    usage:sh svn.sh -f directory [-p]"
    echo "    -f directory is the dir for intel and clutter file,this param is necessary"
    echo "    -p if you want to choose whether download sdk by yourself,default download all sdk and re-build"
    exit 1
fi

#prefix is the dir for intel and clutter file
download="false"
prefix=""
while getopts :pf: OPTION
do
    case $OPTION in
        f) prefix=$OPTARG
            if [ ! -d $prefix ];then
                mkdir -p $prefix
                if [ "$?" -ne "0" ];then
                    echo "sdk directory is not correct"
                    exit 1
                fi
            fi
            prefix=`realpath $prefix`
            ;;
        p) download="true"
            ;;
    esac
done
if [ -z "$prefix" ];then
    echo " -f directory param is necessary"
    exit 1
fi
cdir=`pwd`

#download svn filesystem clutter file sdk
svn export svn://172.16.68.158/h3Update/release/clutter
#copy clutter file to assigned directory
#copy clutter file to assigned directory
cp ./clutter/lib/* $prefix/usr/lib -r -a
cp ./clutter/include/* $prefix/usr/include/ -r -a
cp ./clutter/share/* $prefix/usr/share/ -r -a
cp ./clutter/bin/* /$prefix/usr/bin -r -a

#find ./data ./out -name ".svn" -type d -exec rm {} \;
if [ "$download" = "true" ];then
    sudo rm ~/IntelCE-* -rf
    left_space=`df ~ | grep "^/dev" | awk '{print $4}'`
    little=`expr 4 \* 1024 \* 1024`
    if [ "$left_space" -lt "$little" ];then
        echo "home directory space is not enough,which must be more than 4GB"
        echo "home directory space is not enough,which must be more than 4GB">>/var/log/ide_filesystem.log
        exit 88
    fi
    svn export svn://172.16.68.158/ide/h4/sdk
else
    while :
    do
        echo -n "do you download sdk,yes or no?(y/n)"
        read  dld
        if [ "$dld" = "y" -o  "$dld" = "Y" ];then    
            left_space=`df ~ | grep "^/dev" | awk '{print $4}'`
            little=`expr 4 \* 1024 \* 1024`
            if [ "$left_space" -lt "$little" ];then
                echo "home directory space is not enough,which must be more than 4GB"
                echo "home directory space is not enough,which must be more than 4GB">>/var/log/ide_filesystem.log
                exit 88
            fi
            svn export svn://172.16.68.158/ide/h4/sdk
#            find ./data ./out -name ".svn" -type d -exec rm {} \;
            break
        elif [ "$dld" = "n" -o  "$dld" = "N" ];then
            break
        else
            continue
        fi
    done
fi
#compiler sdk
while :
    do
    echo -n "do you compile sdk,yes or no?(y/n)"
    read  compile_or_not
    if [ "$compile_or_not" = "y" -o  "$compile_or_not" = "Y" ];then
        if [ -d /var/tmp/intelsdktmpmount ];then
            rm /var/tmp/intelsdktmpmount -rf
        fi
        mkdir /var/tmp/intelsdktmpmount
        mount_dir=/var/tmp/intelsdktmpmount
        setup_bool=0
        chmore=`which more`
        if [ ! -z $chmore ];then
            sudo mv $chmore $chmore.bak
            echo $chmore
        fi
        ls -l ./sdk/*iso  | awk '{print $8}'| while read filename

        do
            filename=`realpath $filename`
            sudo mount -t iso9660 -o loop $filename $mount_dir
        
            sudo $mount_dir/installer<<tmp
y    
y    
tmp

            if [ "$setup_bool" -eq "0" ];then
            setup_dir=`grep '^NAME: ' $mount_dir/version | sed 's/NAME: //'`
            echo "$setup_dir">./.tmp_file
            setup_bool=1
            fi
            sudo umount $mount_dir
        done
        setup_dir=`cat ./.tmp_file`
        rm $mount_dir -rf
        cd ~/$setup_dir
        if [ -z  `which doxygen` ];then
            sudo apt-get install doxygen
        fi
        sudo make defconfig
        sudo make
        cd $cdir
        elif [ "$compile_or_not" = "n" -o  "$compile_or_not" = "N" ];then
            break
        else
            continue
        fi
done



chmorebak=`which more.bak`

if [ ! -z $chmorebak ];then
    echo $chmorebak
    sudo mv $chmorebak `dirname $chmorebak`/more
fi


#create needed directory
if [ ! -d $prefix/usr/lib ];then
    mkdir -p $prefix/usr/lib
fi
if [ ! -d $prefix/usr/include ];then
    mkdir -p $prefix/usr/include
fi
if [ ! -d $prefix/usr/share ];then
    mkdir -p $prefix/usr/share
fi




#generate intel lib file
#sh $cdir/h3lib.sh ~/IntelCE-16.112330 $prefix
sh $cdir/h3lib.sh ~/IntelCE-21.1.11182.271362 $prefix

cd $cdir

#generate intel header file
sh $cdir/h3include.sh ~/IntelCE-21.1.11182.271362/build_i686/staging_dir $prefix/usr
cd $cdir

# change /usr/include/glib-2.0/glib/gutils.h
sudo  sed 's/^#  define G_INLINE_FUNC extern inline/#  define G_INLINE_FUNC static __inline __attribute__ ((unused))/' temp/meihua/usr/local/meihua/ide/1.0.5/usr/include/glib-2.0/glib/gutils.h > temp/meihua/usr/local/meihua/ide/1.0.5/usr/include/glib-2.0/glib/tmp
sudo  cp temp/meihua/usr/local/meihua/ide/1.0.5/usr/include/glib-2.0/glib/tmp temp/meihua/usr/local/meihua/ide/1.0.5/usr/include/glib-2.0/glib/gutils.h
sudo rm temp/meihua/usr/local/meihua/ide/1.0.5/usr/include/glib-2.0/glib/tmp

#delete tmp file
rm ./clutter -rf
rm  ./sdk -rf


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值