Compare commits

..

No commits in common. "f059a694f3b35f51031ddd51268361bedce6a3bc" and "f36cd362461703c9e3e4d235b39b8b8a87ada83f" have entirely different histories.

13 changed files with 79 additions and 166 deletions

View File

@ -48,7 +48,7 @@ miss_tool_error bison --version
miss_tool_error flex --version
miss_tool_error makeinfo --version
if [ "$1"x = "gcc_arm64le"x ] || [ "$1"x = "gcc_arm32le"x ]; then
if [ "$1"x = "openeuler_gcc_arm64le"x ] || [ "$1"x = "openeuler_gcc_arm32le"x ]; then
cd $1
elif [ "$1"x = "clean"x ] ; then
clean

View File

@ -3,9 +3,6 @@ set -e
readonly LIB_PATH="$PWD/../open_source"
source $PWD/config.xml
build_rpmdir=`rpm --eval "%{_builddir}"`
src_rpmdir=`rpm --eval "%{_sourcedir}"`
SRC_BRANCH="openEuler-22.03-LTS-SP4"
#judge the open_source
@ -21,38 +18,42 @@ cd $LIB_PATH && delete_dir $GCC $BINUTILS $GMP $MPC $MPFR $ISL
pushd $LIB_PATH
function do_patch() {
pushd $1
cp -n * $src_rpmdir
specfile=`ls *.spec`
rpmbuild -bp $src_rpmdir/$specfile
if [ $1 = "isl" ];then
cp -a $build_rpmdir/$1/$1-0.14 ./
cp -a $build_rpmdir/$1/$1-0.16.1 ./
tar xf $1-0.14.tar.xz
tar xf $1-0.16.1.tar.xz
patch -p1 < *.patch
else
PKG=$(echo *.tar.*)
pkg_dir=${PKG%%.tar.*}
cp -a $build_rpmdir/$pkg_dir ./
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 $SRC_BRANCH https://gitee.com/src-openeuler/gcc.git
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 $SRC_BRANCH https://gitee.com/src-openeuler/glibc.git
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 $SRC_BRANCH https://gitee.com/src-openeuler/binutils.git
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 $SRC_BRANCH https://gitee.com/src-openeuler/gmp.git
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 $SRC_BRANCH https://gitee.com/src-openeuler/mpfr.git
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 $SRC_BRANCH https://gitee.com/src-openeuler/libmpc.git
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 $SRC_BRANCH https://gitee.com/src-openeuler/isl.git
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

View File

@ -1,7 +1,7 @@
Summary: C/C++ Cross Compiler Toolchain
Name: gcc-cross
Version: 1.0
Release: 7
Release: 0
# 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, zlib-devel, openssl-devel, texinfo, rsync, chrpath
BuildRequires: libtool, ncurses-devel, bc, openssl-devel, texinfo, rsync, chrpath
#ExclusiveArch: i386 x86-64
%description
@ -28,63 +28,27 @@ if [ "$files" != 0 ]; then
ls *.tar | xargs -n1 tar xvf
fi
bash download.sh
bash build.sh gcc_arm64le &
bash build.sh gcc_arm32le
bash build.sh openeuler_gcc_arm64le &
bash build.sh openeuler_gcc_arm32le
wait
%install
mkdir -p %{buildroot}/tmp
cp %{_builddir}/output/gcc_arm64le/gcc_arm64le.tar.gz %{buildroot}/tmp
cp %{_builddir}/output/gcc_arm32le/gcc_arm32le.tar.gz %{buildroot}/tmp
cp %{_builddir}/output/openeuler_gcc_arm64le/openeuler_gcc_arm64le.tar.gz %{buildroot}/tmp
cp %{_builddir}/output/openeuler_gcc_arm32le/openeuler_gcc_arm32le.tar.gz %{buildroot}/tmp
%files
%attr(755, root, root) /tmp/gcc_arm64le.tar.gz
%attr(755, root, root) /tmp/gcc_arm32le.tar.gz
%attr(755, root, root) /tmp/openeuler_gcc_arm64le.tar.gz
%attr(755, root, root) /tmp/openeuler_gcc_arm32le.tar.gz
%changelog
* Thu Nov 30 2023 zhengchenhui <zhengchenhui1@huawei.com> - 1.0-7
-Type:Fix
-ID:NA
-SUG:NA
-DESC: Fix the compilation problem caused by the missing code segment of crtbeginS.o
* Thu Nov 30 2023 zhengchenhui <zhengchenhui1@huawei.com> - 1.0-6
-Type:Fix
-ID:NA
-SUG:NA
-DESC: Fix cross-compilation tool chain to openEuler-22.03-LTS-SP3
* Tue Apr 25 2023 dingguangya <dingguangya1@huawei.com> - 1.0-5
-Type:Fix
-ID:NA
-SUG:NA
-DESC: Fix isl copy to SOURCES
* Sun Apr 23 2023 dingguangya <dingguangya1@huawei.com> - 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 <dingguangya1@huawei.com> - 1.0-3
-Type:Fix
-ID:NA
-SUG:NA
-DESC: Fix the hard coding problem in the software package building process
* Thu Nov 17 2022 dingguangya <dingguangya1@huawei.com> - 1.0-2
-Type:Fix
-ID:NA
-SUG:NA
-DESC: Unified changelog/Release field format
* Tue Nov 8 2022 dingguangya <dingguangya1@huawei.com> - 1.0-1
* Tue Nov 8 2022 dingguangya <dingguangya1@huawei.com>
- Type:Fix
- ID:NA
- SUG:NA
- DESC: Increase parallel compilation capability
* Wed Mar 23 2022 dingguangya <dingguangya1@huawei.com> - 1.0-0
* Wed Mar 23 2022 dingguangya <dingguangya1@huawei.com>
- Type:Init
- ID:NA
- SUG:NA

View File

@ -1,23 +0,0 @@
#!/bin/bash
set -e
set -x
readonly LOG_PATH="$PWD/../logs"
if [[ -z "$COMPILER_INFO" ]];then
source $PWD/../config.xml
fi
[ -e "$LOG_PATH/gcc_arm32le_patch.log" ] && rm $LOG_PATH/gcc_arm32le_patch.log
[ -e "$LOG_PATH/gcc_arm32le_build.log" ] && rm $LOG_PATH/gcc_arm32le_build.log
mkdir -p $LOG_PATH
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 2>&1 | tee $LOG_PATH/gcc_arm32le_build.log
echo "Build gcc_arm32le toolchain completed!"

View File

@ -1,21 +0,0 @@
#!/bin/bash
set -e
set -x
readonly LOG_PATH="$PWD/../logs"
source $PWD/../config.xml
[ -e "$LOG_PATH/gcc_arm64le_patch.log" ] && rm $LOG_PATH/gcc_arm64le_patch.log
[ -e "$LOG_PATH/gcc_arm64le_build.log" ] && rm $LOG_PATH/gcc_arm64le_build.log
mkdir -p $LOG_PATH
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 2>&1 | tee $LOG_PATH/gcc_arm64le_build.log
echo "Build gcc_arm64le toolchain completed!"

23
openeuler_gcc_arm32le/build.sh Executable file
View File

@ -0,0 +1,23 @@
#!/bin/bash
set -e
set -x
readonly LOG_PATH="$PWD/../logs"
if [[ -z "$COMPILER_INFO" ]];then
source $PWD/../config.xml
fi
[ -e "$LOG_PATH/openeuler_gcc_arm32le_patch.log" ] && rm $LOG_PATH/openeuler_gcc_arm32le_patch.log
[ -e "$LOG_PATH/openeuler_gcc_arm32le_build.log" ] && rm $LOG_PATH/openeuler_gcc_arm32le_build.log
mkdir -p $LOG_PATH
source pre_construction.sh &>> $LOG_PATH/openeuler_gcc_arm32le_patch.log
echo "------------------------------------------"
echo "Now building the "openeuler_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 openeuler_gcc_update_sourcecode.sh
source openeuler_gcc_arm_linux_release.sh &>> $LOG_PATH/openeuler_gcc_arm32le_build.log
echo "Build openeuler_gcc_arm32le toolchain completed!"

View File

@ -5,7 +5,7 @@ set -e
# Target root directory,should be adapted according to your environment
readonly ROOT_TAR_DIR="$PWD/arm32le_build_dir"
readonly ROOT_TAR_SRC="$PWD/../../open_source"
readonly INSTALL="gcc_arm32le"
readonly INSTALL="openeuler_gcc_arm32le"
readonly PREFIX="$PWD/arm32le_build_dir/$INSTALL"
readonly OUTPUT="$PWD/../../output/$INSTALL"
@ -15,7 +15,7 @@ readonly SECURE_CXXFLAGS="-O2 -Wall -fstack-protector-strong -D_FORTIFY_SOURCE=2
readonly SECURE_CFLAGS_FOR_TARGET="-O2 -Wall -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wl,-z,relro,-z,now,-z,noexecstack -Wtrampolines -Wno-stringop-overflow -march=armv7-a -mfloat-abi=soft -mfpu=vfp"
readonly SECURE_CXXFLAGS_FOR_TARGET="-O2 -Wall -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wl,-z,relro,-z,now,-z,noexecstack -Wtrampolines -Wno-stringop-overflow -march=armv7-a -mfloat-abi=soft -mfpu=vfp"
readonly TARGET="arm-linux-gnueabi"
readonly TARGET="arm-openeuler-linux-gnueabi"
readonly HOST="$(gcc -dumpmachine)"
readonly BUILD="$(gcc -dumpmachine)"
@ -94,32 +94,6 @@ 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
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

View File

@ -4,7 +4,7 @@ set -e
set -x
readonly ROOT_BUILD_SRC="$PWD/../../open_source"
readonly OUTPUT_INSTALL="$PWD/../../output/gcc_arm32le"
readonly OUTPUT_INSTALL="$PWD/../../output/openeuler_gcc_arm32le"
if [[ -z "$COMPILER_INFO" ]];then
source $PWD/../config.xml

21
openeuler_gcc_arm64le/build.sh Executable file
View File

@ -0,0 +1,21 @@
#!/bin/bash
set -e
set -x
readonly LOG_PATH="$PWD/../logs"
source $PWD/../config.xml
[ -e "$LOG_PATH/openeuler_gcc_arm64le_patch.log" ] && rm $LOG_PATH/openeuler_gcc_arm64le_patch.log
[ -e "$LOG_PATH/openeuler_gcc_arm64le_build.log" ] && rm $LOG_PATH/openeuler_gcc_arm64le_build.log
mkdir -p $LOG_PATH
source pre_construction.sh &>> $LOG_PATH/openeuler_gcc_arm64le_patch.log
echo "------------------------------------------"
echo "Now building the "openeuler_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 openeuler_gcc_update_sourcecode.sh
source openeuler_gcc_aarch64_linux_release.sh &>> $LOG_PATH/openeuler_gcc_arm64le_build.log
echo "Build openeuler_gcc_arm64le toolchain completed!"

View File

@ -5,7 +5,7 @@ set -e
# Target root directory,should be adapted according to your environment
readonly ROOT_TAR_DIR="$PWD/arm64le_build_dir"
readonly ROOT_TAR_SRC="$PWD/../../open_source"
readonly INSTALL="gcc_arm64le"
readonly INSTALL="openeuler_gcc_arm64le"
readonly PREFIX="$PWD/arm64le_build_dir/$INSTALL"
readonly OUTPUT="$PWD/../../output/$INSTALL"
@ -22,7 +22,7 @@ readonly SYSROOT="$PREFIX/sysroot"
#OTHER CONFIG
readonly ARCH="armv8-a"
readonly TARGET="aarch64-linux-gnueabi"
readonly TARGET="aarch64-openeuler-linux-gnu"
source $PWD/../config.xml
@ -96,32 +96,6 @@ 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
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

View File

@ -4,7 +4,7 @@ set -e
set -x
readonly ROOT_BUILD_SRC="$PWD/../../open_source"
readonly OUTPUT_INSTALL="$PWD/../../output/gcc_arm64le"
readonly OUTPUT_INSTALL="$PWD/../../output/openeuler_gcc_arm64le"
source $PWD/../config.xml