icinga2.spec: Update RedHat SCL handling for builds on el 5 and 6

So you don't have to modify the environment.

Signed-off-by: Michael Friedrich <michael.friedrich@icinga.com>

fixes #5177
This commit is contained in:
Markus Frosch 2017-04-24 17:25:02 +02:00 committed by Michael Friedrich
parent 4a1186d46f
commit 712c526e31
2 changed files with 16 additions and 8 deletions

View File

@ -148,14 +148,15 @@ C++11 features.
gpgcheck=0
REPO
yum install -y devtoolset-2-gcc devtoolset-2-gcc-c++ devtoolset-2-binutils
Dependencies to devtools-2 are used in the RPM SPEC, so the correct tools
should be used for building.
export LD_LIBRARY_PATH=/opt/rh/devtoolset-2/root/usr/lib:$LD_LIBRARY_PATH
export PATH=/opt/rh/devtoolset-2/root/usr/bin:$PATH
ln -sf /opt/rh/devtoolset-2/root/usr/bin/ld.bfd /opt/rh/devtoolset-2/root/usr/bin/ld
for file in `find /opt/rh/devtoolset-2/root/usr/include/c++ -name c++config.h`; do
echo '#define _GLIBCXX__PTHREADS' >> $file
done
As an alternative, you can use newer Boost packages provided on
[packages.icinga.com](https://packages.icinga.com/epel).
cat >$HOME/.rpmmacros <<MACROS
%build_icinga_org 1
MACROS
#### SLES 11

View File

@ -97,8 +97,15 @@ BuildRequires: gcc48-c++
BuildRequires: libstdc++48-devel
BuildRequires: libopenssl1-devel
%else
%if "%{_vendor}" == "redhat" && (0%{?el5} || 0%{?rhel} == 5 || "%{?dist}" == ".el5" || 0%{?el6} || 0%{?rhel} == 6 || "%{?dist}" == ".el6")
# Requires devtoolset-2 scl
BuildRequires: devtoolset-2-gcc-c++
BuildRequires: devtoolset-2-libstdc++-devel
%define scl_enable scl enable devtoolset-2 --
%else
BuildRequires: gcc-c++
BuildRequires: libstdc++-devel
%endif
BuildRequires: openssl-devel
%endif
BuildRequires: cmake
@ -332,7 +339,7 @@ CMAKE_OPTS="$CMAKE_OPTS -DICINGA2_PLUGINDIR=%{_prefix}/lib/nagios/plugins"
CMAKE_OPTS="$CMAKE_OPTS -DUSE_SYSTEMD=ON"
%endif
cmake $CMAKE_OPTS -DCMAKE_C_FLAGS:STRING="%{optflags} %{?march_flag}" -DCMAKE_CXX_FLAGS:STRING="%{optflags} %{?march_flag}" .
%{?scl_enable} cmake $CMAKE_OPTS -DCMAKE_C_FLAGS:STRING="%{optflags} %{?march_flag}" -DCMAKE_CXX_FLAGS:STRING="%{optflags} %{?march_flag}" .
make %{?_smp_mflags}