Blame SPECS/gcc-toolset-12.spec

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