From b7316ba557e6e30e5f12f9ac8c797e947c8d8dca Mon Sep 17 00:00:00 2001 From: sergey-safarov Date: Mon, 26 Apr 2021 17:46:26 +0300 Subject: [PATCH] [Build-System] Use a fresher gcc on RHEL based dists --- freeswitch.spec | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/freeswitch.spec b/freeswitch.spec index 3bbc518119..a62776b1cc 100644 --- a/freeswitch.spec +++ b/freeswitch.spec @@ -170,6 +170,19 @@ Requires: zlib Requires: libxml2 Requires: libsndfile +%if 0%{?rhel} == 7 +# to build mariadb module required gcc >= 4.9 (more details GH #1046) +# On CentOS 7 dist you can install fresh gcc using command +# yum install centos-release-scl && yum install devtoolset-9 +BuildRequires: devtoolset-9 +%endif +%if 0%{?rhel} == 8 +# we want use fresh gcc on RHEL 8 based dists +# On CentOS 8 dist you can install fresh gcc using command +# dnf install gcc-toolset-9 +BuildRequires: gcc-toolset-9 +%endif + %if 0%{?suse_version} > 800 PreReq: %insserv_prereq %fillup_prereq %endif @@ -1575,6 +1588,16 @@ export DESTDIR=%{buildroot}/ export PKG_CONFIG_PATH=/usr/bin/pkg-config:$PKG_CONFIG_PATH export ACLOCAL_FLAGS="-I /usr/share/aclocal" +%if 0%{?rhel} == 7 +# to build mod_mariadb we need gcc >= 4.9 (more details GH #1046) +export CFLAGS="$CFLAGS -Wno-error=expansion-to-defined" +. /opt/rh/devtoolset-9/enable +%endif +%if 0%{?rhel} == 8 +# we want use fresh gcc on RHEL 8 based dists +. /opt/rh/gcc-toolset-9/enable +%endif + ###################################################################################################################### # # Bootstrap, Configure and Build the whole enchilada @@ -1635,6 +1658,15 @@ cd libs/esl # ###################################################################################################################### %install +%if 0%{?rhel} == 7 +# to build mod_mariadb we need gcc >= 4.9 +. /opt/rh/devtoolset-9/enable +%endif +%if 0%{?rhel} == 8 +# we want use fresh gcc on RHEL 8 based dists +. /opt/rh/gcc-toolset-9/enable +%endif + %{__make} DESTDIR=%{buildroot} install