代码拉取完成,页面将自动刷新
#!/bin/bash
# * =====================================================
# * Copyright © hk. 2022-2025. All rights reserved.
# * File name : arm-gcc.sh
# * Author : 苏木
# * Date : 2024-11-02
# * ======================================================
##
BLACK="\033[1;30m"
RED='\033[1;31m' # 红
GREEN='\033[1;32m' # 绿
YELLOW='\033[1;33m' # 黄
BLUE='\033[1;34m' # 蓝
PINK='\033[1;35m' # 紫
CYAN='\033[1;36m' # 青
WHITE='\033[1;37m' # 白
CLS='\033[0m' # 清除颜色
INFO="${GREEN}[INFO]${CLS}"
WARN="${YELLOW}[WARN]${CLS}"
ERR="${RED}[ERR ]${CLS}"
SCRIPT_NAME=${0#*/}
SCRIPT_CURRENT_PATH=${0%/*}
SCRIPT_ABSOLUTE_PATH=`cd $(dirname ${0}); pwd`
SYSTEM_ENVIRONMENT_FILE=/etc/profile # 系统环境变量位置
USER_ENVIRONMENT_FILE=~/.bashrc
SOFTWARE_DIR_PATH=~/2software # 软件安装目录
HOST=arm-linux-gnueabihf
SCRIPT_PATH=$(pwd)
MAJOR_NAME=gcc-arm-linux-gnueabihf # 源码包解压后的名称
OPENSRC_VER_PREFIX=8.3 # 需要下载的源码版本前缀和后缀
OPENSRC_VER_SUFFIX=.0
PACKAGE_NAME=${MAJOR_NAME}-${OPENSRC_VER_PREFIX}${OPENSRC_VER_SUFFIX}
COMPRESS_PACKAGE=gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf.tar.xz # 定义压缩包名称
INSTALL_PATH=${SOFTWARE_DIR_PATH}/${PACKAGE_NAME} # 定义编译后安装--生成的文件,文件夹位置路径
# 无需修改--下载地址
# https://developer.arm.com/-/media/Files/downloads/gnu-a/8.3-2019.03/binrel/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf.tar.xz
DOWNLOAD_LINK=https://developer.arm.com/-/media/Files/downloads/gnu-a/8.3-2019.03/binrel/${COMPRESS_PACKAGE}
#下载源码包
function do_download_src ()
{
echo -e "${YELLOW}mstart download ${COMPRESS_PACKAGE}...${CLS}"
if [ ! -f "${COMPRESS_PACKAGE}" ];then
if [ ! -d "${PACKAGE_NAME}" ];then
wget -c ${DOWNLOAD_LINK}
fi
fi
echo -e "${YELLOW}mdone...${CLS}"
}
# 解压源码包
function do_tar_package ()
{
echo -e "${YELLOW}mstart unpacking the ${PACKAGE_NAME} package ...${CLS}"
mkdir -p ${INSTALL_PATH}
if [ ! -d "${PACKAGE_NAME}" ];then
tar -xf ${COMPRESS_PACKAGE} -C ${INSTALL_PATH} --strip-components=1
fi
echo -e "${YELLOW}mdone...${CLS}"
}
# 删除下载的文件
function do_delete_file ()
{
cd ${SCRIPT_PATH}
if [ -f "${COMPRESS_PACKAGE}" ];then
sudo rm -f ${COMPRESS_PACKAGE}
fi
}
function add_env_info()
{
echo "export PATH=${SOFTWARE_DIR_PATH}/${PACKAGE_NAME}/bin:$PATH" >> ${USER_ENVIRONMENT_FILE}
source ${USER_ENVIRONMENT_FILE}
}
do_download_src
do_tar_package
do_delete_file
add_env_info
exit $?
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。