Blame SPECS/gcc-toolset-12.spec

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