免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1174 | 回复: 0

Debian下安装intel编译器的脚本 [复制链接]

论坛徽章:
0
发表于 2007-09-04 20:45 |显示全部楼层
#!/bin/sh
#Program: install-intel-compiler
# Author: HM Li
#   Date: 07-09-02
#说明:
#   1、此脚本适用于debian系统,测试版本10.0.025下不包含ide的ifort、icc、idb成功
#   2、解压缩编译器包之后到data目录下用root权限执行:脚本名 rpm包名
#   3、主要作用:
#      a、利用alien安装rpm
#      b、修改编译命令及环境设置脚本,并将原始文件备份为对应的.bak文件
#      c、设置/etc/profile,最后调用vim确认修改/etc/profile
MOD( )
{
    FILE=$INSTALLDIR/bin/$1
    cp $FILE $FILE.bak
    chmod 644 $FILE.bak
    sed -i -e "1a INSTALLDIR=$INSTALLDIR" -e 's//$INSTALLDIR/g' $FILE
}
if [ $# != "1" ]
then
    echo "Usage : install-intel-compiler "
    exit 1
elif [ $1 = "-h" ]
then
    echo "Usage : install-intel-compiler "
    exit 0
fi
if [ ! -f $1 ]; then
    echo "$1 does not exist."
    exit 2
fi
if [ ${1##*.} != "rpm" ]; then
    echo "$1 is not a rpm file"
    exit 3
fi
alien -i $1
VERSION=`echo $1 | awk -F- '{print $3}'`
for i in cc ifort idb
do
    echo $1 | grep $i >/dev/null
    if [ $? = 0 ]
    then
        if [ $i = ifort ]
        then
            COMP=fc
        else
            COMP=$i
        fi
        break
    fi
done
INSTALLDIR=/opt/intel/$COMP/$VERSION
case $COMP in
    fc)
        CMD=ifort
        MOD $CMD
        MOD ${CMD}vars.sh
        MOD ${CMD}vars.csh
        ;;
    cc)
        CMD=icpc
        MOD $CMD
        CMD=icc
        MOD $CMD
        MOD ${CMD}vars.sh
        MOD ${CMD}vars.csh
        ;;
    idb)
        CMD=idb
        MOD ${CMD}vars.sh
        MOD ${CMD}vars.csh
        ;;
esac
echo ". $INSTALLDIR/bin/${CMD}vars.sh" >>/etc/profile
vim /etc/profile

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u1/47806/showart_374292.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP