]> granicus.if.org Git - icinga2/blob - icinga2.spec
spec: Fix boost version requirement for OpenSUSE 13.1.
[icinga2] / icinga2.spec
1 #/******************************************************************************
2 # * Icinga 2                                                                   *
3 # * Copyright (C) 2012-present Icinga Development Team (http://www.icinga.org) *
4 # *                                                                            *
5 # * This program is free software; you can redistribute it and/or              *
6 # * modify it under the terms of the GNU General Public License                *
7 # * as published by the Free Software Foundation; either version 2             *
8 # * of the License, or (at your option) any later version.                     *
9 # *                                                                            *
10 # * This program is distributed in the hope that it will be useful,            *
11 # * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
12 # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
13 # * GNU General Public License for more details.                               *
14 # *                                                                            *
15 # * You should have received a copy of the GNU General Public License          *
16 # * along with this program; if not, write to the Free Software Foundation     *
17 # * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.             *
18 # ******************************************************************************/
19
20 %define revision 1
21
22 %if "%{_vendor}" == "redhat"
23 %define el5_boost_version 141
24 %define el5_boost_libs %{_libdir}/boost%{el5_boost_version}
25 %define el5_boost_includes /usr/include/boost%{el5_boost_version}
26 %define apachename httpd
27 %define apacheconfdir %{_sysconfdir}/httpd/conf.d
28 %define apacheuser apache
29 %define apachegroup apache
30 %endif
31 %if "%{_vendor}" == "suse"
32 # opensuse 13
33 %if 0%{?suse_version} >= 1310
34 %define opensuse_boost_version 1_53_0
35 %else
36 %define opensuse_boost_version 1_49_0
37 %endif
38 %define sles_boost_version 1_54_0
39 %define apachename apache2
40 %define apacheconfdir  %{_sysconfdir}/apache2/conf.d
41 %define apacheuser wwwrun
42 %define apachegroup www
43 %endif
44
45 %define icinga_user icinga
46 %define icinga_group icinga
47 %define icingacmd_group icingacmd
48
49 %define icingaclassicconfdir %{_sysconfdir}/icinga
50
51 %define logmsg logger -t %{name}/rpm
52
53 Summary: Network monitoring application
54 Name: icinga2
55 Version: 0.0.6
56 Release: %{revision}%{?dist}
57 License: GPLv2+
58 Group: Applications/System
59 Source: %{name}-%{version}.tar.gz
60 URL: http://www.icinga.org/
61 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
62
63 BuildRequires: doxygen
64 BuildRequires: openssl-devel
65 BuildRequires: gcc-c++
66 BuildRequires: libstdc++-devel
67 BuildRequires: cmake
68 BuildRequires: flex >= 2.5.35
69 BuildRequires: bison
70 BuildRequires: %{apachename}
71
72 # redhat
73 %if "%{_vendor}" == "redhat"
74 %if 0%{?el5} || 0%{?rhel} == 5 || "%{?dist}" == ".el5"
75 # el5 requires EPEL
76 BuildRequires: boost%{el5_boost_version}-devel
77 BuildRequires: boost%{el5_boost_version}
78 Requires: boost%{el5_boost_version}-program-options
79 Requires: boost%{el5_boost_version}-system
80 Requires: boost%{el5_boost_version}-test
81 Requires: boost%{el5_boost_version}-thread
82 Requires: boost%{el5_boost_version}-regex
83 %else
84 BuildRequires: boost-devel >= 1.41
85 Requires: boost-program-options >= 1.41
86 Requires: boost-system >= 1.41
87 Requires: boost-test >= 1.41
88 Requires: boost-thread >= 1.41
89 Requires: boost-regex >= 1.41
90 %endif
91 %endif
92 #redhat
93
94 # suse
95 %if "%{_vendor}" == "suse"
96 # sles
97 # note: sles_version macro is not set in SLES11 anymore
98 # note: sles service packs are not under version control
99 %if 0%{?suse_version} == 1110
100 BuildRequires: gcc-fortran
101 BuildRequires: libgfortran43
102 BuildRequires: boost-license%{sles_boost_version}
103 BuildRequires: boost-devel >= 1.41
104 Requires: boost-license%{sles_boost_version}
105 Requires: libboost_program_options%{sles_boost_version}
106 Requires: libboost_system%{sles_boost_version}
107 Requires: libboost_test%{sles_boost_version}
108 Requires: libboost_thread%{sles_boost_version}
109 Requires: libboost_regex%{sles_boost_version}
110 %endif
111 # opensuse
112 %if 0%{?suse_version} >= 1210
113 BuildRequires: boost-devel >= 1.41
114 Requires: libboost_program_options%{opensuse_boost_version}
115 Requires: libboost_system%{opensuse_boost_version}
116 Requires: libboost_test%{opensuse_boost_version}
117 Requires: libboost_thread%{opensuse_boost_version}
118 Requires: libboost_regex%{opensuse_boost_version}
119 %endif
120 %endif
121 # suse
122
123 Requires: %{name}-common = %{version}
124
125 %description
126 Icinga is a general-purpose network monitoring application.
127
128 %package common
129 Summary:      Common Icinga 2 configuration
130 Group:        Applications/System
131 %if "%{_vendor}" == "redhat"
132 Requires(pre): shadow-utils
133 Requires(post): shadow-utils
134 %endif
135
136 %description common
137 Provides common directories, uid and gid among Icinga 2 related
138 packages.
139
140
141 %package doc
142 Summary:      Documentation for Icinga 2
143 Group:        Applications/System
144 Requires:     %{name} = %{version}-%{release}
145
146 %description doc
147 Documentation for Icinga 2
148
149
150 %package ido-mysql
151 Summary:      IDO MySQL database backend for Icinga 2
152 Group:        Applications/System
153 %if "%{_vendor}" == "suse"
154 BuildRequires: libmysqlclient-devel
155 %if 0%{?suse_version} >= 1210
156 Requires: libmysqlclient18
157 %else
158 Requires: libmysqlclient15
159 %endif
160 %endif
161 %if "%{_vendor}" == "redhat"
162 # el5 only provides mysql package
163 %if 0%{?el5} || 0%{?rhel} == 5 || "%{?dist}" == ".el5"
164 BuildRequires: mysql
165 %else
166 BuildRequires: mysql-libs
167 BuildRequires: mysql
168 %endif
169 BuildRequires: mysql-devel
170 Requires: mysql
171 %endif
172 Requires: %{name} = %{version}-%{release}
173
174 %description ido-mysql
175 Icinga 2 IDO mysql database backend. Compatible with Icinga 1.x
176 IDOUtils schema >= 1.10
177
178
179 %package ido-pgsql
180 Summary:      IDO PostgreSQL database backend for Icinga 2
181 Group:        Applications/System
182 %if "%{_vendor}" == "suse"
183 BuildRequires: postgresql-libs
184 %endif
185 %if "%{_vendor}" == "redhat"
186 # el5 only provides mysql package
187 %if 0%{?el5} || 0%{?rhel} == 5 || "%{?dist}" == ".el5"
188 BuildRequires: postgresql84
189 %endif
190 %endif
191 BuildRequires: postgresql-devel
192 Requires: postgresql-libs
193 Requires: %{name} = %{version}-%{release}
194
195 %description ido-pgsql
196 Icinga 2 IDO PostgreSQL database backend. Compatible with Icinga 1.x
197 IDOUtils schema >= 1.10
198
199
200 %package classicui-config
201 Summary:      Icinga 2 Classic UI Standalone configuration
202 Group:        Applications/System
203 Requires:     %{apachename}
204 Requires:     %{name} = %{version}-%{release}
205 Provides:     icinga-classicui-config
206 Conflicts:    icinga-gui-config
207
208 %description classicui-config
209 Icinga 1.x Classic UI Standalone configuration with locations
210 for Icinga 2.
211
212
213 %prep
214 %setup -q -n %{name}-%{version}
215
216 %build
217 CMAKE_OPTS="-DCMAKE_INSTALL_PREFIX=/usr \
218          -DCMAKE_INSTALL_SYSCONFDIR=/etc \
219                  -DCMAKE_INSTALL_LOCALSTATEDIR=/var \
220          -DCMAKE_BUILD_TYPE=RelWithDebInfo \
221          -DICINGA2_USER=%{icinga_user} \
222          -DICINGA2_GROUP=%{icinga_group} \
223              -DICINGA2_COMMAND_USER=%{icinga_user} \
224              -DICINGA2_COMMAND_GROUP=%{icingacmd_group}"
225 %if "%{_vendor}" == "redhat"
226 %if 0%{?el5} || 0%{?rhel} == 5 || "%{?dist}" == ".el5"
227 # Boost_VERSION 1.41.0 vs 101400 - disable build tests
228 # details in https://dev.icinga.org/issues/5033
229 CMAKE_OPTS="$CMAKE_OPTS -DBOOST_LIBRARYDIR=/usr/lib/boost141 \
230  -DBOOST_INCLUDEDIR=/usr/include/boost141 \
231  -DBoost_ADDITIONAL_VERSIONS='1.41;1.41.0' \
232  -DBoost_NO_SYSTEM_PATHS=TRUE \
233  -DBUILD_TESTING=FALSE \
234  -DBoost_NO_BOOST_CMAKE=TRUE"
235 %endif
236 %endif
237
238 cmake $CMAKE_OPTS .
239
240 make %{?_smp_mflags}
241
242 %install
243 [ "%{buildroot}" != "/" ] && [ -d "%{buildroot}" ] && rm -rf %{buildroot}
244 make install \
245         DESTDIR="%{buildroot}"
246
247 # install classicui config
248 install -D -m 0644 etc/icinga/icinga-classic.htpasswd %{buildroot}%{icingaclassicconfdir}/passwd
249 install -D -m 0644 etc/icinga/cgi.cfg %{buildroot}%{icingaclassicconfdir}/cgi.cfg
250 install -D -m 0644 etc/icinga/icinga-classic-apache.conf %{buildroot}%{apacheconfdir}/icinga.conf
251
252 # fix plugin path on x64
253 %if "%{_vendor}" != "suse"
254 sed -i 's@plugindir = .*@plugindir = "%{_libdir}/nagios/plugins"@' %{buildroot}/%{_sysconfdir}/%{name}/conf.d/macros.conf
255 %endif
256
257 # remove features-enabled symlinks
258 rm -f %{buildroot}/%{_sysconfdir}/%{name}/features-enabled/*.conf
259
260 %clean
261 [ "%{buildroot}" != "/" ] && [ -d "%{buildroot}" ] && rm -rf %{buildroot}
262
263 %pre common
264 getent group %{icinga_group} >/dev/null || %{_sbindir}/groupadd -r %{icinga_group}
265 getent group %{icingacmd_group} >/dev/null || %{_sbindir}/groupadd -r %{icingacmd_group}
266 getent passwd %{icinga_user} >/dev/null || %{_sbindir}/useradd -c "icinga" -s /sbin/nologin -r -d %{_localstatedir}/spool/%{name} -G %{icingacmd_group} -g %{icinga_group} %{icinga_user}
267 exit 0
268
269 # suse
270 %if 0%{?suse_version}
271 %post
272 %{fillup_and_insserv icinga2}
273
274 if [ ${1:-0} -eq 1 ]
275 then
276         # initial installation, enable default features
277         %{_sbindir}/icinga2-enable-feature checker
278         %{_sbindir}/icinga2-enable-feature notification
279         %{_sbindir}/icinga2-enable-feature mainlog
280 fi
281
282 exit 0
283 %postun
284 %restart_on_update icinga2
285 %insserv_cleanup
286
287 if [ "$1" = "0" ]; then
288         # deinstallation of the package - remove enabled features
289         rm -rf %{_sysconfdir}/%{name}/features-enabled
290 fi
291
292 exit 0
293
294 %preun
295 %stop_on_removal icinga2
296
297 # rhel
298 %else
299
300 %post
301 /sbin/chkconfig --add icinga2
302
303 if [ ${1:-0} -eq 1 ]
304 then
305         # initial installation, enable default features
306         %{_sbindir}/icinga2-enable-feature checker
307         %{_sbindir}/icinga2-enable-feature notification
308         %{_sbindir}/icinga2-enable-feature mainlog
309 fi
310
311 exit 0
312
313 %postun
314 if [ "$1" -ge  "1" ]; then
315         /sbin/service icinga2 condrestart >/dev/null 2>&1 || :
316 fi
317
318 if [ "$1" = "0" ]; then
319         # deinstallation of the package - remove enabled features
320         rm -rf %{_sysconfdir}/%{name}/features-enabled
321 fi
322
323 exit 0
324 %preun
325 if [ "$1" = "0" ]; then
326         /sbin/service icinga2 stop > /dev/null 2>&1
327         /sbin/chkconfig --del icinga2
328 fi
329
330 %endif
331 # suse/rhel
332
333 %post ido-mysql
334 if [ ${1:-0} -eq 1 ]
335 then
336         # initial installation, enable ido-mysql feature
337         %{_sbindir}/icinga2-enable-feature ido-mysql
338 fi
339
340 exit 0
341
342 %postun ido-mysql
343 if [ "$1" = "0" ]; then
344         # deinstallation of the package - remove feature
345         test -x %{_sbindir}/icinga2-disable-feature && %{_sbindir}/icinga2-disable-feature ido-mysql
346 fi
347
348 exit 0
349
350 %post ido-pgsql
351 if [ ${1:-0} -eq 1 ]
352 then
353         # initial installation, enable ido-pgsql feature
354         %{_sbindir}/icinga2-enable-feature ido-pgsql
355 fi
356
357 exit 0
358
359 %postun ido-pgsql
360 if [ "$1" = "0" ]; then
361         # deinstallation of the package - remove feature
362         test -x %{_sbindir}/icinga2-disable-feature && %{_sbindir}/icinga2-disable-feature ido-pgsql
363 fi
364
365 exit 0
366
367 %post classicui-config
368 if [ ${1:-0} -eq 1 ]
369 then
370         # initial installation, enable features
371         %{_sbindir}/icinga2-enable-feature statusdata
372         %{_sbindir}/icinga2-enable-feature compatlog
373         %{_sbindir}/icinga2-enable-feature command
374 fi
375
376 exit 0
377
378 %postun classicui-config
379 if [ "$1" = "0" ]; then
380         # deinstallation of the package - remove feature
381         test -x %{_sbindir}/icinga2-disable-feature && %{_sbindir}/icinga2-disable-feature statusdata
382         test -x %{_sbindir}/icinga2-disable-feature && %{_sbindir}/icinga2-disable-feature compatlog
383         test -x %{_sbindir}/icinga2-disable-feature && %{_sbindir}/icinga2-disable-feature command
384 fi
385
386 exit 0
387
388 %files
389 %defattr(-,root,root,-)
390 %doc COPYING COPYING.Exceptions README NEWS AUTHORS ChangeLog
391 %attr(755,-,-) %{_sysconfdir}/init.d/%{name}
392 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}
393 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/conf.d
394 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/features-available
395 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/features-enabled
396 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/scripts
397 %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/%{name}.conf
398 %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/conf.d/*.conf
399 %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/features-available/*.conf
400 %config(noreplace) %{_sysconfdir}/%{name}/scripts/*
401 %{_sbindir}/%{name}
402 %{_bindir}/%{name}-migrate-config
403 %{_bindir}/%{name}-build-ca
404 %{_bindir}/%{name}-build-key
405 %{_sbindir}/%{name}-enable-feature
406 %{_sbindir}/%{name}-disable-feature
407 %exclude %{_libdir}/%{name}/libdb_ido_mysql*
408 %exclude %{_libdir}/%{name}/libdb_ido_pgsql*
409 %{_libdir}/%{name}
410 %{_datadir}/%{name}
411 %exclude %{_datadir}/%{name}/itl
412 %{_mandir}/man8/%{name}.8.gz
413
414 %attr(0755,%{icinga_user},%{icinga_group}) %{_localstatedir}/cache/%{name}
415 %attr(0755,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/log/%{name}
416 %attr(0755,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/log/%{name}/compat
417 %attr(0755,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/log/%{name}/compat/archives
418 %attr(0755,%{icinga_user},%{icinga_group}) %ghost %{_localstatedir}/run/%{name}
419 %attr(0750,%{icinga_user},%{icinga_group}) %{_localstatedir}/lib/%{name}
420
421 %attr(2755,%{icinga_user},%{icingacmd_group}) %ghost %{_localstatedir}/run/icinga2/cmd
422
423 %files common
424 %defattr(-,root,root,-)
425 %doc COPYING COPYING.Exceptions README NEWS AUTHORS ChangeLog
426 %attr(755,-,-) %{_sysconfdir}/logrotate.d/%{name}
427 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/spool/%{name}
428 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/spool/%{name}/perfdata
429 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/spool/%{name}/tmp
430 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_datadir}/%{name}/itl
431 %{_datadir}/%{name}/itl
432
433 %files doc
434 %defattr(-,root,root,-)
435 %doc COPYING COPYING.Exceptions README NEWS AUTHORS ChangeLog
436 %{_datadir}/doc/%{name}
437 %docdir %{_datadir}/doc/%{name}
438
439 %files ido-mysql
440 %defattr(-,root,root,-)
441 %doc components/db_ido_mysql/schema COPYING COPYING.Exceptions README NEWS AUTHORS ChangeLog
442 %{_libdir}/%{name}/libdb_ido_mysql*
443
444 %files ido-pgsql
445 %defattr(-,root,root,-)
446 %doc components/db_ido_pgsql/schema COPYING COPYING.Exceptions README NEWS AUTHORS ChangeLog
447 %{_libdir}/%{name}/libdb_ido_pgsql*
448
449 %files classicui-config
450 %defattr(-,root,root,-)
451 %attr(0751,%{icinga_user},%{icinga_group}) %dir %{icingaclassicconfdir}
452 %config(noreplace) %{icingaclassicconfdir}/cgi.cfg
453 %config(noreplace) %{apacheconfdir}/icinga.conf
454 %config(noreplace) %attr(0640,root,%{apachegroup}) %{icingaclassicconfdir}/passwd
455
456
457 %changelog