#!/bin/bash set -e readonly LIB_PATH="$PWD/../open_source" source $PWD/config.xml #judge the open_source [ ! -d "$LIB_PATH" ] && mkdir $LIB_PATH function delete_dir() { while [ $# !=0 ] ; do [ -n "$1" ] && rm -rf $1 ; shift; done } cd $LIB_PATH && delete_dir $GCC $BINUTILS $GMP $MPC $MPFR $ISL pushd $LIB_PATH function do_patch() { pushd $1 if [ $1 = "isl" ];then tar xf $1-0.14.tar.xz tar xf $1-0.16.1.tar.xz patch -p1 < *.patch else PKG=$(echo *.tar.*) tar xf *.tar.* cat *.spec | grep "Patch" | grep "\.patch" | awk '{print $2}' > $1-patchlist pushd ${PKG%%.tar.*} for i in `cat ../$1-patchlist` do patch -p1 < ../$i done popd fi popd } echo "Download $GCC" && git clone -b openEuler-22.03-LTS https://gitee.com/src-openeuler/gcc.git do_patch $GCC echo "Download $GLIBC" && git clone -b openEuler-22.03-LTS https://gitee.com/src-openeuler/glibc.git do_patch $GLIBC echo "Download $BINUTILS" && git clone -b openEuler-22.03-LTS https://gitee.com/src-openeuler/binutils.git do_patch $BINUTILS echo "Download $GMP" && git clone -b openEuler-22.03-LTS https://gitee.com/src-openeuler/gmp.git do_patch $GMP echo "Download $MPFR" && git clone -b openEuler-22.03-LTS https://gitee.com/src-openeuler/mpfr.git do_patch $MPFR echo "Download $MPC" && git clone -b openEuler-22.03-LTS https://gitee.com/src-openeuler/libmpc.git do_patch $MPC echo "Download $ISL" && git clone -b openEuler-22.03-LTS https://gitee.com/src-openeuler/isl.git do_patch $ISL echo "Download $LINUX_KERNEL" && git clone -b 5.10.0-60.16.0 https://gitee.com/openeuler/kernel.git --depth 1 cp -a $LINUX_KERNEL $LINUX_KERNEL_64