Don't hard-code {gcc,glibc,binutils}-source versions

This commit is contained in:
Alexey Sheplyakov 2021-08-04 19:18:39 +04:00
parent 85c770e81e
commit b93316f976

View File

@ -4,56 +4,60 @@
%define target_qemu_arch aarch64 %define target_qemu_arch aarch64
%define target %target_arch-linux-gnu %define target %target_arch-linux-gnu
%define gcc_branch 10
%define gcc_version 10.3.1
%define gcc_source_version_timestamp 20200305
Name: gcc-%target Name: cross-toolchain-%target
Version: %gcc_version Version: 1.0.0
Release: alt1 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
Group: Development/C
ExclusiveArch: x86_64 ExclusiveArch: x86_64
%define binutils_version 2.35.2 %define gcc_version %{get_version gcc-source}
%define binutils_evr 1:%binutils_version-alt2 %define gcc_branch %(v=%gcc_version; v=${v%%%%.*}; echo $v)
%define glibc_version 2.32 %define binutils_version %{get_version binutils-source}
%define glibc_release alt4 %define glibc_version %{get_version glibc-source}
%define glibc_evr 6:%glibc_version-%glibc_release
%define kernel_version 5.10 %define kernel_version 5.10
%define sysroot %prefix/lib/%target/sys-root %define sysroot %prefix/lib/%target/sys-root
%define target_ld_linux /lib64/ld-linux-aarch64.so.1 %define target_ld_linux /lib64/ld-linux-aarch64.so.1
Summary: %target_arch-targeted GCC cross-toolchain
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
Group: Development/C
BuildPreReq: gcc-c++ BuildPreReq: gcc-c++
BuildPreReq: libmpc-devel libmpfr-devel libgmp-devel zlib-devel BuildPreReq: libmpc-devel libmpfr-devel libgmp-devel zlib-devel
BuildPreReq: coreutils flex bison makeinfo findutils BuildPreReq: coreutils flex bison makeinfo findutils
# Linux' headers_install uses rsync # Linux' headers_install uses rsync
BuildPreReq: rsync BuildPreReq: rsync
BuildRequires: gcc-source = %gcc_version BuildRequires(pre): gcc-source
BuildRequires: binutils-source = %binutils_evr BuildRequires(pre): binutils-source
BuildRequires: glibc-source = %glibc_evr BuildRequires(pre): glibc-source
BuildRequires: kernel-source-%kernel_version BuildPreReq: kernel-source-%kernel_version
BuildRequires: qemu-user-static-%target_qemu_arch BuildRequires: qemu-user-static-%target_qemu_arch
BuildRequires: python3 BuildRequires: python3
%description
GCC cross-toolchain for %target
%define _libexecdir /usr/libexec
%package -n gcc-%target
Version: %gcc_version
Summary: %target_arch-targeted GCC cross-compiler
Group: Development/C
Requires: gcc-%target-static = %gcc_version Requires: gcc-%target-static = %gcc_version
Requires: binutils-%target = %binutils_version Requires: binutils-%target = %binutils_version
Requires: cross-glibc-%target_arch = %glibc_version Requires: cross-glibc-%target_arch = %glibc_version
%define _libexecdir /usr/libexec %description -n gcc-%target
%description
%target_arch-targeted GCC cross-compiler %target_arch-targeted GCC cross-compiler
%package static %package -n gcc-%target-static
Version: %gcc_version
Summary: %target_arch-targeted GCC cross-compiler, static libraries Summary: %target_arch-targeted GCC cross-compiler, static libraries
Group: Development/C Group: Development/C
%description static %description -n gcc-%target-static
%target_arch-targeted GCC cross-compiler, static libraries %target_arch-targeted GCC cross-compiler, static libraries
%package -n binutils-%target %package -n binutils-%target
@ -351,7 +355,7 @@ env PATH=%buildroot%prefix/bin:$PATH \
%buildroot%prefix/bin/%target-gcc -static -nostdlib -o bye_asm bye.S || exit 11 %buildroot%prefix/bin/%target-gcc -static -nostdlib -o bye_asm bye.S || exit 11
qemu-%target_qemu_arch-static ./bye_asm || exit 13 qemu-%target_qemu_arch-static ./bye_asm || exit 13
%files %files -n gcc-%target
%_bindir/%target-gcc* %_bindir/%target-gcc*
%_bindir/%target-cpp %_bindir/%target-cpp
%_bindir/%target-g++ %_bindir/%target-g++
@ -375,7 +379,7 @@ qemu-%target_qemu_arch-static ./bye_asm || exit 13
%prefix/share/man/man1/aarch64-linux-gnu-gcov-tool* %prefix/share/man/man1/aarch64-linux-gnu-gcov-tool*
%prefix/share/man/man1/aarch64-linux-gnu-gcov* %prefix/share/man/man1/aarch64-linux-gnu-gcov*
%files static %files -n gcc-%target-static
%prefix/lib/gcc/%target/%gcc_branch/libatomic.a %prefix/lib/gcc/%target/%gcc_branch/libatomic.a
%prefix/lib/gcc/%target/%gcc_branch/libgomp.a %prefix/lib/gcc/%target/%gcc_branch/libgomp.a
%prefix/lib/gcc/%target/%gcc_branch/libitm.a %prefix/lib/gcc/%target/%gcc_branch/libitm.a