From 162a2ca87475875870f5d0e183deb85f7fc2fad6 Mon Sep 17 00:00:00 2001 From: FrostbyteGR Date: Tue, 30 Apr 2019 14:14:53 +0300 Subject: [PATCH 1/2] Add conditional build macros Works the same way by default, but now there are options. --- icinga2.spec | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 86 insertions(+), 1 deletion(-) diff --git a/icinga2.spec b/icinga2.spec index 9d03985..21be78f 100644 --- a/icinga2.spec +++ b/icinga2.spec @@ -61,6 +61,26 @@ %define icinga_group icinga %define icingacmd_group icingacmd +# enable unity builds by default for all architectures except arm32 +%ifarch %{arm} +%bcond_with unity_build +%else +%bcond_without unity_build +%endif + +%bcond_without lto_build +%bcond_with systemd_and_init +%bcond_without checker +%bcond_without compat +%bcond_with demo +%bcond_with hello +%bcond_without livestatus +%bcond_without notification +%bcond_without perfdata +%bcond_without tests +%bcond_without mysql +%bcond_without pgsql + %define logmsg logger -t %{name}/rpm %define boost_min_version 1.66 @@ -326,7 +346,6 @@ CMAKE_OPTS="-DCMAKE_INSTALL_PREFIX=/usr \ -DCMAKE_INSTALL_SYSCONFDIR=/etc \ -DCMAKE_INSTALL_LOCALSTATEDIR=/var \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \ - -DICINGA2_LTO_BUILD=ON \ -DCMAKE_VERBOSE_MAKEFILE=ON \ -DBoost_NO_BOOST_CMAKE=ON \ -DICINGA2_PLUGINDIR=%{plugindir} \ @@ -339,6 +358,72 @@ CMAKE_OPTS="-DCMAKE_INSTALL_PREFIX=/usr \ CMAKE_OPTS="$CMAKE_OPTS -DICINGA2_WITH_STUDIO=true" %endif +%if %{with unity_build} +CMAKE_OPTS="$CMAKE_OPTS -DICINGA2_UNITY_BUILD=ON" +%else +CMAKE_OPTS="$CMAKE_OPTS -DICINGA2_UNITY_BUILD=OFF" +%endif +%if %{with lto_build} +CMAKE_OPTS="$CMAKE_OPTS -DICINGA2_LTO_BUILD=ON" +%else +CMAKE_OPTS="$CMAKE_OPTS -DICINGA2_LTO_BUILD=OFF" +%endif +%if %{with systemd_and_init} +CMAKE_OPTS="$CMAKE_OPTS -DINSTALL_SYSTEMD_SERVICE_AND_INITSCRIPT=ON" +%else +CMAKE_OPTS="$CMAKE_OPTS -DINSTALL_SYSTEMD_SERVICE_AND_INITSCRIPT=OFF" +%endif +%if %{with checker} +CMAKE_OPTS="$CMAKE_OPTS -DICINGA2_WITH_CHECKER=ON" +%else +CMAKE_OPTS="$CMAKE_OPTS -DICINGA2_WITH_CHECKER=OFF" +%endif +%if %{with compat} +CMAKE_OPTS="$CMAKE_OPTS -DICINGA2_WITH_COMPAT=ON" +%else +CMAKE_OPTS="$CMAKE_OPTS -DICINGA2_WITH_COMPAT=OFF" +%endif +%if %{with demo} +CMAKE_OPTS="$CMAKE_OPTS -DICINGA2_WITH_DEMO=ON" +%else +CMAKE_OPTS="$CMAKE_OPTS -DICINGA2_WITH_DEMO=OFF" +%endif +%if %{with hello} +CMAKE_OPTS="$CMAKE_OPTS -DICINGA2_WITH_HELLO=ON" +%else +CMAKE_OPTS="$CMAKE_OPTS -DICINGA2_WITH_HELLO=OFF" +%endif +%if %{with livestatus} +CMAKE_OPTS="$CMAKE_OPTS -DICINGA2_WITH_LIVESTATUS=ON" +%else +CMAKE_OPTS="$CMAKE_OPTS -DICINGA2_WITH_LIVESTATUS=OFF" +%endif +%if %{with notification} +CMAKE_OPTS="$CMAKE_OPTS -DICINGA2_WITH_NOTIFICATION=ON" +%else +CMAKE_OPTS="$CMAKE_OPTS -DICINGA2_WITH_NOTIFICATION=OFF" +%endif +%if %{with perfdata} +CMAKE_OPTS="$CMAKE_OPTS -DICINGA2_WITH_PERFDATA=ON" +%else +CMAKE_OPTS="$CMAKE_OPTS -DICINGA2_WITH_PERFDATA=OFF" +%endif +%if %{with tests} +CMAKE_OPTS="$CMAKE_OPTS -DICINGA2_WITH_TESTS=ON" +%else +CMAKE_OPTS="$CMAKE_OPTS -DICINGA2_WITH_TESTS=OFF" +%endif +%if %{with mysql} +CMAKE_OPTS="$CMAKE_OPTS -DICINGA2_WITH_MYSQL=ON" +%else +CMAKE_OPTS="$CMAKE_OPTS -DICINGA2_WITH_MYSQL=OFF" +%endif +%if %{with pgsql} +CMAKE_OPTS="$CMAKE_OPTS -DICINGA2_WITH_PGSQL=ON" +%else +CMAKE_OPTS="$CMAKE_OPTS -DICINGA2_WITH_PGSQL=OFF" +%endif + %if (0%{?el6} || 0%{?rhel} == 6) # Explicitly link against rt, because ld doesn't detect it automatically CMAKE_OPTS="$CMAKE_OPTS -DCMAKE_EXE_LINKER_FLAGS=-lrt" From 8ead259fe7b5fdaacb73300dc204e698df6be4d9 Mon Sep 17 00:00:00 2001 From: FrostbyteGR Date: Tue, 30 Apr 2019 15:43:28 +0300 Subject: [PATCH 2/2] Fix icinga2.spec Remove irrelevant macros, fix %package and %file sections. --- icinga2.spec | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/icinga2.spec b/icinga2.spec index 21be78f..18eb242 100644 --- a/icinga2.spec +++ b/icinga2.spec @@ -70,10 +70,7 @@ %bcond_without lto_build %bcond_with systemd_and_init -%bcond_without checker %bcond_without compat -%bcond_with demo -%bcond_with hello %bcond_without livestatus %bcond_without notification %bcond_without perfdata @@ -245,6 +242,7 @@ Group: Documentation/Other This subpackage provides documentation for Icinga 2. +%if %{with mysql} %package ido-mysql Summary: IDO MySQL database backend for Icinga 2 Group: System/Monitoring @@ -263,8 +261,10 @@ Requires: %{name}-bin = %{version}-%{release} %description ido-mysql Icinga 2 IDO mysql database backend. Compatible with Icinga 1.x IDOUtils schema >= 1.12 +%endif +%if %{with pgsql} %package ido-pgsql Summary: IDO PostgreSQL database backend for Icinga 2 Group: System/Monitoring @@ -278,6 +278,7 @@ Requires: %{name}-bin = %{version}-%{release} %description ido-pgsql Icinga 2 IDO PostgreSQL database backend. Compatible with Icinga 1.x IDOUtils schema >= 1.12 +%endif %if 0%{?use_selinux} %global selinux_variants mls targeted @@ -373,26 +374,11 @@ CMAKE_OPTS="$CMAKE_OPTS -DINSTALL_SYSTEMD_SERVICE_AND_INITSCRIPT=ON" %else CMAKE_OPTS="$CMAKE_OPTS -DINSTALL_SYSTEMD_SERVICE_AND_INITSCRIPT=OFF" %endif -%if %{with checker} -CMAKE_OPTS="$CMAKE_OPTS -DICINGA2_WITH_CHECKER=ON" -%else -CMAKE_OPTS="$CMAKE_OPTS -DICINGA2_WITH_CHECKER=OFF" -%endif %if %{with compat} CMAKE_OPTS="$CMAKE_OPTS -DICINGA2_WITH_COMPAT=ON" %else CMAKE_OPTS="$CMAKE_OPTS -DICINGA2_WITH_COMPAT=OFF" %endif -%if %{with demo} -CMAKE_OPTS="$CMAKE_OPTS -DICINGA2_WITH_DEMO=ON" -%else -CMAKE_OPTS="$CMAKE_OPTS -DICINGA2_WITH_DEMO=OFF" -%endif -%if %{with hello} -CMAKE_OPTS="$CMAKE_OPTS -DICINGA2_WITH_HELLO=ON" -%else -CMAKE_OPTS="$CMAKE_OPTS -DICINGA2_WITH_HELLO=OFF" -%endif %if %{with livestatus} CMAKE_OPTS="$CMAKE_OPTS -DICINGA2_WITH_LIVESTATUS=ON" %else @@ -796,19 +782,23 @@ fi %{_datadir}/doc/%{name} %docdir %{_datadir}/doc/%{name} +%if %{with mysql} %files ido-mysql %defattr(-,root,root,-) %doc COPYING README.md NEWS AUTHORS CHANGELOG.md %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/features-available/ido-mysql.conf %{_libdir}/%{name}/libmysql_shim* %{_datadir}/icinga2-ido-mysql +%endif +%if %{with pgsql} %files ido-pgsql %defattr(-,root,root,-) %doc COPYING README.md NEWS AUTHORS CHANGELOG.md %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/features-available/ido-pgsql.conf %{_libdir}/%{name}/libpgsql_shim* %{_datadir}/icinga2-ido-pgsql +%endif %if 0%{?use_selinux} %files selinux