From 696b5357549f78a4c386cac1e11b86a9f51cb12b Mon Sep 17 00:00:00 2001 From: d00573793 Date: Sun, 23 Apr 2023 15:45:48 +0800 Subject: [PATCH] [gcc-cross] Update cross-compilation tool chain to openEuler-22.03-LTS-Next --- download.sh | 34 +++++++++++------------- gcc-cross.spec | 10 +++++-- gcc_arm32le/build.sh | 4 +-- gcc_arm32le/gcc_arm_linux_release.sh | 28 +++++++++++++++++++ gcc_arm64le/build.sh | 4 +-- gcc_arm64le/gcc_aarch64_linux_release.sh | 28 +++++++++++++++++++ 6 files changed, 84 insertions(+), 24 deletions(-) diff --git a/download.sh b/download.sh index b492ff4..5391861 100755 --- a/download.sh +++ b/download.sh @@ -3,6 +3,8 @@ set -e readonly LIB_PATH="$PWD/../open_source" source $PWD/config.xml +build_rpmdir=`rpm --eval "%{_builddir}"` +src_rpmdir=`rpm --eval "%{_sourcedir}"` #judge the open_source @@ -18,42 +20,38 @@ cd $LIB_PATH && delete_dir $GCC $BINUTILS $GMP $MPC $MPFR $ISL pushd $LIB_PATH function do_patch() { pushd $1 + cp * $src_rpmdir + specfile=`ls *.spec` + rpmbuild -bp $src_rpmdir/$specfile if [ $1 = "isl" ];then - tar xf $1-0.14.tar.xz - tar xf $1-0.16.1.tar.xz - patch -p1 < *.patch + cp -a $build_rpmdir/$1/$1-0.14 ./ + cp -a $build_rpmdir/$1/$1-0.16.1 ./ 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 + pkg_dir=${PKG%%.tar.*} + cp -a $build_rpmdir/$pkg_dir ./ fi popd } -echo "Download $GCC" && git clone -b openEuler-22.03-LTS https://gitee.com/src-openeuler/gcc.git +echo "Download $GCC" && git clone -b openEuler-22.03-LTS-Next 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 +echo "Download $GLIBC" && git clone -b openEuler-22.03-LTS-Next 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 +echo "Download $BINUTILS" && git clone -b openEuler-22.03-LTS-Next 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 +echo "Download $GMP" && git clone -b openEuler-22.03-LTS-Next 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 +echo "Download $MPFR" && git clone -b openEuler-22.03-LTS-Next 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 +echo "Download $MPC" && git clone -b openEuler-22.03-LTS-Next 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 +echo "Download $ISL" && git clone -b openEuler-22.03-LTS-Next 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 diff --git a/gcc-cross.spec b/gcc-cross.spec index 9dd6bd4..d4d9e9e 100644 --- a/gcc-cross.spec +++ b/gcc-cross.spec @@ -1,7 +1,7 @@ Summary: C/C++ Cross Compiler Toolchain Name: gcc-cross Version: 1.0 -Release: 3 +Release: 4 # libgcc, libgfortran, libmudflap, libgomp, libstdc++ and crtstuff have # GCC Runtime Exception. License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ with exceptions and LGPLv2+ and BSD @@ -10,7 +10,7 @@ URL: http://gcc.gnu.org BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: binutils BuildRequires: gcc, gcc-c++, make, git, flex, bison, rpm-build, automake, autoconf -BuildRequires: libtool, ncurses-devel, bc, openssl-devel, texinfo, rsync, chrpath +BuildRequires: libtool, ncurses-devel, bc, zlib-devel, openssl-devel, texinfo, rsync, chrpath #ExclusiveArch: i386 x86-64 %description @@ -42,6 +42,12 @@ cp %{_builddir}/output/gcc_arm32le/gcc_arm32le.tar.gz %{buildroot}/tmp %attr(755, root, root) /tmp/gcc_arm32le.tar.gz %changelog +* Sun Apr 23 2023 dingguangya - 1.0-4 +-Type:Fix +-ID:NA +-SUG:NA +-DESC: Update cross-compilation tool chain to openEuler-22.03-LTS-Next + * Mon Nov 28 2022 dingguangya - 1.0-3 -Type:Fix -ID:NA diff --git a/gcc_arm32le/build.sh b/gcc_arm32le/build.sh index f3fccdb..8f79f25 100755 --- a/gcc_arm32le/build.sh +++ b/gcc_arm32le/build.sh @@ -13,11 +13,11 @@ fi [ -e "$LOG_PATH/gcc_arm32le_build.log" ] && rm $LOG_PATH/gcc_arm32le_build.log mkdir -p $LOG_PATH -source pre_construction.sh &>> $LOG_PATH/gcc_arm32le_patch.log +source pre_construction.sh 2>&1 | tee $LOG_PATH/gcc_arm32le_patch.log echo "------------------------------------------" echo "Now building the "gcc_arm32le" toolchain ..." echo "The entire build process takes about 45 minutes (build time is related to machine preformance), you can view the detailed build log in the ${LOG_PATH} file" source gcc_update_sourcecode.sh -source gcc_arm_linux_release.sh &>> $LOG_PATH/gcc_arm32le_build.log +source gcc_arm_linux_release.sh 2>&1 | tee $LOG_PATH/gcc_arm32le_build.log echo "Build gcc_arm32le toolchain completed!" diff --git a/gcc_arm32le/gcc_arm_linux_release.sh b/gcc_arm32le/gcc_arm_linux_release.sh index bec4da3..ee6be72 100755 --- a/gcc_arm32le/gcc_arm_linux_release.sh +++ b/gcc_arm32le/gcc_arm_linux_release.sh @@ -94,6 +94,34 @@ for file in $(find "$PREFIX" -name "lib*so*.0") ; do chrpath --delete $file done +for file in $(find "$PREFIX/sysroot/usr/lib/gconv" -name "*so") ; do + chrpath --delete $file +done + +for file in $(find "$PREFIX" -name "*") ; do + if [ -f "$file" ] + then + result=$(file $file) + res=$(echo $result | grep "ELF" | cat) + if [[ "$res" != "" ]] + then + get_arch=`arch` + if [[ $get_arch =~ "x86_64" ]] + then + res1=$(echo $result | grep "ARM" | cat) + if [[ "$res1" != "" ]] + then + $PREFIX/bin/$TARGET-strip $file + else + strip $file + fi + else + strip $file + fi + fi + fi +done + pushd $PREFIX/.. && chmod 750 $INSTALL -R tar --format=gnu -czf $OUTPUT/$INSTALL.tar.gz $INSTALL && popd diff --git a/gcc_arm64le/build.sh b/gcc_arm64le/build.sh index 433ec01..88c575d 100755 --- a/gcc_arm64le/build.sh +++ b/gcc_arm64le/build.sh @@ -11,11 +11,11 @@ source $PWD/../config.xml [ -e "$LOG_PATH/gcc_arm64le_build.log" ] && rm $LOG_PATH/gcc_arm64le_build.log mkdir -p $LOG_PATH -source pre_construction.sh &>> $LOG_PATH/gcc_arm64le_patch.log +source pre_construction.sh 2>&1 | tee $LOG_PATH/gcc_arm64le_patch.log echo "------------------------------------------" echo "Now building the "gcc_arm64le" toolchain ..." echo "The entire build process takes about 45 minutes (build time is related to machine preformance), you can view the detailed build log in the ${LOG_PATH} file" source gcc_update_sourcecode.sh -source gcc_aarch64_linux_release.sh &>> $LOG_PATH/gcc_arm64le_build.log +source gcc_aarch64_linux_release.sh 2>&1 | tee $LOG_PATH/gcc_arm64le_build.log echo "Build gcc_arm64le toolchain completed!" diff --git a/gcc_arm64le/gcc_aarch64_linux_release.sh b/gcc_arm64le/gcc_aarch64_linux_release.sh index 3a0f9e3..ba32f32 100755 --- a/gcc_arm64le/gcc_aarch64_linux_release.sh +++ b/gcc_arm64le/gcc_aarch64_linux_release.sh @@ -96,6 +96,34 @@ for file in $(find "$PREFIX" -name "lib*so*.0") ; do chrpath --delete $file done +for file in $(find "$PREFIX/sysroot/usr/lib64/gconv" -name "*so") ; do + chrpath --delete $file +done + +for file in $(find "$PREFIX" -name "*") ; do + if [ -f "$file" ] + then + result=$(file $file) + res=$(echo $result | grep "ELF" | cat) + if [[ "$res" != "" ]] + then + get_arch=`arch` + if [[ $get_arch =~ "x86_64" ]] + then + res1=$(echo $result | grep "ARM" | cat) + if [[ "$res1" != "" ]] + then + $PREFIX/bin/$TARGET-strip $file + else + strip $file + fi + else + strip $file + fi + fi + fi +done + pushd $PREFIX/.. && chmod 750 $INSTALL -R tar --format=gnu -czf $OUTPUT/$INSTALL.tar.gz $INSTALL && popd -- Gitee