Splitted cross-toolchain into subpackages

This commit is contained in:
Alexey Sheplyakov 2021-06-15 14:55:40 +00:00
parent 9c00a756fe
commit 096e3c14d6

View File

@ -1,20 +1,25 @@
%define target aarch64-linux-gnu
%define target_arch aarch64
%define target_kernel arm64
%define target_qemu_arch aarch64
%define target %target_arch-linux-gnu
%define gcc_branch 8
%define gcc_version 8.4.1
%define gcc_source_version_timestamp 20200305
%define orig_gcc_release alt0.p9.1
Name: cross-gcc%gcc_branch-%target
Version: 8.4.1
Release: alt1
Version: %gcc_version
ExclusiveArch: x86_64
%define gcc_source_version_timestamp 20200305
%define orig_gcc_release alt0.p9.1
%define binutils_version 2.31.1
%define binutils_evr 1:%binutils_version-alt4
%define glibc_evr 2.27-alt13
%define glibc_version 2.27
%define glibc_release alt13
%define glibc_evr %glibc_version-%glibc_release
%define kernel_version 5.4
%define sysroot %prefix/lib/%target/sys-root
@ -29,20 +34,39 @@ BuildPreReq: libmpc-devel libmpfr-devel libgmp-devel zlib-devel
BuildPreReq: coreutils flex bison makeinfo findutils
# Linux' headers_install uses rsync
BuildPreReq: rsync
BuildRequires: gcc-source = %version-%orig_gcc_release
BuildRequires: gcc-source = %gcc_version-%orig_gcc_release
BuildRequires: binutils-source = %binutils_evr
BuildRequires: glibc-source = %glibc_evr
BuildRequires: kernel-source-%kernel_version
BuildRequires: qemu-user-static-%target_qemu_arch
Requires: cross-binutils-%target = %binutils_version
Requires: cross-glibc-%target = %glibc_version
%define _libexecdir /usr/libexec
%description
aarch64-targeted GCC cross-toolchain
%target_arch-targeted GCC cross-compiler
%package -n cross-binutils-%target
Version: %binutils_version
Summary: %target_arch-targeted binutils (linker, assembler, etc)
Group: Development/C
%description -n cross-binutils-%target
%target_arch-targeted binutils (linker, assembler, objdump, etc)
%package -n cross-glibc-%target
Version: %glibc_version
Summary: %target_arch-targeted cross-glibc
Group: Development/C
%description -n cross-glibc-%target
glibc for %target_arch. Should be used for cross-compilation only
%prep
%setup -cT
tar -xf /usr/src/gcc-source/gcc-%version-%gcc_source_version_timestamp.tar
tar -xf /usr/src/gcc-source/gcc-%gcc_version-%gcc_source_version_timestamp.tar
tar -xf /usr/src/binutils-source/binutils-%binutils_version.tar
tar -xf /usr/src/kernel/sources/kernel-source-%kernel_version.tar
tar -xf /usr/src/glibc-source/glibc-%glibc_evr.tar
@ -95,7 +119,7 @@ cd obj_binutils
# N.B.: this builds GCC in a single stage (but not all target at once)
cd ../obj_gcc
# XXX: avoid %%configure puts $target libraries in /usr/lib64
../gcc-%version-%gcc_source_version_timestamp/configure \
../gcc-%gcc_version-%gcc_source_version_timestamp/configure \
--target=%target \
--host=%{_configure_platform} \
--build=%{_configure_platform} \
@ -305,9 +329,23 @@ env PATH=%buildroot%prefix/bin:$PATH \
qemu-%target_qemu_arch-static ./bye_asm || exit 13
%files
%_bindir/*
%_bindir/%target-gcc*
%_bindir/%target-cpp
%_bindir/%target-g++
%_bindir/%target-c++
%_bindir/%target-gcov*
%prefix/lib/gcc/%target/%gcc_branch/*
%prefix/libexec/gcc/%target/*
%exclude %prefix/libexec/gcc/%target/bin/*
%exclude %prefix/libexec/gcc/%target/lib/*
%prefix/share/man/man1/aarch64-linux-gnu-cpp*
%prefix/share/man/man1/aarch64-linux-gnu-g++*
%prefix/share/man/man1/aarch64-linux-gnu-gcc*
%prefix/share/man/man1/aarch64-linux-gnu-gcov-dump*
%prefix/share/man/man1/aarch64-linux-gnu-gcov-tool*
%prefix/share/man/man1/aarch64-linux-gnu-gcov*
%files -n cross-glibc-%target
%sysroot/usr/include/*
# XXX: gcc needs %%sysroot/usr/lib to locate C runtime (crt1.o)
%sysroot/usr/lib
@ -315,8 +353,29 @@ qemu-%target_qemu_arch-static ./bye_asm || exit 13
%sysroot/usr/lib64/*
# Compatibility symlink to ld.so
%sysroot/lib/*
# man pages of binaries in /usr/bin
%prefix/share/man/man1/%target-*
%files -n cross-binutils-%target
%_bindir/%target-addr2line
%_bindir/%target-ar
%_bindir/%target-as
%_bindir/%target-c++filt
%_bindir/%target-dwp
%_bindir/%target-elfedit
%_bindir/%target-gprof
%_bindir/%target-ld
%_bindir/%target-ld.bfd
%_bindir/%target-ld.gold
%_bindir/%target-nm
%_bindir/%target-objcopy
%_bindir/%target-objdump
%_bindir/%target-ranlib
%_bindir/%target-readelf
%_bindir/%target-size
%_bindir/%target-strings
%_bindir/%target-strip
# gcc_tooldir
%prefix/libexec/gcc/%target/bin/*
%prefix/libexec/gcc/%target/lib/*
%changelog
* Fri Jun 11 2021 Alexey Sheplyakov <asheplyakov@altlinux.org> 8.4.1-alt1