build: a more portable way of finding waf in makefiles
[sfrench/samba-autobuild/.git] / packaging4 / Fedora / samba4.spec
1
2 %define main_release 5
3 %define alpha_version 5
4 %define samba_version 4.0.0alpha%{alpha_version}
5 %define tarball_name samba-4.0.0alpha%{alpha_version}
6
7 #Set what versions we require for tdb and talloc
8 %define tdb_version 1.1.1
9 %define talloc_version 1.2.0
10
11 %{!?python_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
12
13 Summary: The Samba4 CIFS and AD client and server suite
14 Name: samba4
15 Version: 4.0.0
16 Release: 0.%{main_release}.alpha%{alpha_version}%{?dist}
17 License: GPLv3+ and LGPLv3+
18 Group: System Environment/Daemons
19 URL: http://www.samba.org/
20
21 Source: http://download.samba.org/samba/ftp/samba4/%{tarball_name}.tar.gz
22
23 # To be removed when samba4 alpha6 is released
24 # From http://git.samba.org/?p=samba.git;a=commitdiff;h=7ca421eb32bed3c400f863b654712d922c82bfb9
25 Patch0: cplusplus-headers.patch
26
27 # Red Hat specific replacement-files
28 Source1: %{name}.log
29 Source4: %{name}.sysconfig
30 Source5: %{name}.init
31
32 Requires(pre): %{name}-common = %{version}-%{release}
33 Requires: pam >= 0:0.64
34 Requires: logrotate >= 0:3.4
35 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
36 Requires(pre): /usr/sbin/groupadd
37 Requires(post): /sbin/chkconfig, /sbin/service
38 Requires(preun): /sbin/chkconfig, /sbin/service
39 BuildRequires: pam-devel, readline-devel, ncurses-devel, libacl-devel, e2fsprogs-devel
40 BuildRequires: popt-devel, libattr-devel, libaio-devel, sed
41 BuildRequires:  perl(ExtUtils::MakeMaker)
42 BuildRequires: libtalloc-devel >= %{talloc_version}
43 BuildRequires: libtdb-devel >= %{tdb_version}
44
45 %description
46
47 Samba 4 is the ambitious next version of the Samba suite that is being
48 developed in parallel to the stable 3.0 series. The main emphasis in
49 this branch is support for the Active Directory logon protocols used
50 by Windows 2000 and above.
51
52 %package client
53 Summary: Samba client programs
54 Group: Applications/System
55 Requires: %{name}-common = %{version}-%{release}
56 Requires: %{name}-libs = %{version}-%{release}
57
58 %description client
59 The %{name}-client package provides some SMB/CIFS clients to complement
60 the built-in SMB/CIFS filesystem in Linux. These clients allow access
61 of SMB/CIFS shares and printing to SMB/CIFS printers.
62
63 %package libs
64 Summary: Samba libraries
65 Group: Applications/System
66
67 %description libs
68 The %{name}-libs package  contains the libraries needed by programs 
69 that link against the SMB, RPC and other protocols provided by the Samba suite.
70
71 %package python
72 Summary: Samba python libraries
73 Group: Applications/System
74 Requires: %{name}-libs = %{version}-%{release}
75
76 %description python
77 The %{name}-python package contains the python libraries needed by programs 
78 that use SMB, RPC and other Samba provided protocols in python programs/
79
80 %package devel
81 Summary: Developer tools for Samba libraries
82 Group: Development/Libraries
83 Requires: %{name}-libs = %{version}-%{release}
84
85 %description devel
86 The %{name}-devel package contains the header files for the libraries
87 needed to develop programs that link against the SMB, RPC and other
88 libraries in the Samba suite.
89
90 %package pidl
91 Summary: Perl IDL compiler
92 Group: Development/Tools
93 Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
94
95 %description pidl
96 The %{name}-pidl package contains the Perl IDL compiler used by Samba
97 and Wireshark to parse IDL and similar protocols
98
99 %package common
100 Summary: Files used by both Samba servers and clients
101 Group: Applications/System
102 Requires: %{name}-libs = %{version}-%{release}
103
104 %description common
105 %{Name}-common provides files necessary for both the server and client
106 packages of Samba.
107
108 %package winbind
109 Summary: Samba winbind
110 Group: Applications/System
111 Requires: %{name} = %{version}-%{release}
112
113 %description winbind
114 The samba-winbind package provides the winbind NSS library, and some
115 client tools.  Winbind enables Linux to be a full member in Windows
116 domains and to use Windows user and group accounts on Linux.
117
118
119 %prep
120 # TAG: change for non-pre
121 %setup -q -n %{tarball_name}
122 #%setup -q
123
124 # copy Red Hat specific scripts
125
126 # Upstream patches
127 %patch0 -p1 -b .
128
129 mv source/VERSION source/VERSION.orig
130 sed -e 's/SAMBA_VERSION_VENDOR_SUFFIX=$/&%{release}/' < source/VERSION.orig > source/VERSION
131 cd source
132 script/mkversion.sh
133 cd ..
134
135 %build
136 cd source
137
138 %configure \
139         --with-fhs \
140         --with-lockdir=/var/lib/%{name} \
141         --with-piddir=/var/run \
142         --with-privatedir=/var/lib/%{name}/private \
143         --with-logfilebase=/var/log/%{name} \
144         --sysconfdir=%{_sysconfdir}/%{name} \
145         --with-winbindd-socket-dir=/var/run/winbind \
146         --with-ntp-signd-socket-dir=/var/run/ntp_signd \
147         --disable-gnutls
148
149 #Build PIDL for installation into vendor directories before 'make proto' gets to it
150 (cd pidl && %{__perl} Makefile.PL INSTALLDIRS=vendor )
151
152 #Builds using PIDL the IDL and many other things 
153 make proto
154
155 make everything
156
157 %install
158 rm -rf $RPM_BUILD_ROOT
159
160 cd source
161
162 #Don't call 'make install' as we want to call out to the PIDL install manually 
163 make install DESTDIR=%{buildroot}
164
165 #Undo the PIDL install, we want to try again with the right options
166 rm -rf $RPM_BUILD_ROOT/%{_libdir}/perl5
167 rm -rf $RPM_BUILD_ROOT/%{_datadir}/perl5
168
169 #Install PIDL
170 ( cd pidl && make install PERL_INSTALL_ROOT=$RPM_BUILD_ROOT )
171
172 #Clean out crap left behind by the Pidl install
173 find $RPM_BUILD_ROOT -type f -name .packlist -exec rm -f {} \;
174 find $RPM_BUILD_ROOT -depth -type d -exec rmdir {} 2>/dev/null \;
175
176 cd ..
177
178 mkdir -p $RPM_BUILD_ROOT/%{_initrddir}
179 mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/logrotate.d
180 mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/%{name}
181 mkdir -p $RPM_BUILD_ROOT/var/run/winbindd
182 mkdir -p $RPM_BUILD_ROOT/var/run/ntp_signd
183 mkdir -p $RPM_BUILD_ROOT/var/lib/%{name}/winbindd_privileged
184 mkdir -p $RPM_BUILD_ROOT/var/log/%{name}/
185 mkdir -p $RPM_BUILD_ROOT/var/log/%{name}/old
186
187 mkdir -p $RPM_BUILD_ROOT/var/lib/%{name}
188 mkdir -p $RPM_BUILD_ROOT/var/lib/%{name}/private
189 mkdir -p $RPM_BUILD_ROOT/var/lib/%{name}/sysvol
190
191 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig
192
193 # Install other stuff
194 install -m755 %{SOURCE5} $RPM_BUILD_ROOT/%{_initrddir}/%{name}
195 install -m644 %{SOURCE1} $RPM_BUILD_ROOT/%{_sysconfdir}/logrotate.d/%{name}
196
197 # winbind
198 mkdir -p $RPM_BUILD_ROOT/%{_lib}
199 ln -sf ../%{_libdir}/libnss_winbind.so  $RPM_BUILD_ROOT/%{_lib}/libnss_winbind.so.2 
200
201 # libs {
202 mkdir -p $RPM_BUILD_ROOT%{_libdir} $RPM_BUILD_ROOT%{_includedir}
203
204 # }
205
206 install -m644 %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/%{name}
207
208 #clean out some stuff we don't want in the Fedora package
209 rm $RPM_BUILD_ROOT/%{_bindir}/autoidl.py*
210 rm $RPM_BUILD_ROOT/%{_bindir}/epdump.py*
211 rm $RPM_BUILD_ROOT/%{_bindir}/gentest
212 rm $RPM_BUILD_ROOT/%{_bindir}/locktest
213 rm $RPM_BUILD_ROOT/%{_bindir}/masktest
214 rm $RPM_BUILD_ROOT/%{_bindir}/minschema.py*
215 rm $RPM_BUILD_ROOT/%{_bindir}/rpcclient
216 rm $RPM_BUILD_ROOT/%{_bindir}/samba3dump
217 rm $RPM_BUILD_ROOT/%{_bindir}/setnttoken
218 rm $RPM_BUILD_ROOT/%{_bindir}/getntacl
219 rm $RPM_BUILD_ROOT/%{_datadir}/samba/js/base.js
220
221 #This makes the right links, as rpmlint requires that the
222 #ldconfig-created links be recorded in the RPM.
223 /sbin/ldconfig -N -n $RPM_BUILD_ROOT/%{_libdir}
224
225 #Fix up permission on perl install
226 %{_fixperms} $RPM_BUILD_ROOT/%{perl_vendorlib}
227
228 #Fix up permissions in source tree, for debuginfo
229 find source/heimdal -type f | xargs chmod -x
230
231 %clean
232 rm -rf $RPM_BUILD_ROOT
233
234 %pre
235 getent group wbpriv >/dev/null || groupadd -g 88 wbpriv
236 exit 0
237
238 %post
239 /sbin/chkconfig --add %{name}
240 if [ "$1" -ge "1" ]; then
241         /sbin/service %{name} condrestart >/dev/null 2>&1 || :
242 fi
243 exit 0
244
245 %preun
246 if [ $1 = 0 ] ; then
247         /sbin/service %{name} stop >/dev/null 2>&1 || :
248         /sbin/chkconfig --del %{name}
249 fi
250 exit 0
251
252 %post libs -p /sbin/ldconfig
253
254 %postun libs -p /sbin/ldconfig
255
256
257 %files
258 %defattr(-,root,root)
259 %{_sbindir}/smbd
260 %{_bindir}/smbstatus
261
262 %attr(755,root,root) %{_initrddir}/%{name}
263 %config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
264 %dir %{_datadir}/samba/setup
265 %{_datadir}/samba/setup/*
266 %dir /var/lib/%{name}/sysvol
267 %config(noreplace) %{_sysconfdir}/sysconfig/%{name}
268 %attr(0700,root,root) %dir /var/log/%{name}
269 %attr(0700,root,root) %dir /var/log/%{name}/old
270
271 %files libs
272 %defattr(-,root,root)
273 %doc WHATSNEW.txt NEWS PFIF.txt
274 %dir %{_datadir}/samba
275 %{_datadir}/samba/*.dat
276 %{_libdir}/*.so.*
277 #Only needed if Samba's build produces plugins
278 #%{_libdir}/samba
279 %dir %{_sysconfdir}/%{name}
280 #Need to mark this as being owned by Samba, but it is normally created
281 #by the provision script, which runs best if there is no existing
282 #smb.conf
283 #%config(noreplace) %{_sysconfdir}/%{name}/smb.conf
284
285 %files winbind
286 %defattr(-,root,root)
287 %{_bindir}/ntlm_auth
288 %{_bindir}/wbinfo
289 %{_libdir}/libnss_winbind.so
290 /%{_lib}/libnss_winbind.so.2
291 %dir /var/run/winbindd
292 %attr(750,root,wbpriv) %dir /var/lib/%{name}/winbindd_privileged
293
294 %files python
295 %defattr(-,root,root)
296 %{python_sitearch}/*
297
298 %files devel
299 %defattr(-,root,root)
300 %{_libdir}/libdcerpc.so
301 %{_libdir}/libdcerpc_atsvc.so
302 %{_libdir}/libdcerpc_samr.so
303 %{_libdir}/libgensec.so
304 %{_libdir}/libldb.so
305 %{_libdir}/libndr.so
306 %{_libdir}/libregistry.so
307 %{_libdir}/libsamba-hostconfig.so
308 %{_libdir}/libtorture.so
309
310 %{_libdir}/pkgconfig
311 %{_includedir}/*
312 %{_bindir}/ndrdump
313 %{_bindir}/nsstest
314
315 %files pidl
316 %defattr(-,root,root,-)
317 %{perl_vendorlib}/*
318 %{_mandir}/man1/pidl*
319 %{_mandir}/man3/Parse*
320 %attr(755,root,root) %{_bindir}/pidl
321
322 %files client
323 %defattr(-,root,root)
324 %{_bindir}/nmblookup
325 %{_bindir}/smbclient
326 %{_bindir}/cifsdd
327
328 %files common
329 %defattr(-,root,root)
330 %{_bindir}/net
331 %{_bindir}/testparm
332 %{_bindir}/ldbadd
333 %{_bindir}/ldbdel
334 %{_bindir}/ldbedit
335 %{_bindir}/ldbmodify
336 %{_bindir}/ldbsearch
337 %{_bindir}/ldbrename
338 %{_bindir}/ad2oLschema
339 %{_bindir}/oLschema2ldif
340 %{_bindir}/regdiff
341 %{_bindir}/regpatch
342 %{_bindir}/regshell
343 %{_bindir}/regtree
344 %{_bindir}/subunitrun
345 %{_bindir}/smbtorture
346
347 %dir /var/lib/%{name}
348 %attr(700,root,root) %dir /var/lib/%{name}/private
349 # We don't want to put a smb.conf in by default, provision should create it
350 #%config(noreplace) %{_sysconfdir}/%{name}/smb.conf
351
352 %doc COPYING
353 %doc WHATSNEW.txt
354
355 %changelog
356 * Fri Aug 29 2008 Andrew Bartlett <abartlet@samba.org> - 0:4.0.0-0.5.alpha5.fc10
357 - Fix licence tag (the binaries are built into a GPLv3 whole, so the BSD licence need not be mentioned)
358
359 * Fri Jul 25 2008 Andrew Bartlett <abartlet@samba.org> - 0:4.0.0-0.4.alpha5.fc10
360 - Remove talloc and tdb dependency (per https://bugzilla.redhat.com/show_bug.cgi?id=453083)
361 - Fix deps on chkconfig and service to main pkg (not -common) 
362   (per https://bugzilla.redhat.com/show_bug.cgi?id=453083)
363
364 * Mon Jul 21 2008 Brad Hards <bradh@frogmouth.ent> - 0:4.0.0-0.3.alpha5.fc10
365 - Use --sysconfdir instead of --with-configdir
366 - Add patch for C++ header compatibility
367
368 * Mon Jun 30 2008 Andrew Bartlett <abartlet@samba.org> - 0:4.0.0-0.2.alpha5.fc9
369 - Update per review feedback
370 - Update for alpha5
371
372 * Thu Jun 26 2008 Andrew Bartlett <abartlet@samba.org> - 0:4.0.0-0.1.alpha4.fc9
373 - Rework Fedora's Samba 3.2.0-1.rc2.16 spec file for Samba4