]> git.proxmox.com Git - mirror_corosync.git/blob - corosync.spec.in
build: Add the headers necessary for RPM build
[mirror_corosync.git] / corosync.spec.in
1 @ALPHATAG@
2 @NUMCOMM@
3 @DIRTY@
4
5 # Conditionals
6 # Invoke "rpmbuild --without <feature>" or "rpmbuild --with <feature>"
7 # to disable or enable specific features
8 %bcond_with testagents
9 %bcond_with watchdog
10 %bcond_with monitoring
11 %bcond_with snmp
12 %bcond_with dbus
13 %bcond_with rdma
14 %bcond_with systemd
15 %bcond_with upstart
16 %bcond_with xmlconf
17 %bcond_with runautogen
18 %bcond_with qdevices
19 %bcond_with qnetd
20 %bcond_with libcgroup
21
22 %global gitver %{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}
23 %global gittarver %{?numcomm:.%{numcomm}}%{?alphatag:-%{alphatag}}%{?dirty:-%{dirty}}
24
25 Name: corosync
26 Summary: The Corosync Cluster Engine and Application Programming Interfaces
27 Version: @version@
28 Release: 1%{?gitver}%{?dist}
29 License: BSD
30 Group: System Environment/Base
31 URL: http://corosync.github.io/corosync/
32 Source0: http://build.clusterlabs.org/corosync/releases/%{name}-%{version}%{?gittarver}.tar.gz
33
34 # Runtime bits
35 # The automatic dependency overridden in favor of explicit version lock
36 Requires: corosynclib%{?_isa} = %{version}-%{release}
37 Requires(pre): /usr/sbin/useradd
38 Requires(post): /sbin/chkconfig
39 Requires(preun): /sbin/chkconfig
40 Conflicts: openais <= 0.89, openais-devel <= 0.89
41
42 # Build bits
43
44 BuildRequires: groff
45 BuildRequires: libqb-devel
46 BuildRequires: nss-devel
47 BuildRequires: libknet1-devel
48 BuildRequires: zlib-devel
49 %if %{with runautogen}
50 BuildRequires: autoconf automake libtool
51 %endif
52 %if %{with monitoring}
53 BuildRequires: libstatgrab-devel
54 %endif
55 %if %{with rdma}
56 BuildRequires: libibverbs-devel librdmacm-devel
57 %endif
58 %if %{with snmp}
59 BuildRequires: net-snmp-devel
60 %endif
61 %if %{with dbus}
62 BuildRequires: dbus-devel
63 %endif
64 %if %{with systemd}
65 BuildRequires: systemd-units
66 BuildRequires: systemd-devel
67 Requires(post): systemd
68 Requires(preun): systemd
69 Requires(postun): systemd
70 %endif
71 %if %{with xmlconf}
72 Requires: libxslt
73 %endif
74 %if %{with qdevices} || %{with qnetd}
75 Requires: nss-tools
76 %endif
77 %if %{with qnetd}
78 BuildRequires: sed
79 %endif
80 %if %{with libcgroup}
81 BuildRequires: libcgroup-devel
82 %endif
83
84 BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
85
86 %prep
87 %setup -q -n %{name}-%{version}%{?gittarver}
88
89 %build
90 %if %{with runautogen}
91 ./autogen.sh
92 %endif
93
94 %if %{with rdma}
95 export ibverbs_CFLAGS=-I/usr/include/infiniband \
96 export ibverbs_LIBS=-libverbs \
97 export rdmacm_CFLAGS=-I/usr/include/rdma \
98 export rdmacm_LIBS=-lrdmacm \
99 %endif
100 %{configure} \
101 %if %{with testagents}
102 --enable-testagents \
103 %endif
104 %if %{with watchdog}
105 --enable-watchdog \
106 %endif
107 %if %{with monitoring}
108 --enable-monitoring \
109 %endif
110 %if %{with snmp}
111 --enable-snmp \
112 %endif
113 %if %{with dbus}
114 --enable-dbus \
115 %endif
116 %if %{with rdma}
117 --enable-rdma \
118 %endif
119 %if %{with systemd}
120 --enable-systemd \
121 %endif
122 %if %{with upstart}
123 --enable-upstart \
124 %endif
125 %if %{with xmlconf}
126 --enable-xmlconf \
127 %endif
128 %if %{with qdevices}
129 --enable-qdevices \
130 %endif
131 %if %{with qnetd}
132 --enable-qnetd \
133 %endif
134 %if %{with libcgroup}
135 --enable-libcgroup \
136 %endif
137 --with-initddir=%{_initrddir} \
138 --with-systemddir=%{_unitdir} \
139 --with-upstartdir=%{_sysconfdir}/init
140
141 make %{_smp_mflags}
142
143 %install
144 rm -rf %{buildroot}
145
146 make install DESTDIR=%{buildroot}
147
148 %if %{with dbus}
149 mkdir -p -m 0700 %{buildroot}/%{_sysconfdir}/dbus-1/system.d
150 install -m 644 %{_builddir}/%{name}-%{version}%{?gittarver}/conf/corosync-signals.conf %{buildroot}/%{_sysconfdir}/dbus-1/system.d/corosync-signals.conf
151 %endif
152
153 ## tree fixup
154 # drop static libs
155 rm -f %{buildroot}%{_libdir}/*.a
156 rm -f %{buildroot}%{_libdir}/*.la
157 # drop docs and html docs for now
158 rm -rf %{buildroot}%{_docdir}/*
159 # /etc/sysconfig/corosync-notifyd
160 mkdir -p %{buildroot}%{_sysconfdir}/sysconfig
161 install -m 644 tools/corosync-notifyd.sysconfig.example \
162 %{buildroot}%{_sysconfdir}/sysconfig/corosync-notifyd
163 # /etc/sysconfig/corosync
164 install -m 644 init/corosync.sysconfig.example \
165 %{buildroot}%{_sysconfdir}/sysconfig/corosync
166
167 %if %{with qdevices}
168 # /etc/sysconfig/corosync-qdevice
169 install -m 644 init/corosync-qdevice.sysconfig.example \
170 %{buildroot}%{_sysconfdir}/sysconfig/corosync-qdevice
171 %endif
172
173 %if %{with qnetd}
174 # /etc/sysconfig/corosync-qnetd
175 install -m 644 init/corosync-qnetd.sysconfig.example \
176 %{buildroot}%{_sysconfdir}/sysconfig/corosync-qnetd
177 %if %{with systemd}
178 sed -i -e 's/^#User=/User=/' \
179 %{buildroot}%{_unitdir}/corosync-qnetd.service
180 %else
181 sed -i -e 's/^COROSYNC_QNETD_RUNAS=""$/COROSYNC_QNETD_RUNAS="coroqnetd"/' \
182 %{buildroot}%{_sysconfdir}/sysconfig/corosync-qnetd
183 %endif
184 %endif
185
186 %clean
187 rm -rf %{buildroot}
188
189 %description
190 This package contains the Corosync Cluster Engine Executive, several default
191 APIs and libraries, default configuration files, and an init script.
192
193 %post
194 %if %{with systemd} && 0%{?systemd_post:1}
195 %systemd_post corosync.service
196 %else
197 if [ $1 -eq 1 ]; then
198 /sbin/chkconfig --add corosync || :
199 fi
200 %endif
201
202 %preun
203 %if %{with systemd} && 0%{?systemd_preun:1}
204 %systemd_preun corosync.service
205 %else
206 if [ $1 -eq 0 ]; then
207 /sbin/service corosync stop &>/dev/null || :
208 /sbin/chkconfig --del corosync || :
209 fi
210 %endif
211
212 %postun
213 %if %{with systemd} && 0%{?systemd_postun:1}
214 %systemd_postun
215 %endif
216
217 %files
218 %defattr(-,root,root,-)
219 %doc LICENSE SECURITY
220 %{_sbindir}/corosync
221 %{_sbindir}/corosync-keygen
222 %{_sbindir}/corosync-cmapctl
223 %{_sbindir}/corosync-cfgtool
224 %{_sbindir}/corosync-cpgtool
225 %{_sbindir}/corosync-quorumtool
226 %{_sbindir}/corosync-notifyd
227 %{_bindir}/corosync-blackbox
228 %if %{with xmlconf}
229 %{_bindir}/corosync-xmlproc
230 %config(noreplace) %{_sysconfdir}/corosync/corosync.xml.example
231 %dir %{_datadir}/corosync
232 %{_datadir}/corosync/xml2conf.xsl
233 %{_mandir}/man8/corosync-xmlproc.8*
234 %{_mandir}/man5/corosync.xml.5*
235 %endif
236 %dir %{_sysconfdir}/corosync
237 %dir %{_sysconfdir}/corosync/uidgid.d
238 %config(noreplace) %{_sysconfdir}/corosync/corosync.conf.example
239 %config(noreplace) %{_sysconfdir}/corosync/corosync.conf.example.udpu
240 %config(noreplace) %{_sysconfdir}/sysconfig/corosync-notifyd
241 %config(noreplace) %{_sysconfdir}/sysconfig/corosync
242 %config(noreplace) %{_sysconfdir}/logrotate.d/corosync
243 %if %{with dbus}
244 %{_sysconfdir}/dbus-1/system.d/corosync-signals.conf
245 %endif
246 %if %{with snmp}
247 %{_datadir}/snmp/mibs/COROSYNC-MIB.txt
248 %endif
249 %if %{with systemd}
250 %{_unitdir}/corosync.service
251 %{_unitdir}/corosync-notifyd.service
252 %else
253 %{_initrddir}/corosync
254 %{_initrddir}/corosync-notifyd
255 %endif
256 %if %{with upstart}
257 %{_sysconfdir}/init/corosync.conf
258 %{_sysconfdir}/init/corosync-notifyd.conf
259 %endif
260 %dir %{_localstatedir}/lib/corosync
261 %dir %{_localstatedir}/log/cluster
262 %{_mandir}/man8/corosync_overview.8*
263 %{_mandir}/man8/corosync.8*
264 %{_mandir}/man8/corosync-blackbox.8*
265 %{_mandir}/man8/corosync-cmapctl.8*
266 %{_mandir}/man8/corosync-keygen.8*
267 %{_mandir}/man8/corosync-cfgtool.8*
268 %{_mandir}/man8/corosync-cpgtool.8*
269 %{_mandir}/man8/corosync-notifyd.8*
270 %{_mandir}/man8/corosync-quorumtool.8*
271 %{_mandir}/man5/corosync.conf.5*
272 %{_mandir}/man5/votequorum.5*
273 %{_mandir}/man8/cmap_keys.8*
274
275 # optional testagent rpm
276 #
277 %if %{with testagents}
278
279 %package -n corosync-testagents
280 Summary: The Corosync Cluster Engine Test Agents
281 Group: Development/Libraries
282 Requires: %{name} = %{version}-%{release}
283
284 %description -n corosync-testagents
285 This package contains corosync test agents.
286
287 %files -n corosync-testagents
288 %defattr(755,root,root,-)
289 %{_datadir}/corosync/tests/mem_leak_test.sh
290 %{_datadir}/corosync/tests/net_breaker.sh
291 %{_datadir}/corosync/tests/cmap-dispatch-deadlock.sh
292 %{_datadir}/corosync/tests/shm_leak_audit.sh
293 %{_bindir}/cpg_test_agent
294 %{_bindir}/sam_test_agent
295 %{_bindir}/votequorum_test_agent
296
297 %endif
298
299 # library
300 #
301 %package -n corosynclib
302 Summary: The Corosync Cluster Engine Libraries
303 Group: System Environment/Libraries
304
305 %description -n corosynclib
306 This package contains corosync libraries.
307
308 %files -n corosynclib
309 %defattr(-,root,root,-)
310 %doc LICENSE
311 %{_libdir}/libcfg.so.*
312 %{_libdir}/libcpg.so.*
313 %{_libdir}/libcmap.so.*
314 %{_libdir}/libtotem_pg.so.*
315 %{_libdir}/libquorum.so.*
316 %{_libdir}/libvotequorum.so.*
317 %{_libdir}/libsam.so.*
318 %{_libdir}/libcorosync_common.so.*
319
320 %post -n corosynclib -p /sbin/ldconfig
321
322 %postun -n corosynclib -p /sbin/ldconfig
323
324 %package -n corosynclib-devel
325 Summary: The Corosync Cluster Engine Development Kit
326 Group: Development/Libraries
327 Requires: corosynclib%{?_isa} = %{version}-%{release}
328 Requires: pkgconfig
329 Provides: corosync-devel = %{version}
330 Obsoletes: corosync-devel < 0.92-7
331
332 %description -n corosynclib-devel
333 This package contains include files and man pages used to develop using
334 The Corosync Cluster Engine APIs.
335
336 %files -n corosynclib-devel
337 %defattr(-,root,root,-)
338 %doc LICENSE
339 %dir %{_includedir}/corosync/
340 %{_includedir}/corosync/corodefs.h
341 %{_includedir}/corosync/cfg.h
342 %{_includedir}/corosync/cmap.h
343 %{_includedir}/corosync/corotypes.h
344 %{_includedir}/corosync/cpg.h
345 %{_includedir}/corosync/hdb.h
346 %{_includedir}/corosync/sam.h
347 %{_includedir}/corosync/quorum.h
348 %{_includedir}/corosync/votequorum.h
349 %dir %{_includedir}/corosync/totem/
350 %{_includedir}/corosync/totem/totem.h
351 %{_includedir}/corosync/totem/totemip.h
352 %{_includedir}/corosync/totem/totempg.h
353 %{_includedir}/corosync/totem/totemstats.h
354 %{_libdir}/libcfg.so
355 %{_libdir}/libcpg.so
356 %{_libdir}/libcmap.so
357 %{_libdir}/libtotem_pg.so
358 %{_libdir}/libquorum.so
359 %{_libdir}/libvotequorum.so
360 %{_libdir}/libsam.so
361 %{_libdir}/libcorosync_common.so
362 %{_libdir}/pkgconfig/*.pc
363 %{_mandir}/man3/cpg_*3*
364 %{_mandir}/man3/quorum_*3*
365 %{_mandir}/man3/votequorum_*3*
366 %{_mandir}/man3/sam_*3*
367 %{_mandir}/man8/cpg_overview.8*
368 %{_mandir}/man8/votequorum_overview.8*
369 %{_mandir}/man8/sam_overview.8*
370 %{_mandir}/man3/cmap_*3*
371 %{_mandir}/man8/cmap_overview.8*
372 %{_mandir}/man8/quorum_overview.8*
373
374 # optional qdevices
375 #
376 %if %{with qdevices}
377
378 %package -n corosync-qdevice
379 Summary: The Corosync Cluster Engine Qdevice
380 Group: System Environment/Base
381 Requires: %{name} = %{version}-%{release}
382 # The automatic dependency overridden in favor of explicit version lock
383 Requires: corosynclib%{?_isa} = %{version}-%{release}
384 Requires: nss-tools
385
386 %if %{with systemd}
387 Requires(post): systemd
388 Requires(preun): systemd
389 Requires(postun): systemd
390 %endif
391
392 %description -n corosync-qdevice
393 This package contains the Corosync Cluster Engine Qdevice, script for creating
394 NSS certificates and an init script.
395
396 %post -n corosync-qdevice
397 %if %{with systemd} && 0%{?systemd_post:1}
398 %systemd_post corosync-qdevice.service
399 %else
400 if [ $1 -eq 1 ]; then
401 /sbin/chkconfig --add corosync-qdevice || :
402 fi
403 %endif
404
405 %preun -n corosync-qdevice
406 %if %{with systemd} && 0%{?systemd_preun:1}
407 %systemd_preun corosync-qdevice.service
408 %else
409 if [ $1 -eq 0 ]; then
410 /sbin/service corosync-qdevice stop &>/dev/null || :
411 /sbin/chkconfig --del corosync-qdevice || :
412 fi
413 %endif
414
415 %postun -n corosync-qdevice
416 %if %{with systemd} && 0%{?systemd_postun:1}
417 %systemd_postun
418 %endif
419
420 %files -n corosync-qdevice
421 %defattr(-,root,root,-)
422 %dir %{_sysconfdir}/corosync/qdevice
423 %dir %config(noreplace) %{_sysconfdir}/corosync/qdevice/net
424 %dir %{_localstatedir}/run/corosync-qdevice
425 %{_sbindir}/corosync-qdevice
426 %{_sbindir}/corosync-qdevice-net-certutil
427 %{_sbindir}/corosync-qdevice-tool
428 %config(noreplace) %{_sysconfdir}/sysconfig/corosync-qdevice
429 %if %{with systemd}
430 %{_unitdir}/corosync-qdevice.service
431 %else
432 %{_initrddir}/corosync-qdevice
433 %endif
434 %{_mandir}/man8/corosync-qdevice-tool.8*
435 %{_mandir}/man8/corosync-qdevice-net-certutil.8*
436 %{_mandir}/man8/corosync-qdevice.8*
437 %endif
438
439 # optional qnetd
440 #
441 %if %{with qnetd}
442
443 %package -n corosync-qnetd
444 Summary: The Corosync Cluster Engine Qdevice Network Daemon
445 Group: System Environment/Base
446 Requires: nss-tools
447 Requires(pre): shadow-utils
448
449 %if %{with systemd}
450 Requires(post): systemd
451 Requires(preun): systemd
452 Requires(postun): systemd
453 %endif
454
455 %description -n corosync-qnetd
456 This package contains the Corosync Cluster Engine Qdevice Network Daemon, script for creating
457 NSS certificates and an init script.
458
459 %pre -n corosync-qnetd
460 getent group coroqnetd >/dev/null || groupadd -r coroqnetd
461 getent passwd coroqnetd >/dev/null || \
462 useradd -r -g coroqnetd -d / -s /sbin/nologin -c "User for corosync-qnetd" coroqnetd
463 exit 0
464
465 %post -n corosync-qnetd
466 %if %{with systemd} && 0%{?systemd_post:1}
467 %systemd_post corosync-qnetd.service
468 %else
469 if [ $1 -eq 1 ]; then
470 /sbin/chkconfig --add corosync-qnetd || :
471 fi
472 %endif
473
474 %preun -n corosync-qnetd
475 %if %{with systemd} && 0%{?systemd_preun:1}
476 %systemd_preun corosync-qnetd.service
477 %else
478 if [ $1 -eq 0 ]; then
479 /sbin/service corosync-qnetd stop &>/dev/null || :
480 /sbin/chkconfig --del corosync-qnetd || :
481 fi
482 %endif
483
484 %postun -n corosync-qnetd
485 %if %{with systemd} && 0%{?systemd_postun:1}
486 %systemd_postun
487 %endif
488
489 %files -n corosync-qnetd
490 %defattr(-,root,root,-)
491 %dir %config(noreplace) %attr(770, coroqnetd, coroqnetd) %{_sysconfdir}/corosync/qnetd
492 %dir %attr(770, coroqnetd, coroqnetd) %{_localstatedir}/run/corosync-qnetd
493 %{_bindir}/corosync-qnetd
494 %{_bindir}/corosync-qnetd-certutil
495 %{_bindir}/corosync-qnetd-tool
496 %config(noreplace) %{_sysconfdir}/sysconfig/corosync-qnetd
497 %if %{with systemd}
498 %{_unitdir}/corosync-qnetd.service
499 %else
500 %{_initrddir}/corosync-qnetd
501 %endif
502 %{_mandir}/man8/corosync-qnetd-tool.8*
503 %{_mandir}/man8/corosync-qnetd-certutil.8*
504 %{_mandir}/man8/corosync-qnetd.8*
505 %endif
506
507 %changelog
508 * @date@ Autotools generated version <nobody@nowhere.org> - @version@-1-@numcomm@.@alphatag@.@dirty@
509 - Autotools generated version