!26 [gcc-cross] Update cross-compilation tool chain

From: @dguangya 
Reviewed-by: @li-yancheng 
Signed-off-by: @li-yancheng
This commit is contained in:
openeuler-ci-bot 2023-03-06 06:27:23 +00:00 committed by Gitee
commit afd486f080
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
7 changed files with 90 additions and 20 deletions

View File

@ -9,11 +9,11 @@ MPFR_DIR="mpfr-4.1.0"
GMP="gmp" GMP="gmp"
GMP_DIR="gmp-6.2.1" GMP_DIR="gmp-6.2.1"
MPC="libmpc" MPC="libmpc"
MPC_DIR="mpc-1.2.0" MPC_DIR="mpc-1.3.1"
ISL="isl" ISL="isl"
ISL_DIR="isl-0.16.1" ISL_DIR="isl-0.24"
GLIBC="glibc" GLIBC="glibc"
GLIBC_DIR="glibc-2.34" GLIBC_DIR="glibc-2.36"
KERNEL_HEADERS="kernel_headers" KERNEL_HEADERS="kernel_headers"
KERNEL_HEADERS_64="kernel_headers_64" KERNEL_HEADERS_64="kernel_headers_64"
LINUX_KERNEL="kernel" LINUX_KERNEL="kernel"

View File

@ -18,10 +18,16 @@ cd $LIB_PATH && delete_dir $GCC $BINUTILS $GMP $MPC $MPFR $ISL
pushd $LIB_PATH pushd $LIB_PATH
function do_patch() { function do_patch() {
pushd $1 pushd $1
if [ $1 = "isl" ];then if [ $1 = "gmp" ];then
tar xf $1-0.14.tar.xz PKG=$(echo *.tar.*)
tar xf $1-0.16.1.tar.xz tar xf *.tar.*
patch -p1 < *.patch cat *.spec | grep "Patch" | grep "\.patch" | awk -F ':' '{print $2}' > $1-patchlist
pushd ${PKG%%.tar.*}
for i in `cat ../$1-patchlist`
do
patch -p1 < ../$i
done
popd
else else
PKG=$(echo *.tar.*) PKG=$(echo *.tar.*)
tar xf *.tar.* tar xf *.tar.*
@ -35,25 +41,25 @@ function do_patch() {
fi fi
popd popd
} }
echo "Download $GCC" && git clone -b openEuler-22.03-LTS https://gitee.com/src-openeuler/gcc.git echo "Download $GCC" && git clone -b master https://gitee.com/src-openeuler/gcc.git
do_patch $GCC 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 master https://gitee.com/src-openeuler/glibc.git
do_patch $GLIBC 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 master https://gitee.com/src-openeuler/binutils.git
do_patch $BINUTILS 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 master https://gitee.com/src-openeuler/gmp.git
do_patch $GMP 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 master https://gitee.com/src-openeuler/mpfr.git
do_patch $MPFR 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 master https://gitee.com/src-openeuler/libmpc.git
do_patch $MPC 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 master https://gitee.com/src-openeuler/isl.git
do_patch $ISL do_patch $ISL
echo "Download $LINUX_KERNEL" && git clone -b 5.10.0-60.16.0 https://gitee.com/openeuler/kernel.git --depth 1 echo "Download $LINUX_KERNEL" && git clone -b 5.10.0-60.16.0 https://gitee.com/openeuler/kernel.git --depth 1

View File

@ -1,7 +1,7 @@
Summary: C/C++ Cross Compiler Toolchain Summary: C/C++ Cross Compiler Toolchain
Name: gcc-cross Name: gcc-cross
Version: 1.0 Version: 1.0
Release: 3 Release: 4
# libgcc, libgfortran, libmudflap, libgomp, libstdc++ and crtstuff have # libgcc, libgfortran, libmudflap, libgomp, libstdc++ and crtstuff have
# GCC Runtime Exception. # GCC Runtime Exception.
License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ with exceptions and LGPLv2+ and BSD 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) BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: binutils BuildRequires: binutils
BuildRequires: gcc, gcc-c++, make, git, flex, bison, rpm-build, automake, autoconf 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 #ExclusiveArch: i386 x86-64
%description %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 %attr(755, root, root) /tmp/gcc_arm32le.tar.gz
%changelog %changelog
* Mon Mar 06 2023 dingguangya <dingguangya1@huawei.com> - 1.0-4
-Type:Fix
-ID:NA
-SUG:NA
-DESC: Update cross-compilation tool chain
* Mon Nov 28 2022 dingguangya <dingguangya1@huawei.com> - 1.0-3 * Mon Nov 28 2022 dingguangya <dingguangya1@huawei.com> - 1.0-3
-Type:Fix -Type:Fix
-ID:NA -ID:NA

View File

@ -13,11 +13,11 @@ fi
[ -e "$LOG_PATH/gcc_arm32le_build.log" ] && rm $LOG_PATH/gcc_arm32le_build.log [ -e "$LOG_PATH/gcc_arm32le_build.log" ] && rm $LOG_PATH/gcc_arm32le_build.log
mkdir -p $LOG_PATH 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 "------------------------------------------"
echo "Now building the "gcc_arm32le" toolchain ..." 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" 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_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!" echo "Build gcc_arm32le toolchain completed!"

View File

@ -1,6 +1,7 @@
#!/bin/bash #!/bin/bash
set -e set -e
set -x
# Target root directory,should be adapted according to your environment # Target root directory,should be adapted according to your environment
readonly ROOT_TAR_DIR="$PWD/arm32le_build_dir" readonly ROOT_TAR_DIR="$PWD/arm32le_build_dir"
@ -94,6 +95,34 @@ for file in $(find "$PREFIX" -name "lib*so*.0") ; do
chrpath --delete $file chrpath --delete $file
done 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 pushd $PREFIX/.. && chmod 750 $INSTALL -R
tar --format=gnu -czf $OUTPUT/$INSTALL.tar.gz $INSTALL && popd tar --format=gnu -czf $OUTPUT/$INSTALL.tar.gz $INSTALL && popd

View File

@ -11,11 +11,11 @@ source $PWD/../config.xml
[ -e "$LOG_PATH/gcc_arm64le_build.log" ] && rm $LOG_PATH/gcc_arm64le_build.log [ -e "$LOG_PATH/gcc_arm64le_build.log" ] && rm $LOG_PATH/gcc_arm64le_build.log
mkdir -p $LOG_PATH 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 "------------------------------------------"
echo "Now building the "gcc_arm64le" toolchain ..." 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" 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_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!" echo "Build gcc_arm64le toolchain completed!"

View File

@ -1,6 +1,7 @@
#!/bin/bash #!/bin/bash
set -e set -e
set -x
# Target root directory,should be adapted according to your environment # Target root directory,should be adapted according to your environment
readonly ROOT_TAR_DIR="$PWD/arm64le_build_dir" readonly ROOT_TAR_DIR="$PWD/arm64le_build_dir"
@ -96,6 +97,34 @@ for file in $(find "$PREFIX" -name "lib*so*.0") ; do
chrpath --delete $file chrpath --delete $file
done 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 pushd $PREFIX/.. && chmod 750 $INSTALL -R
tar --format=gnu -czf $OUTPUT/$INSTALL.tar.gz $INSTALL && popd tar --format=gnu -czf $OUTPUT/$INSTALL.tar.gz $INSTALL && popd