Blame SPECS/gcc-toolset-12.spec

4da3a3
%global __python /usr/bin/python3
4da3a3
%global scl gcc-toolset-12
4da3a3
%scl_package %scl
4da3a3
4da3a3
Summary: Package that installs %scl
4da3a3
Name: %scl_name
4da3a3
Version: 12.0
d86d49
Release: 6%{?dist}
4da3a3
License: GPLv2+
4da3a3
Group: Applications/File
4da3a3
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
4da3a3
Source0: README
4da3a3
Source1: sudo.sh
d86d49
Source2: gts-annobin-plugin-select.sh
4da3a3
4da3a3
Requires: %{scl_prefix}runtime
4da3a3
Requires: %{scl_prefix}gcc %{scl_prefix}gcc-c++ %{scl_prefix}gcc-gfortran
4da3a3
Requires: %{scl_prefix}binutils
4da3a3
Requires: %{scl_prefix}gdb
4da3a3
Requires: %{scl_prefix}dwz
4da3a3
Requires: %{scl_prefix}annobin-plugin-gcc
4da3a3
Obsoletes: %{name} < %{version}-%{release}
4da3a3
Obsoletes: %{scl_prefix}dockerfiles < %{version}-%{release}
4da3a3
4da3a3
BuildRequires: scl-utils-build >= 20120927-11
4da3a3
BuildRequires: iso-codes
4da3a3
BuildRequires: help2man
4da3a3
%if 0%{?rhel} >= 8
4da3a3
BuildRequires: python3-devel
4da3a3
%endif
4da3a3
d86d49
%global rrcdir %{_scl_root}/usr/lib/rpm/redhat
d86d49
4da3a3
%description
4da3a3
This is the main package for %scl Software Collection.
4da3a3
4da3a3
%package runtime
4da3a3
Summary: Package that handles %scl Software Collection.
4da3a3
Group: Applications/File
4da3a3
Requires: scl-utils >= 20120927-11
4da3a3
Obsoletes: %{name}-runtime < %{version}-%{release}
4da3a3
%if 0%{?rhel} >= 7
4da3a3
Requires(post): %{_root_sbindir}/semanage %{_root_sbindir}/restorecon
4da3a3
Requires(postun): %{_root_sbindir}/semanage %{_root_sbindir}/restorecon
4da3a3
%else
4da3a3
Requires(post): libselinux policycoreutils-python
4da3a3
Requires(postun): libselinux policycoreutils-python
4da3a3
%endif
4da3a3
4da3a3
%description runtime
4da3a3
Package shipping essential scripts to work with %scl Software Collection.
4da3a3
4da3a3
%package build
4da3a3
Summary: Package shipping basic build configuration
4da3a3
Group: Applications/File
4da3a3
Requires: %{scl_prefix}runtime
4da3a3
Requires: scl-utils-build >= 20120927-11
4da3a3
Obsoletes: %{name}-build < %{version}-%{release}
4da3a3
4da3a3
%description build
4da3a3
Package shipping essential configuration macros to build %scl Software Collection.
4da3a3
4da3a3
%prep
4da3a3
%setup -c -T
4da3a3
4da3a3
# This section generates README file from a template and creates man page
4da3a3
# from that file, expanding RPM macros in the template file.
4da3a3
cat <<'EOF' | tee README
4da3a3
%{expand:%(cat %{SOURCE0})}
4da3a3
EOF
4da3a3
4da3a3
%build
4da3a3
4da3a3
# Temporary helper script used by help2man.
4da3a3
cat <<\EOF | tee h2m_helper
4da3a3
#!/bin/sh
4da3a3
if [ "$1" = "--version" ]; then
4da3a3
  printf '%%s' "%{?scl_name} %{version} Software Collection"
4da3a3
else
4da3a3
  cat README
4da3a3
fi
4da3a3
EOF
4da3a3
chmod a+x h2m_helper
4da3a3
# Generate the man page.
4da3a3
help2man -N --section 7 ./h2m_helper -o %{?scl_name}.7
4da3a3
4da3a3
# Enable collection script
4da3a3
# ========================
4da3a3
cat <<EOF >enable
4da3a3
# General environment variables
4da3a3
export PATH=%{_bindir}\${PATH:+:\${PATH}}
4da3a3
export MANPATH=%{_mandir}\${MANPATH:+:\${MANPATH}}
4da3a3
export INFOPATH=%{_infodir}\${INFOPATH:+:\${INFOPATH}}
4da3a3
# ??? We probably don't need this anymore.
4da3a3
export PCP_DIR=%{_scl_root}
4da3a3
# bz847911 workaround:
4da3a3
# we need to evaluate rpm's installed run-time % { _libdir }, not rpmbuild time
4da3a3
# or else /etc/ld.so.conf.d files?
4da3a3
rpmlibdir=\$(rpm --eval "%%{_libdir}")
4da3a3
# bz1017604: On 64-bit hosts, we should include also the 32-bit library path.
4da3a3
# bz1873882: On 32-bit hosts, we should include also the 64-bit library path.
4da3a3
# bz2027377: Avoid unbound variables
4da3a3
if [ "\$rpmlibdir" != "\${rpmlibdir/lib64/}" ]; then
4da3a3
  rpmlibdir32=":%{_scl_root}\${rpmlibdir/lib64/lib}"
4da3a3
  rpmlibdir64=
4da3a3
else
4da3a3
  rpmlibdir64=":%{_scl_root}\${rpmlibdir/lib/lib64}"
4da3a3
  rpmlibdir32=
4da3a3
fi
4da3a3
# Prepend the usual /opt/.../usr/lib{64,}.
4da3a3
export LD_LIBRARY_PATH=%{_scl_root}\$rpmlibdir\$rpmlibdir64\$rpmlibdir32\${LD_LIBRARY_PATH:+:\${LD_LIBRARY_PATH}}
4da3a3
export PKG_CONFIG_PATH=%{_libdir}/pkgconfig\${PKG_CONFIG_PATH:+:\${PKG_CONFIG_PATH}}
4da3a3
EOF
4da3a3
4da3a3
# Sudo script
4da3a3
# ===========
4da3a3
cat <<'EOF' > sudo
4da3a3
%{expand:%(cat %{SOURCE1})}
4da3a3
EOF
4da3a3
4da3a3
%install
4da3a3
(%{scl_install})
4da3a3
4da3a3
# This allows users to build packages using DTS/GTS.
4da3a3
cat >> %{buildroot}%{_root_sysconfdir}/rpm/macros.%{scl}-enable << EOF
4da3a3
%%enable_devtoolset12 %%global ___build_pre %%{___build_pre}; source scl_source enable %{scl} || :
4da3a3
EOF
4da3a3
4da3a3
mkdir -p %{buildroot}%{_scl_root}/etc/alternatives %{buildroot}%{_scl_root}/var/lib/alternatives
4da3a3
4da3a3
install -d -m 755 %{buildroot}%{_scl_scripts}
4da3a3
install -p -m 755 enable %{buildroot}%{_scl_scripts}/
4da3a3
4da3a3
install -d -m 755 %{buildroot}%{_scl_scripts}
4da3a3
install -p -m 755 sudo %{buildroot}%{_bindir}/
4da3a3
4da3a3
# Other directories that should be owned by the runtime
4da3a3
install -d -m 755 %{buildroot}%{_datadir}/appdata
4da3a3
# Otherwise unowned perl directories
4da3a3
install -d -m 755 %{buildroot}%{_libdir}/perl5
4da3a3
install -d -m 755 %{buildroot}%{_libdir}/perl5/vendor_perl
4da3a3
install -d -m 755 %{buildroot}%{_libdir}/perl5/vendor_perl/auto
4da3a3
4da3a3
# Install generated man page.
4da3a3
install -d -m 755 %{buildroot}%{_mandir}/man7
4da3a3
install -p -m 644 %{?scl_name}.7 %{buildroot}%{_mandir}/man7/
4da3a3
d86d49
# Install the plugin selector trigger script.
d86d49
mkdir -p %{buildroot}%{rrcdir}
d86d49
install -p -m 755 %{SOURCE2} %{buildroot}%{rrcdir}/
d86d49
d86d49
# This trigger is used to decide which version of the annobin plugin for gcc
d86d49
# should be used.  See comments in the script for full details.
d86d49
d86d49
%triggerin runtime -- %{scl_prefix}annobin-plugin-gcc %{scl_prefix}gcc-plugin-annobin
d86d49
%{rrcdir}/gts-annobin-plugin-select.sh %{_scl_root}
d86d49
%end
d86d49
d86d49
# We also trigger when annobin is uninstalled.  This allows us to switch
d86d49
# over to the gcc generated version of the plugin.  It does not matter if
d86d49
# gcc is uninstalled, since if that happens the plugin cannot be used.
d86d49
d86d49
%triggerpostun runtime -- %{scl_prefix}annobin-plugin-gcc
d86d49
%{rrcdir}/gts-annobin-plugin-select.sh %{_scl_root}
d86d49
%end
d86d49
4da3a3
%files
4da3a3
%doc README
4da3a3
%{_mandir}/man7/%{?scl_name}.*
4da3a3
4da3a3
%files runtime
d86d49
%attr(0755,-,-) %{rrcdir}/gts-annobin-plugin-select.sh
4da3a3
%scl_files
4da3a3
%{_root_sysconfdir}/rpm/macros.%{scl}-enable
4da3a3
%attr(0644,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) %{_sysconfdir}/selinux-equiv.created
4da3a3
%dir %{_scl_root}/etc/alternatives
4da3a3
%dir %{_datadir}/appdata
4da3a3
4da3a3
%files build
4da3a3
%{_root_sysconfdir}/rpm/macros.%{scl}-config
4da3a3
4da3a3
%post runtime
4da3a3
if [ ! -f %{_sysconfdir}/selinux-equiv.created ]; then
4da3a3
  /usr/sbin/semanage fcontext -a -e / %{_scl_root}
4da3a3
  restorecon -R %{_scl_root}
4da3a3
  touch %{_sysconfdir}/selinux-equiv.created
4da3a3
fi
4da3a3
4da3a3
%preun runtime
4da3a3
[ $1 = 0 ] && rm -f %{_sysconfdir}/selinux-equiv.created || :
4da3a3
4da3a3
%postun runtime
4da3a3
if [ $1 = 0 ]; then
4da3a3
  /usr/sbin/semanage fcontext -d %{_scl_root}
4da3a3
  [ -d %{_scl_root} ] && restorecon -R %{_scl_root} || :
4da3a3
fi
4da3a3
4da3a3
%changelog
d86d49
* Mon Dec 05 2022 Nick Clifton  <nickc@redhat.com> - 12.0-6
d86d49
- Use triggers to select which version of the annobin plugin should be used.  (#2111976)
d86d49
4da3a3
* Wed Jun 29 2022 Marek Polacek <polacek@redhat.com> - 12.0-5
4da3a3
- require -annobin-plugin-gcc (#2102356)
4da3a3
4da3a3
* Mon Jun 13 2022 Marek Polacek <polacek@redhat.com> - 12.0-4
4da3a3
- NVR bump and rebuild
4da3a3
4da3a3
* Fri May 27 2022 Marek Polacek <polacek@redhat.com> - 12.0-3
4da3a3
- use rpm/macros.%{scl}-enable for %enable_devtoolset12 and put it in
4da3a3
  the -runtime subpackage (#2009528)
4da3a3
4da3a3
* Fri May 27 2022 Marek Polacek <polacek@redhat.com> - 12.0-2
4da3a3
- cut down the required packages, remove -toolchain and -perftools
4da3a3
4da3a3
* Mon May 16 2022 Martin Cermak <mcermak@redhat.com> - 12.0-1
4da3a3
- NVR bump and rebuild, introduce CI gating setup
4da3a3
4da3a3
* Tue May 10 2022 Marek Polacek <polacek@redhat.com> - 12.0-0
4da3a3
- new package (#2077277)