Blame SPECS/gcc-toolset-12.spec

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