ctdb: Add new helper ctdb_mutex_fcntl_helper
[samba.git] / ctdb / packaging / RPM / ctdb.spec.in
1 %define with_systemd  %{?_with_systemd: 1} %{?!_with_systemd: 0}
2 %define initdir %{_sysconfdir}/init.d
3 Name: ctdb
4 Summary: Clustered TDB
5 Vendor: Samba Team
6 Packager: Samba Team <samba@samba.org>
7 Version: @VERSION@
8 Release: @RELEASE@
9 Epoch: 0
10 License: GNU GPL version 3
11 Group: System Environment/Daemons
12 URL: http://ctdb.samba.org/
13
14 Source: ctdb-%{version}.tar.gz
15
16 # Packages
17 Requires: coreutils, sed, gawk, iptables, iproute, procps, ethtool, sudo
18 # Commands - package name might vary
19 Requires: /usr/bin/killall, /bin/kill, /bin/netstat
20
21 Provides: ctdb = %{version}
22
23 Prefix: /usr
24 BuildRoot: %{_tmppath}/%{name}-%{version}-root
25
26 # Allow build with system libraries
27 # To enable, run rpmbuild with,
28 #      "--with system_talloc"
29 #      "--with system_tdb"
30 #      "--with system_tevent"
31 #%define with_included_talloc %{?_with_system_talloc: 0} %{?!_with_system_talloc: 1}
32 #%define with_included_tdb %{?_with_system_tdb: 0} %{?!_with_system_tdb: 1}
33 #%define with_included_tevent %{?_with_system_tevent: 0} %{?!_with_system_tevent: 1}
34
35 %define with_included_talloc 0
36 %define with_included_tevent 0
37 %define with_included_tdb 0
38
39 # Required minimum library versions when building with system libraries
40 %define libtalloc_version 2.0.8
41 %define libtdb_version 1.2.11
42 %define libtevent_version 0.9.16
43
44 %if ! %with_included_talloc
45 BuildRequires: libtalloc-devel >= %{libtalloc_version}
46 Requires: libtalloc >= %{libtalloc_version}
47 %endif
48 %if ! %with_included_tdb
49 BuildRequires: libtdb-devel >= %{libtdb_version}
50 Requires: libtdb >= %{libtdb_version}
51 %endif
52 %if ! %with_included_tevent
53 BuildRequires: libtevent-devel >= %{libtevent_version}
54 Requires: libtevent >= %{libtevent_version}
55 %endif
56
57 # To build the ctdb-pcp-pmda package, run rpmbuild with "--with pmda"
58 %define with_pcp_pmda  %{?_with_pmda: 1} %{?!_with_pmda: 0}
59 %if %with_pcp_pmda
60 BuildRequires: pcp-libs-devel
61 %endif
62
63 %if %{with_systemd}
64 BuildRequires: systemd-units
65 %endif
66
67 %description
68 ctdb is the clustered database used by samba
69
70 #######################################################################
71
72
73
74 %prep
75 %setup -q
76 # setup the init script and sysconfig file
77 %setup -T -D -n ctdb-%{version} -q
78
79 %build
80
81 ## check for ccache
82 if ccache -h >/dev/null 2>&1 ; then
83         CC="ccache gcc"
84 else
85         CC="gcc"
86 fi
87
88 export CC
89
90 CFLAGS="$RPM_OPT_FLAGS $EXTRA -D_GNU_SOURCE" ./buildtools/bin/waf configure \
91         --builtin-libraries=replace,popt \
92         --bundled-libraries=!talloc,!tevent,!tdb \
93         --minimum-library-version=talloc:%libtalloc_version,tdb:%libtdb_version,tevent:%libtevent_version \
94 %if %with_pcp_pmda
95         --enable-pmda \
96 %endif
97         --prefix=%{_prefix} \
98         --includedir=%{_includedir}/ctdb \
99         --libdir=%{_libdir} \
100         --libexecdir=%{_libexecdir} \
101         --sysconfdir=%{_sysconfdir} \
102         --mandir=%{_mandir} \
103         --localstatedir="/var"
104
105 ./buildtools/bin/waf build
106
107 %install
108 # Clean up in case there is trash left from a previous build
109 rm -rf $RPM_BUILD_ROOT
110
111 # Create the target build directory hierarchy
112 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig
113 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sudoers.d
114
115 DESTDIR=$RPM_BUILD_ROOT ./buildtools/bin/waf install
116
117 install -m644 config/ctdb.sysconfig $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/ctdb
118
119 %if %{with_systemd}
120 mkdir -p $RPM_BUILD_ROOT%{_unitdir}
121 install -m 755 config/ctdb.service $RPM_BUILD_ROOT%{_unitdir}
122 %else
123 mkdir -p $RPM_BUILD_ROOT%{initdir}
124 install -m755 config/ctdb.init $RPM_BUILD_ROOT%{initdir}/ctdb
125 %endif
126
127 # This is a hack. All documents should be installed in /usr/share/doc.
128 rm -f $RPM_BUILD_ROOT%{_sysconfdir}/ctdb/events.d/README
129 cp config/events.d/README README.eventscripts
130 rm -f $RPM_BUILD_ROOT%{_sysconfdir}/ctdb/nfs-checks.d/README
131 cp config/nfs-checks.d/README README.nfs-checks.d
132 cp config/notify.d.README README.notify.d
133
134 # Remove "*.old" files
135 find $RPM_BUILD_ROOT -name "*.old" -exec rm -f {} \;
136
137 %clean
138 rm -rf $RPM_BUILD_ROOT
139
140
141 #######################################################################
142 ## Files section                                                     ##
143 #######################################################################
144
145 %files
146 %defattr(-,root,root)
147
148 %config(noreplace) %{_sysconfdir}/sysconfig/ctdb
149 %config(noreplace) %{_sysconfdir}/ctdb/notify.sh
150 %config(noreplace) %{_sysconfdir}/ctdb/debug-hung-script.sh
151 %config(noreplace) %{_sysconfdir}/ctdb/ctdb-crash-cleanup.sh
152 %config(noreplace) %{_sysconfdir}/ctdb/gcore_trace.sh
153 %config(noreplace) %{_sysconfdir}/ctdb/debug_locks.sh
154
155 %if %{with_systemd}
156 %{_unitdir}/ctdb.service
157 %else
158 %attr(755,root,root) %{initdir}/ctdb
159 %endif
160
161 %attr(755,root,root) %{_sysconfdir}/ctdb/notify.d
162
163 %doc README COPYING
164 %doc README.eventscripts README.notify.d
165 %doc doc/recovery-process.txt
166 %doc doc/*.html
167 %doc doc/examples
168 %{_sysconfdir}/sudoers.d/ctdb
169 %{_sysconfdir}/ctdb/functions
170 %{_sysconfdir}/ctdb/events.d/00.ctdb
171 %{_sysconfdir}/ctdb/events.d/01.reclock
172 %{_sysconfdir}/ctdb/events.d/05.system
173 %{_sysconfdir}/ctdb/events.d/10.interface
174 %{_sysconfdir}/ctdb/events.d/10.external
175 %{_sysconfdir}/ctdb/events.d/13.per_ip_routing
176 %{_sysconfdir}/ctdb/events.d/11.natgw
177 %{_sysconfdir}/ctdb/events.d/11.routing
178 %{_sysconfdir}/ctdb/events.d/20.multipathd
179 %{_sysconfdir}/ctdb/events.d/31.clamd
180 %{_sysconfdir}/ctdb/events.d/40.vsftpd
181 %{_sysconfdir}/ctdb/events.d/41.httpd
182 %{_sysconfdir}/ctdb/events.d/49.winbind
183 %{_sysconfdir}/ctdb/events.d/50.samba
184 %{_sysconfdir}/ctdb/events.d/60.nfs
185 %{_sysconfdir}/ctdb/events.d/70.iscsi
186 %{_sysconfdir}/ctdb/events.d/91.lvs
187 %{_sysconfdir}/ctdb/events.d/99.timeout
188 %config(noreplace) %{_sysconfdir}/ctdb/nfs-checks.d/00.portmapper.check
189 %config(noreplace) %{_sysconfdir}/ctdb/nfs-checks.d/10.status.check
190 %config(noreplace) %{_sysconfdir}/ctdb/nfs-checks.d/20.nfs.check
191 %config(noreplace) %{_sysconfdir}/ctdb/nfs-checks.d/30.nlockmgr.check
192 %config(noreplace) %{_sysconfdir}/ctdb/nfs-checks.d/40.mountd.check
193 %config(noreplace) %{_sysconfdir}/ctdb/nfs-checks.d/50.rquotad.check
194 %{_sysconfdir}/ctdb/statd-callout
195 %{_sysconfdir}/ctdb/nfs-linux-kernel-callout
196 %{_sbindir}/ctdbd
197 %{_sbindir}/ctdbd_wrapper
198 %{_bindir}/ctdb
199 %{_bindir}/ping_pong
200 %{_bindir}/ltdbtool
201 %{_bindir}/ctdb_diagnostics
202 %{_bindir}/onnode
203 %dir %{_libexecdir}/ctdb
204 %{_libexecdir}/ctdb/ctdb_lock_helper
205 %{_libexecdir}/ctdb/ctdb_event_helper
206 %{_libexecdir}/ctdb/ctdb_recovery_helper
207 %{_libexecdir}/ctdb/ctdb_mutex_fcntl_helper
208 %{_libexecdir}/ctdb/ctdb_natgw
209 %{_libexecdir}/ctdb/ctdb_lvs
210 %{_libexecdir}/ctdb/ctdb_killtcp
211 %{_libexecdir}/ctdb/smnotify
212 %dir %{_libdir}
213 %{_libdir}/ctdb/lib*
214 %{_libdir}/libtevent-unix-util.so.0*
215 %{_mandir}/man1/ctdb.1.gz
216 %{_mandir}/man1/ctdbd.1.gz
217 %{_mandir}/man1/ctdbd_wrapper.1.gz
218 %{_mandir}/man1/onnode.1.gz
219 %{_mandir}/man1/ltdbtool.1.gz
220 %{_mandir}/man1/ping_pong.1.gz
221 %{_mandir}/man5/ctdbd.conf.5.gz
222 %{_mandir}/man7/ctdb.7.gz
223 %{_mandir}/man7/ctdb-statistics.7.gz
224 %{_mandir}/man7/ctdb-tunables.7.gz
225
226
227 %package devel
228 Summary: CTDB development libraries
229 Group: Development/Libraries
230
231 %description devel
232 development libraries for ctdb
233
234 %files devel
235 %defattr(-,root,root)
236 %{_includedir}/ctdb/util/*.h
237 %{_libdir}/libtevent-unix-util.so
238
239 %package tests
240 Summary: CTDB test suite
241 Group: Development/Tools
242 Requires: ctdb = %{version}
243 Requires: nc
244
245 %description tests
246 test suite for ctdb
247
248 %files tests
249 %defattr(-,root,root)
250 %dir %{_datadir}/%{name}-tests
251 %{_datadir}/%{name}-tests/*
252 %dir %{_libdir}/%{name}-tests
253 %{_libdir}/%{name}-tests/*
254 %{_bindir}/ctdb_run_tests
255 %{_bindir}/ctdb_run_cluster_tests
256 %doc tests/README
257
258 %if %with_pcp_pmda
259
260 %package pcp-pmda
261 Summary: CTDB PCP pmda support
262 Group: Development/Tools
263 Requires: ctdb = %{version}
264 Requires: pcp-libs
265
266 %description pcp-pmda
267 Performance Co-Pilot (PCP) support for CTDB
268
269 %files pcp-pmda
270 %dir /var/lib/pcp/pmdas/ctdb
271 /var/lib/pcp/pmdas/ctdb/*
272
273 %endif