%global gcc_toolset_root /opt/openEuler/gcc-toolset-7/root %global libstdcxx_soname libstdc++.so.6 %global libstdcxx_realname libstdc++.so.6.0.19 %global debug_package %{nil} %ifarch x86_64 %global source_archive %{SOURCE0} %global multiarch_dir x86_64-linux-gnu %global gcc_triplet x86_64-pc-linux-gnu %endif %ifarch aarch64 %global source_archive %{SOURCE1} %global multiarch_dir aarch64-linux-gnu %global gcc_triplet aarch64-unknown-linux-gnu %endif Name: ai-toolset-libstdc++ Version: 4.8.5 Release: 45 Summary: Extract EL7 libstdc++ runtime for gcc-toolset-7 sysroot License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ with exceptions URL: https://gcc.gnu.org/ # Put both tar.gz files into rpmbuild SOURCES. The package build selects the # matching one by target architecture. Source0: libstdc++-4.8.5-44.el7.x86_64.tar.gz Source1: libstdc++-4.8.5-44.el7.aarch64.tar.gz ExclusiveArch: x86_64 aarch64 BuildRequires: gzip BuildRequires: tar # The extracted EL7 library is private to %%{gcc_toolset_root}. Do not # let RPM dependency generators advertise it as the system libstdc++ provider. AutoReqProv: no Provides: bundled(libstdc++) = %{version}-%{release} %description This package extracts libstdc++.so.6.0.19 from the EL7 libstdc++ archive and installs it into the gcc-toolset-7 sysroot layout used on openEuler 24.03. %prep rm -rf extract-root mkdir -p extract-root tar -xzf "%{source_archive}" -C extract-root \ './usr/lib64/%{libstdcxx_realname}' %build # Nothing to build. This package only repackages the runtime library. %install rm -rf %{buildroot} install -d -m 0755 \ %{buildroot}%{gcc_toolset_root}/usr/lib/%{multiarch_dir} \ %{buildroot}%{gcc_toolset_root}/usr/lib/gcc/%{gcc_triplet}/7 install -m 0755 \ extract-root/usr/lib64/%{libstdcxx_realname} \ %{buildroot}%{gcc_toolset_root}/usr/lib/%{multiarch_dir}/%{libstdcxx_realname} ln -s %{libstdcxx_realname} \ %{buildroot}%{gcc_toolset_root}/usr/lib/%{multiarch_dir}/%{libstdcxx_soname} # gcc-toolset-7 expects the GCC private directory to contain the # old runtime as libstdc++.so.6. Install a real file here to match the script's # final copy behavior. install -m 0755 \ extract-root/usr/lib64/%{libstdcxx_realname} \ %{buildroot}%{gcc_toolset_root}/usr/lib/gcc/%{gcc_triplet}/7/%{libstdcxx_soname} %files %dir /opt/openEuler %dir /opt/openEuler/gcc-toolset-7 %dir %{gcc_toolset_root} %dir %{gcc_toolset_root}/usr %dir %{gcc_toolset_root}/usr/lib %dir %{gcc_toolset_root}/usr/lib/%{multiarch_dir} %{gcc_toolset_root}/usr/lib/%{multiarch_dir}/%{libstdcxx_realname} %{gcc_toolset_root}/usr/lib/%{multiarch_dir}/%{libstdcxx_soname} %dir %{gcc_toolset_root}/usr/lib/gcc %dir %{gcc_toolset_root}/usr/lib/gcc/%{gcc_triplet} %dir %{gcc_toolset_root}/usr/lib/gcc/%{gcc_triplet}/7 %{gcc_toolset_root}/usr/lib/gcc/%{gcc_triplet}/7/%{libstdcxx_soname} %changelog * Thu May 28 2026 Example Maintainer - 4.8.5-44 - Extract EL7 libstdc++.so.6.0.19 into gcc-toolset-7 sysroot for openEuler 24.03