]> git.proxmox.com Git - mirror_corosync.git/blob - corosync.spec.in
[rpm] use rpm macros to identify build distro
[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 systemd
14 %bcond_with xmlconf
15 %bcond_with runautogen
16 %bcond_with libcgroup
17
18 %global gitver %{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}
19 %global gittarver %{?numcomm:.%{numcomm}}%{?alphatag:-%{alphatag}}%{?dirty:-%{dirty}}
20
21 Name: corosync
22 Summary: The Corosync Cluster Engine and Application Programming Interfaces
23 Version: @version@
24 Release: 1%{?gitver}%{?dist}
25 License: BSD
26 URL: http://corosync.github.io/corosync/
27 Source0: http://build.clusterlabs.org/corosync/releases/%{name}-%{version}%{?gittarver}.tar.gz
28
29 # Runtime bits
30 # The automatic dependency overridden in favor of explicit version lock
31 Requires: corosynclib%{?_isa} = %{version}-%{release}
32
33 # Build bits
34
35 %if 0%{?suse_version}
36 BuildRequires: groff-full
37 %else
38 BuildRequires: groff
39 %endif
40 BuildRequires: libqb-devel
41 %if 0%{?suse_version}
42 BuildRequires: mozilla-nss-devel
43 %else
44 BuildRequires: nss-devel
45 %endif
46 BuildRequires: libknet1-devel
47 BuildRequires: zlib-devel
48 %if %{with runautogen}
49 BuildRequires: autoconf automake libtool
50 %endif
51 %if %{with monitoring}
52 BuildRequires: libstatgrab-devel
53 %endif
54 %if %{with snmp}
55 BuildRequires: net-snmp-devel
56 %endif
57 %if %{with dbus}
58 %if 0%{?suse_version}
59 BuildRequires: dbus-1-devel
60 %else
61 BuildRequires: dbus-devel
62 %endif
63 %endif
64 %if %{with systemd}
65 %{?systemd_requires}
66 BuildRequires: systemd
67 BuildRequires: systemd-devel
68 %else
69 Requires(post): /sbin/chkconfig
70 Requires(preun): /sbin/chkconfig
71 %endif
72 %if %{with xmlconf}
73 Requires: libxslt
74 %endif
75 %if %{with libcgroup}
76 BuildRequires: libcgroup-devel
77 %endif
78
79 %prep
80 %setup -q -n %{name}-%{version}%{?gittarver}
81
82 %build
83 %if %{with runautogen}
84 ./autogen.sh
85 %endif
86
87 %{configure} \
88 %if %{with testagents}
89 --enable-testagents \
90 %endif
91 %if %{with watchdog}
92 --enable-watchdog \
93 %endif
94 %if %{with monitoring}
95 --enable-monitoring \
96 %endif
97 %if %{with snmp}
98 --enable-snmp \
99 %endif
100 %if %{with dbus}
101 --enable-dbus \
102 %endif
103 %if %{with systemd}
104 --enable-systemd \
105 %endif
106 %if %{with xmlconf}
107 --enable-xmlconf \
108 %endif
109 %if %{with libcgroup}
110 --enable-libcgroup \
111 %endif
112 --with-initddir=%{_initrddir} \
113 --with-systemddir=%{_unitdir} \
114 --docdir=%{_docdir}
115
116 make %{_smp_mflags}
117
118 %install
119 make install DESTDIR=%{buildroot}
120
121 %if %{with dbus}
122 mkdir -p -m 0700 %{buildroot}/%{_sysconfdir}/dbus-1/system.d
123 install -m 644 %{_builddir}/%{name}-%{version}%{?gittarver}/conf/corosync-signals.conf %{buildroot}/%{_sysconfdir}/dbus-1/system.d/corosync-signals.conf
124 %endif
125
126 ## tree fixup
127 # drop static libs
128 rm -f %{buildroot}%{_libdir}/*.a
129 rm -f %{buildroot}%{_libdir}/*.la
130 # drop docs and html docs for now
131 rm -rf %{buildroot}%{_docdir}/*
132 # /etc/sysconfig/corosync-notifyd
133 mkdir -p %{buildroot}%{_sysconfdir}/sysconfig
134 install -m 644 tools/corosync-notifyd.sysconfig.example \
135 %{buildroot}%{_sysconfdir}/sysconfig/corosync-notifyd
136 # /etc/sysconfig/corosync
137 install -m 644 init/corosync.sysconfig.example \
138 %{buildroot}%{_sysconfdir}/sysconfig/corosync
139
140 %clean
141
142 %description
143 This package contains the Corosync Cluster Engine Executive, several default
144 APIs and libraries, default configuration files, and an init script.
145
146 %post
147 %if %{with systemd} && 0%{?systemd_post:1}
148 %systemd_post corosync.service
149 %else
150 if [ $1 -eq 1 ]; then
151 /sbin/chkconfig --add corosync || :
152 fi
153 %endif
154
155 %preun
156 %if %{with systemd} && 0%{?systemd_preun:1}
157 %systemd_preun corosync.service
158 %else
159 if [ $1 -eq 0 ]; then
160 /sbin/service corosync stop &>/dev/null || :
161 /sbin/chkconfig --del corosync || :
162 fi
163 %endif
164
165 %postun
166 %if %{with systemd} && 0%{?systemd_postun:1}
167 %systemd_postun corosync.service
168 %endif
169
170 %files
171 %doc LICENSE SECURITY
172 %{_sbindir}/corosync
173 %{_sbindir}/corosync-keygen
174 %{_sbindir}/corosync-cmapctl
175 %{_sbindir}/corosync-cfgtool
176 %{_sbindir}/corosync-cpgtool
177 %{_sbindir}/corosync-quorumtool
178 %{_sbindir}/corosync-notifyd
179 %{_bindir}/corosync-blackbox
180 %if %{with xmlconf}
181 %{_bindir}/corosync-xmlproc
182 %config(noreplace) %{_sysconfdir}/corosync/corosync.xml.example
183 %dir %{_datadir}/corosync
184 %{_datadir}/corosync/xml2conf.xsl
185 %{_mandir}/man8/corosync-xmlproc.8*
186 %{_mandir}/man5/corosync.xml.5*
187 %endif
188 %dir %{_sysconfdir}/corosync
189 %dir %{_sysconfdir}/corosync/uidgid.d
190 %config(noreplace) %{_sysconfdir}/corosync/corosync.conf.example
191 %config(noreplace) %{_sysconfdir}/corosync/corosync.conf.example.udpu
192 %config(noreplace) %{_sysconfdir}/sysconfig/corosync-notifyd
193 %config(noreplace) %{_sysconfdir}/sysconfig/corosync
194 %config(noreplace) %{_sysconfdir}/logrotate.d/corosync
195 %if %{with dbus}
196 %{_sysconfdir}/dbus-1/system.d/corosync-signals.conf
197 %endif
198 %if %{with snmp}
199 %{_datadir}/snmp/mibs/COROSYNC-MIB.txt
200 %endif
201 %if %{with systemd}
202 %{_unitdir}/corosync.service
203 %{_unitdir}/corosync-notifyd.service
204 %else
205 %{_initrddir}/corosync
206 %{_initrddir}/corosync-notifyd
207 %endif
208 %dir %{_localstatedir}/lib/corosync
209 %dir %{_localstatedir}/log/cluster
210 %{_mandir}/man7/corosync_overview.7*
211 %{_mandir}/man8/corosync.8*
212 %{_mandir}/man8/corosync-blackbox.8*
213 %{_mandir}/man8/corosync-cmapctl.8*
214 %{_mandir}/man8/corosync-keygen.8*
215 %{_mandir}/man8/corosync-cfgtool.8*
216 %{_mandir}/man8/corosync-cpgtool.8*
217 %{_mandir}/man8/corosync-notifyd.8*
218 %{_mandir}/man8/corosync-quorumtool.8*
219 %{_mandir}/man5/corosync.conf.5*
220 %{_mandir}/man5/votequorum.5*
221 %{_mandir}/man8/cmap_keys.8*
222
223 # optional testagent rpm
224 #
225 %if %{with testagents}
226
227 %package -n corosync-testagents
228 Summary: The Corosync Cluster Engine Test Agents
229 Requires: %{name} = %{version}-%{release}
230
231 %description -n corosync-testagents
232 This package contains corosync test agents.
233
234 %files -n corosync-testagents
235 %defattr(755,root,root,-)
236 %{_datadir}/corosync/tests/mem_leak_test.sh
237 %{_datadir}/corosync/tests/net_breaker.sh
238 %{_datadir}/corosync/tests/cmap-dispatch-deadlock.sh
239 %{_datadir}/corosync/tests/shm_leak_audit.sh
240 %{_bindir}/cpg_test_agent
241 %{_bindir}/sam_test_agent
242 %{_bindir}/votequorum_test_agent
243
244 %endif
245
246 # library
247 #
248 %package -n corosynclib
249 Summary: The Corosync Cluster Engine Libraries
250
251 %description -n corosynclib
252 This package contains corosync libraries.
253
254 %files -n corosynclib
255 %doc LICENSE
256 %{_libdir}/libcfg.so.*
257 %{_libdir}/libcpg.so.*
258 %{_libdir}/libcmap.so.*
259 %{_libdir}/libtotem_pg.so.*
260 %{_libdir}/libquorum.so.*
261 %{_libdir}/libvotequorum.so.*
262 %{_libdir}/libsam.so.*
263 %{_libdir}/libcorosync_common.so.*
264
265 %post -n corosynclib -p /sbin/ldconfig
266
267 %postun -n corosynclib -p /sbin/ldconfig
268
269 %package -n corosynclib-devel
270 Summary: The Corosync Cluster Engine Development Kit
271 Requires: corosynclib%{?_isa} = %{version}-%{release}
272 Requires: pkgconfig
273 Provides: corosync-devel = %{version}
274
275 %description -n corosynclib-devel
276 This package contains include files and man pages used to develop using
277 The Corosync Cluster Engine APIs.
278
279 %files -n corosynclib-devel
280 %doc LICENSE
281 %dir %{_includedir}/corosync/
282 %{_includedir}/corosync/corodefs.h
283 %{_includedir}/corosync/cfg.h
284 %{_includedir}/corosync/cmap.h
285 %{_includedir}/corosync/corotypes.h
286 %{_includedir}/corosync/cpg.h
287 %{_includedir}/corosync/hdb.h
288 %{_includedir}/corosync/sam.h
289 %{_includedir}/corosync/quorum.h
290 %{_includedir}/corosync/votequorum.h
291 %dir %{_includedir}/corosync/totem/
292 %{_includedir}/corosync/totem/totem.h
293 %{_includedir}/corosync/totem/totemip.h
294 %{_includedir}/corosync/totem/totempg.h
295 %{_includedir}/corosync/totem/totemstats.h
296 %{_libdir}/libcfg.so
297 %{_libdir}/libcpg.so
298 %{_libdir}/libcmap.so
299 %{_libdir}/libtotem_pg.so
300 %{_libdir}/libquorum.so
301 %{_libdir}/libvotequorum.so
302 %{_libdir}/libsam.so
303 %{_libdir}/libcorosync_common.so
304 %{_libdir}/pkgconfig/*.pc
305 %{_mandir}/man3/cpg_*3*
306 %{_mandir}/man3/quorum_*3*
307 %{_mandir}/man3/votequorum_*3*
308 %{_mandir}/man3/sam_*3*
309 %{_mandir}/man3/cmap_*3*
310
311 %changelog
312 * @date@ Autotools generated version <nobody@nowhere.org> - @version@-1-@numcomm@.@alphatag@.@dirty@
313 - Autotools generated version