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
0972c3
Release: 1%{?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
0972c3
# The base package requires just the toolchain and the perftools.
0972c3
Requires: %{scl_prefix}toolchain %{scl_prefix}perftools
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
%package toolchain
0972c3
Summary: Package shipping basic toolchain applications
0972c3
Group: Applications/File
0972c3
Requires: %{scl_prefix}runtime
0972c3
Requires: %{scl_prefix}gcc %{scl_prefix}gcc-c++ %{scl_prefix}gcc-gfortran
0972c3
Requires: %{scl_prefix}binutils %{scl_prefix}gdb %{scl_prefix}strace
0972c3
Requires: %{scl_prefix}dwz %{scl_prefix}elfutils
0972c3
Requires: %{scl_prefix}ltrace %{scl_prefix}make
0972c3
Requires: %{scl_prefix}annobin
0972c3
%if 0%{?rhel} <= 7
0972c3
Requires: %{scl_prefix}memstomp
0972c3
%endif
0972c3
Obsoletes: %{name}-toolchain < %{version}-%{release}
0972c3
0972c3
%description toolchain
0972c3
Package shipping basic toolchain applications (compiler, debugger, ...)
0972c3
0972c3
%package perftools
0972c3
Summary: Package shipping performance tools
0972c3
Group: Applications/File
0972c3
Requires: %{scl_prefix}runtime
0972c3
Requires: %{scl_prefix}systemtap %{scl_prefix}valgrind
0972c3
%if 0%{?rhel} <= 7
0972c3
Requires: %{scl_prefix}oprofile
0972c3
%ifarch x86_64
0972c3
Requires: %{scl_prefix}dyninst
0972c3
%endif
0972c3
%else
0972c3
%ifarch x86_64 ppc64le aarch64
0972c3
Requires: %{scl_prefix}dyninst
0972c3
%endif
0972c3
%endif
0972c3
Obsoletes: %{name}-perftools < %{version}-%{release}
0972c3
0972c3
%description perftools
0972c3
%if 0%{?rhel} <= 7
0972c3
Package shipping performance tools (systemtap, oprofile)
0972c3
%else
0972c3
Package shipping performance tools (systemtap)
0972c3
%endif
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}}
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
  dynpath32="\$rpmlibdir32/dyninst"
0972c3
  rpmlibdir64=
0972c3
  dynpath64=
0972c3
else
0972c3
  rpmlibdir64=":%{_scl_root}\${rpmlibdir/lib/lib64}"
0972c3
  dynpath64="\$rpmlibdir64/dyninst"
0972c3
  rpmlibdir32=
0972c3
  dynpath32=
0972c3
fi
0972c3
# Add SCL dyninst to LD_LIBRARY_PATH, both 64- and 32-bit paths.
0972c3
export LD_LIBRARY_PATH=%{_scl_root}\$rpmlibdir/dyninst\$dynpath64\$dynpath32\${LD_LIBRARY_PATH:+:\${LD_LIBRARY_PATH}}
0972c3
# Now 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.
0972c3
cat >> %{buildroot}%{_root_sysconfdir}/rpm/macros.%{scl}-config << 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
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
0972c3
%{_root_sysconfdir}/rpm/macros.%{scl}*
0972c3
0972c3
%files toolchain
0972c3
0972c3
%files perftools
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
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)