文件名称:
Linux安装gcc的shell脚本.pdf
开发工具:
文件大小: 124kb
下载次数: 0
上传时间: 2019-10-08
详细说明:GCC是GUN Compiler Collection的简称,除了编译程序之外,它还含其他相关工具,它能把易于人类使用的高级语言编写的源代码构建成计算机能够直接执行的二进制代码。INSTALL BASE=/usr/local/gcc/
#必需的库基目录
INSTALL PACKAGE BASE=I/usr/local/
#gcc编译配置
GCC CONFIGURE WITHEI
#镜像地址
Mirrors UrlthTtp: //mirror. linux-1a64. org/gnu/gcc
if[-z$1][$1
new
11; then
echo"gcc version is empty
echo"获取最新稳定版本号…";
GCC VERSION=curl SMIRRORS URL/releases/2>&l gre
p-P 'gcc-d+\d+d+-otail -n lgrep-P d+\ d+ld+'-o
if -z"SGCC VERSION"l then
echo"获取版失败!";
eⅹ
fi
if[-z$11; then
echo SGCC VERSION
eⅹit
fi
f
ifl-e"SINSTALL BASESGCC VERSION/bin/gcc"]; then
echo"gcc-SGCC VERSION already install
exit
f
OLD PATH=pwd
if["sO"=〃];the
en
cd"echo"$0"|grep-P'(?[^]+)+-o"
CURRENT PATH= pwd
cd SOLD PATH
else
CURRENT PATH-SOLD PATH
fi
if[!-d"gcc"]; then
mkdir gcc
fi
ca gcc
if[!-egCc-SGCC VERSION tar.gz "]; then
#download php
echo"download gcc-SGCC VERSION tar. gz
wget $MIRRORS URL/releases/gcc-$GCC VERSION/gcc-SGCC
VERSION. tar. gz 2>&1
f
if[! -d"gCc-SGCC VERSION"; then
#decompression
echo"decompression gcc- GCC VERSION. tar. gz
tar-zXf gCc-SGCC VErSION tar. gz
fi
if[!-dgcc-SGCC VERSION"; then
echo" gcc-GCC Version dir is not exists
exit
fi
echo install dependence
yum install -y gcc-C++ bzip2 ntpdate m4
#时间不同步容易造成配置死循环
ntpdate-u ntp api. bz
# while循环使用的是管道,会开启子进程,无法修改外部的变量
PACKAGE LISTS=cat gCc-SGCC VERSION/contrib/download pre
requisites grep-P-d+d+(d+)?.tar
for line in echo -e SPACKAGE LISTS
do
PACKAGE VERSION FILE=echo SLINElgrep-P "w+I-d+d+(
Ad+)?. tar.(bz2 gz)-o
PACKAGE=echo SPACKAGE VERSIOn FILEgrep- P Aw+-o
PACKAGE VERSION DIR=' echo SPACKAGE VERSION FILE
grep-P"w+-d+.d+(.d+)?-0
PACKAGE VERSION=echo SPACKAGE VERSION DIR grep
Pd+.d+(.d+)?-0
PACKAGE CONFIGURE WITH=SGCC CONFIGURE WITH
GCC CONFIGURE WITH-SPACKAGE CONFIGURE WITH
with-SPACKAGE-SINSTALL PACKAGE BASESPACKAGE/SPA
CKAGE VERSION
echo"install SPACKAGE VERSION DIR"
if [-dSINSTALL PACKAGE BASESPACKaGE/SPACKAgE
VERSION]; then
echo"PACKAGE VERSION DIR already install
continue
fi
if[!-e"SPACKAGE VERSION FILE"; then
#download package
echo"download SPACKAGE VERSION FILE
wget $MIRRORS URL/infrastructure/SPACKAGE VERSION
FILE 2>&1
if[!-d"SPACKAGE VERSION DIR"]; then
#decompression
echo"decompression SPACKAGE VERSION FILE
if[ -n"echo $PACKAGE VERSION FILEgrep-PgzS""]; th
en
tar-zxf SPACKAGE VERSION FILE
else
tar-xf SPACKAGE VERSION FILE
f
f
if[! -d"SPACKAGE VERSION DIR"]; then
echo"SPACKAGE VERSiOn DIR dir is not exists"
exit
fi
cd SPACKAGE VERSION DIR
if[["PACKAge=="isl"l; then
PACKAGE CONFIGURE WITH='--with-gmp-prefix=echo
PACKAGE CONFIGURE WITHgrep-P[]+gmp/d+.d+\d+
fi
echo"/configure--prefix SINSTALL PACKAGE BASESPACKa
GE/SPACKAGE VERSIONSPACKAGE CONFIGURE WITH
/configure --prefix-SINSTALL PACKAGE BASESPACKAGE/S
PACKAGE VERSIONSPACKAGE CONFIGURE WiTH 2>&1
make 2>&1
make install 2>&1
if [! -d"SINSTALL PACKAGE BASESPACKAGE/SPACKAGE
VeRSiONL-zIS SINSTALL PACKAGE BASESPACKAGE/S
PACKAGE VERSION then
echo"SPACKAGE-SPACKAGE VERSION install fail
exit
f
if[["PAcKAge"==isl"l; then
echo"mv lib/. py file
清除py文件,这些文件会影响共享的动态链接厍 Ifconfig
命令执行失败
for pY File in find SINSTALL PACKAGE BASESPACKAG
E/SPACKAGE VERSION/lib/-name"py
if[-n"SPY FiLE"]&&l-e"SPY FILe"]; then
echo"mV SPY FILE SINSTALL PACKAGE BASESPAC
KAGE/SPACKAGE VERSION
mV SPY FILE SINSTALL PACKAGE BASESPACKAGE/
PACKAGEⅤ ERSION
fi
one
fi
#共享的动态链接库,加载配置
if [-d"SINSTALL PACKAGE BASESPACKAGE/SPACKAGE
VERSION/lib]&&[-z cat /etc/ld. so. conf grep"SINSTALL PAc
KAGE BASESPACKAGE/SPACKAGE VERSION"; then
echo"SINSTALL PACKAGE BASESPACKAGE/SPACKAGE
VERSION/ib">>/etc/ld. so. conf
Ifconfig
fi
cd/
d
one
cd gCc-SGCC VERSION
echo" install gcc
make clean 2>&1
#64位系统需要禁用 multilib
if[-n" uname -agrep-P'eld+xld+ d+'-ogrep x86 64-0 ]; then
GCC CONFIGURE WITH=SGCC CONFIGURE WITH--disabl
e-multilib
f
#新版需要下载配置文件
if[! -e"./configure"]&&l-e"/ contrib/download prerequisites"; th
en
/contrib/download prerequisites
mkdir gcc-make-tmp
cd gcc-make-tmp
echo"./configure --prefix-SINSTALL BASESGCC VERSIONSG
CC CONFIGURE WITH
/configure --prefix=INSTALL BASESGCC VERSIONSGCC C
ONFIGURE WITH 2>&
else
echo "./configure --prefix-SINSTALL BASESGCC VERSIONSG
CC CONFIGURE WITH'
/configure --prefix-SINSTALL BASESGCC VERSIONSGCC C
ONFIGURE WITH 2>&1
fi
(系统自动生成,下载前可以参看下载内容)
下载文件列表
相关说明
- 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
- 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度。
- 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
- 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
- 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
- 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.