cross-toolchain.spec: sync with altcross-2stage.sh

This commit is contained in:
Алексей Шепляков 2023-01-30 19:08:59 +04:00
parent 717595bbc6
commit 1ade77ca76

View File

@ -3,8 +3,7 @@
# %%define target_arch arm
# %%define target_arch mipsel
# %%define target_arch riscv64
%define target_arch @targetarch@
%define target_arch loongarch64
%if "%target_arch" == "aarch64"
%define target_kernel arm64
@ -59,7 +58,7 @@
%brp_strip_none %sysroot/* %prefix/lib/gcc/*.a %prefix/lib/gcc/*.o
Name: cross-toolchain-%target
Version: 20220605
Version: 20230130
Release: alt1
Summary: GCC cross-toolchain for %target
License: LGPL-2.1-or-later and LGPL-3.0-or-later and GPL-2.0-or-later and GPL-3.0-or-later and GPL-3.0-or-later with GCC-exception-3.1
@ -67,26 +66,29 @@ Group: Development/C
ExclusiveArch: x86_64
%define gcc_version %{get_version gcc-source}
%define gcc_version 13.0.0.20230128.gfe4608efc15
%define gcc_branch %(v=%gcc_version; v=${v%%%%.*}; echo $v)
%define binutils_version %{get_version binutils-source}
%define glibc_version %{get_version glibc-source}
%define binutils_version 2.40
%define glibc_version 2.36.20221009
%if "%target_arch" == "loongarch64"
%define kernel_version 6.0
%else
%define kernel_version 5.10
%endif
Source0: gcc-13.0.0-20230128-gfe4608efc15.tar
Source1: binutils-2.40.tar
Source2: glibc-2.36-20221009.tar
Source3: kernel-source-6.1.0.tar
Source4: gmp-6.2.1.tar
Source5: isl-0.24.tar
Source6: mpc-1.2.1.tar
Source7: mpfr-4.1.0.tar
BuildPreReq: gcc-c++
BuildPreReq: libmpc-devel libmpfr-devel libgmp-devel zlib-devel
BuildPreReq: coreutils flex bison makeinfo perl-Pod-Parser findutils
BuildPreReq: coreutils flex bison makeinfo findutils
# Linux' headers_install uses rsync
BuildPreReq: rsync
BuildRequires(pre): gcc-source
BuildRequires(pre): binutils-source
BuildRequires(pre): glibc-source
BuildPreReq: kernel-source-%kernel_version
BuildRequires: /usr/bin/qemu-%target_qemu_arch-static
BuildRequires: python3
@ -145,10 +147,16 @@ static glibc for %target_arch. Should be used for cross-compilation only
%setup -cT
mkdir -p -m755 linux binutils gcc glibc
find /usr/src/gcc-source -type f -name 'gcc-*.tar' | xargs -I {} -n1 tar -x --strip-components=1 -f {} -C gcc
find /usr/src/binutils-source -type f -name 'binutils-*.tar' | xargs -I {} -n1 tar -x --strip-components=1 -f {} -C binutils
find /usr/src/kernel/sources -type f -name 'kernel-source-*.tar' | xargs -I {} -n1 tar -x --strip-components=1 -f {} -C linux
find /usr/src/glibc-source -type f -name 'glibc-*.tar' | xargs -I {} -n1 tar -x --strip-components=1 -f {} -C glibc
tar -x --strip-components=1 -f %SOURCE0 -C gcc
tar -x --strip-components=1 -f %SOURCE1 -C binutils
tar -x --strip-components=1 -f %SOURCE2 -C glibc
tar -x --strip-components=1 -f %SOURCE3 -C linux
mkdir -p -m755 gcc/gmp gcc/mpc gcc/mpfr gcc/isl
tar -x --strip-components=1 -f %SOURCE4 -C gcc/gmp
tar -x --strip-components=1 -f %SOURCE5 -C gcc/isl
tar -x --strip-components=1 -f %SOURCE6 -C gcc/mpc
tar -x --strip-components=1 -f %SOURCE7 -C gcc/mpfr
rm -rf stage
@ -161,7 +169,11 @@ mkdir -p obj_glibc
mkdir -p -m755 stage%prefix/bin
mkdir -p -m755 stage1%prefix/bin
save_PATH="$PATH"
export PATH=`pwd`/stage1%prefix/bin:$PATH
if [ -d "/usr/lib/ccache" ]; then
export PATH=`pwd`/stage1%prefix/bin:/usr/lib/ccache:$PATH
else
export PATH=`pwd`/stage1%prefix/bin:$PATH
fi
stagedir=`pwd`/stage
stage1dir=`pwd`/stage1
@ -195,7 +207,9 @@ cd obj_binutils
--with-build-sysroot=${stagedir}%sysroot \
--with-system-zlib \
--enable-plugins \
%if "%target_arch" != "loongarch64"
--enable-gold=yes \
%endif
--enable-ld=default \
%if "%target_arch" != "mipsel"
--enable-64-bit-bfd \
@ -281,6 +295,9 @@ cd ../obj_glibc
--with-lib=${stagedir}%sysroot/usr/lib \
--disable-multilib \
--disable-crypt \
%if "%target_arch" == "loongarch64"
--disable-werror \
%endif
libc_cv_forced_unwind=yes \
%nil
@ -573,6 +590,7 @@ _start:
.section .note.GNU-stack,"",@progbits
EOF
%endif
env PATH=%buildroot%prefix/bin:$PATH \
%buildroot%prefix/bin/%target-gcc -static -nostdlib -o bye_asm bye.S || exit 11
@ -690,6 +708,9 @@ qemu-%target_qemu_arch-static ./bye_asm || exit 13
%changelog
* Mon Jan 30 2023 Alexey Sheplyakov <asheplyakov@altlinux.org> 20230130-alt1
- Added loongarch64 cross-toolchain
* Sun Jun 05 2022 Alexey Sheplyakov <asheplyakov@altlinux.org> 20220605-alt1
- Use slow 2-stage bootstrap to avoid a build failure with GCC 12