diff --git a/gcc.spec b/gcc.spec index 6d964ea..5429918 100644 --- a/gcc.spec +++ b/gcc.spec @@ -151,10 +151,22 @@ %global build_cross 0 %endif %global cross_targets aarch64-redhat-linux ppc64le-redhat-linux s390x-redhat-linux +# sysroot package support (taken from that for glibc). These contain +# arch-specific packages, so turn off the rpmbuild check. +%global _binaries_in_noarch_packages_terminate_build 0 +# Variant of %%dist that contains just the distribution release, no affixes. +%{?fedora:%global sysroot_dist fc%{fedora}} +%{?rhel:%global sysroot_dist el%{rhel}} +%{?!sysroot_dist:%global sysroot_dist root} +# The name of the sysroot package (suffixed with a library name). +%global sysroot_package_arch sysroot-%{_arch}-%{sysroot_dist} +# Installed path for the sysroot tree. Must contain /sys-root/, which +# triggers filtering. +%global sysroot_prefix /usr/%{_arch}-redhat-linux/sys-root/%{sysroot_dist} Summary: Various compilers (C, C++, Objective-C, ...) Name: gcc Version: %{gcc_version} -Release: %{gcc_release}.3%{?dist}.alma.1 +Release: %{gcc_release}.4%{?dist}.alma.1 # License notes for some of the less obvious ones: # gcc/doc/cppinternals.texi: Linux-man-pages-copyleft-2-para # isl: MIT, BSD-2-Clause @@ -1021,6 +1033,66 @@ production use, and output binary artifacts should not be used in production. Generated binary artifacts contain binary annotations that mark them as cross compiled. +%package -n %{sysroot_package_arch}-libgcc +Summary: Sysroot package for libgcc, %{_arch} architecture +BuildArch: noarch +Provides: sysroot-%{_arch}-libgcc +# The files are not usable for execution, so do not provide nor +# require anything. +AutoReqProv: no + +%description -n %{sysroot_package_arch}-libgcc +This package contains development files for the libgcc package +that can be installed across architectures. + +%package -n %{sysroot_package_arch}-libgomp +Summary: Sysroot package for libgomp, %{_arch} architecture +BuildArch: noarch +Provides: sysroot-%{_arch}-libgomp +# The files are not usable for execution, so do not provide nor +# require anything. +AutoReqProv: no + +%description -n %{sysroot_package_arch}-libgomp +This package contains development files for the libgomp package +that can be installed across architectures. + +%package -n %{sysroot_package_arch}-libstdc++ +Summary: Sysroot package for libstdc++, %{_arch} architecture +BuildArch: noarch +Provides: sysroot-%{_arch}-libstdc++ +# The files are not usable for execution, so do not provide nor +# require anything. +AutoReqProv: no + +%description -n %{sysroot_package_arch}-libstdc++ +This package contains development files for the libstdc++ package +that can be installed across architectures. + +%package -n %{sysroot_package_arch}-libatomic +Summary: Sysroot package for libatomic, %{_arch} architecture +BuildArch: noarch +Provides: sysroot-%{_arch}-libatomic +# The files are not usable for execution, so do not provide nor +# require anything. +AutoReqProv: no + +%description -n %{sysroot_package_arch}-libatomic +This package contains development files for the libatomic package +that can be installed across architectures. + +%package -n %{sysroot_package_arch}-libitm +Summary: Sysroot package for libitm, %{_arch} architecture +BuildArch: noarch +Provides: sysroot-%{_arch}-libitm +# The files are not usable for execution, so do not provide nor +# require anything. +AutoReqProv: no + +%description -n %{sysroot_package_arch}-libitm +This package contains development files for the libitm package +that can be installed across architectures. + %prep %setup -q -n gcc-%{version}-%{DATE} -a 1 -a 2 -a 3 %patch -P0 -p0 -b .hack~ @@ -1826,6 +1898,9 @@ for crossarch in %{cross_targets}; do ;; esac + # The sysroot package cretion should copy the same files as + # referenced in these linker scripts to the sysroot package + # location. echo "/* GNU ld script Use the shared library, but some functions are only in the static library. */ @@ -2696,6 +2771,32 @@ ln -sf gcc-annobin.so.0.0.0 $FULLPATH/plugin/gcc-annobin.so.0 ln -sf gcc-annobin.so.0.0.0 $FULLPATH/plugin/gcc-annobin.so %endif +############################################################################### +# Sysroot package creation. +############################################################################### +mkdir -p %{buildroot}/%{sysroot_prefix} +pushd %{buildroot}/%{sysroot_prefix} +mkdir -p usr/lib usr/lib64 +ln -s usr/lib lib +ln -s usr/lib64 lib64 +# These match the files referenced in linker scripts generated for cross +# compilers. +for f in /lib64/libgcc_s.so.1 \ + %{_prefix}/lib64/libgomp.so.1 \ + %{_prefix}/lib64/libstdc++.so.6 \ + %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libstdc++.a \ + %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libsupc++.a \ + %{_prefix}/lib64/libatomic.so.1 \ + %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libatomic.a \ + %{_prefix}/lib64/libitm.so.1 \ + %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libitm.a; do + mkdir -p %{buildroot}/%{sysroot_prefix}/$(dirname $f) + cp %{buildroot}$f %{buildroot}/%{sysroot_prefix}/$f +done +mkdir -p usr/include +cp -a %{buildroot}%{_prefix}/include/c++ usr/include/c++ +popd + %check cd obj-%{gcc_target_platform} @@ -4134,11 +4235,37 @@ end %dnl build_cross %endif +%files -n %{sysroot_package_arch}-libgcc +# Package the symlinks into usr/ here. +%{sysroot_prefix}/lib +%{sysroot_prefix}/lib64 +%{sysroot_prefix}%{_prefix}/lib64/libgcc_s.so.1 + +%files -n %{sysroot_package_arch}-libgomp +%{sysroot_prefix}%{_prefix}/lib64/libgomp.so.1 + +%files -n %{sysroot_package_arch}-libstdc++ +%{sysroot_prefix}%{_prefix}/include/c++ +%{sysroot_prefix}%{_prefix}/lib64/libstdc++.so.6 +%{sysroot_prefix}%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libstdc++.a +%{sysroot_prefix}%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libsupc++.a + +%files -n %{sysroot_package_arch}-libatomic +%{sysroot_prefix}%{_prefix}/lib64/libatomic.so.1 +%{sysroot_prefix}%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libatomic.a + +%files -n %{sysroot_package_arch}-libitm +%{sysroot_prefix}%{_prefix}/lib64/libitm.so.1 +%{sysroot_prefix}%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/libitm.a + %changelog -* Sat Oct 18 2025 Eduard Abdullin - 14.3.1-2.3.alma.1 +* Wed Oct 29 2025 Eduard Abdullin - 14.3.1-2.4.alma.1 - Change to almalinux bugtracker - Set --with-arch_64=x86-64-v2 on v2 arch +* Wed Oct 22 2025 Joseph Myers - 14.3.1-2.4 +- add sysroot packages for use by non-production cross compilers (RHEL-118680) + * Thu Oct 16 2025 Marek Polacek 14.3.1-2.3 - add cross compilers for aarch64, ppc64le and s390x for non-production uses (RHEL-114519)