Blame SPECS/gcc-toolset-12.spec

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