r15169: openldap2-devel is a suse package (not on RHEL)
[gd/samba-autobuild/.git] / packaging / RHEL / samba.spec.tmpl
1 %define initdir %{_sysconfdir}/rc.d/init.d
2 %define auth %(test -f /etc/pam.d/system-auth && echo /etc/pam.d/system-auth || echo)
3
4 Summary: Samba SMB client and server
5 Vendor: Samba Team
6 Packager: Samba Team <samba@samba.org>
7 Name:         samba
8 Version:      PVERSION
9 Release:      PRELEASEPRPMREV
10 License: GNU GPL version 2
11 Group: System Environment/Daemons
12 URL: http://www.samba.org/
13
14 Source: samba-%{version}.tar.bz2
15
16 # Don't depend on Net::LDAP
17 Source998: filter-requires-samba.sh
18 Source999: setup.tar.bz2
19
20 Prereq: /sbin/chkconfig /bin/mktemp /usr/bin/killall
21 Prereq: fileutils sed /etc/init.d
22
23 Requires: pam >= 0.64 %{auth} 
24 Requires: samba-common = %{version}-%{release}
25 Requires: logrotate >= 3.4 initscripts >= 5.54-1
26 Provides: samba = %{version}
27
28 Prefix: /usr
29 BuildRoot: %{_tmppath}/%{name}-%{version}-root
30 BuildRequires: pam-devel, readline-devel, fileutils, libacl-devel, openldap-devel, krb5-devel, cups-devel
31
32 # Working around perl dependency problem from docs
33 %define __perl_requires %{SOURCE998}
34
35
36 %description
37 Samba is the protocol by which a lot of PC-related machines share
38 files, printers, and other information (such as lists of available
39 files and printers). The Windows NT, OS/2, and Linux operating systems
40 support this natively, and add-on packages can enable the same thing
41 for DOS, Windows, VMS, UNIX of all kinds, MVS, and more. This package
42 provides an SMB server that can be used to provide network services to
43 SMB (sometimes called "Lan Manager") clients. Samba uses NetBIOS over
44 TCP/IP (NetBT) protocols and does NOT need the NetBEUI (Microsoft Raw
45 NetBIOS frame) protocol.
46
47
48 #######################################################################
49 %package client
50 Summary: Samba (SMB) client programs.
51 Group: Applications/System
52 Requires: samba-common = %{version}-%{release}
53 Obsoletes: smbfs
54 Provides: samba-client = %{version}-%{release}
55
56 %description client
57 The samba-client package provides some SMB clients to compliment the
58 built-in SMB filesystem in Linux. These clients allow access of SMB
59 shares and printing to SMB printers.
60
61
62 #######################################################################
63 %package common
64 Summary: Files used by both Samba servers and clients.
65 Group: Applications/System
66 Provides: samba-common = %{version}-%{release}
67
68 %description common
69 Samba-common provides files necessary for both the server and client
70 packages of Samba.
71
72
73 #######################################################################
74 %package swat
75 Summary: The Samba SMB server configuration program.
76 Group: Applications/System
77 Requires: samba = %{version} xinetd
78 Provides: samba-swat = %{version}-%{release}
79
80 %description swat
81 The samba-swat package includes the new SWAT (Samba Web Administration
82 Tool), for remotely managing Samba's smb.conf file using your favorite
83 Web browser.
84
85
86 #######################################################################
87 %package doc
88 Summary:      Samba Documentation
89 Group:        Documentation/Other
90 Provides:     samba-doc = %{version}-%{release}
91 Prereq:       /usr/bin/find /bin/rm /usr/bin/xargs
92
93 %description doc
94 The samba-doc package includes the HTML versions of the Samba manpages
95 utilized by SWAT as well as the HTML and PDF version of "Using Samba",
96 "Samba By Example", and "The Official Samba HOWTO and Reference Guide".
97
98
99 #######################################################################
100
101 %prep
102 %setup -q
103
104 # setup the vendor files (init scripts, etc...)
105 %setup -T -D -a 999 -n samba-%{version} -q
106
107 %build
108
109 /bin/cp setup/filter-requires-samba.sh %{SOURCE998}
110
111 cd source
112 # RPM_OPT_FLAGS="$RPM_OPT_FLAGS -D_FILE_OFFSET_BITS=64"
113
114 ## check for ccache
115 ccache -h 2>&1 > /dev/null
116 #if [ $? -eq 0 ]; then
117 #       CC="ccache gcc"
118 #else
119         CC="gcc"
120 #fi 
121
122 ## always run autogen.sh
123 ./autogen.sh
124
125 CFLAGS="$RPM_OPT_FLAGS $EXTRA -D_GNU_SOURCE" ./configure \
126         --prefix=%{_prefix} \
127         --localstatedir=/var \
128         --with-configdir=%{_sysconfdir}/samba \
129         --with-libdir=%{_libdir}/samba \
130         --with-lockdir=/var/lib/samba \
131         --with-logfilebase=/var/log/samba \
132         --with-mandir=%{_mandir} \
133         --with-piddir=/var/run \
134         --with-privatedir=%{_sysconfdir}/samba \
135         --with-sambabook=%{_datadir}/swat/using_samba \
136         --with-swatdir=%{_datadir}/swat \
137         --enable-cups \
138         --with-acl-support \
139         --with-ads \
140         --with-automount \
141         --with-fhs \
142         --with-pam_smbpass \
143         --with-libsmbclient \
144         --with-libsmbsharemodes \
145         --without-smbwrapper \
146         --with-pam \
147         --with-quotas \
148         --with-shared-modules=idmap_rid,idmap_ad \
149         --with-smbmount \
150         --with-syslog \
151         --with-utmp 
152
153 make showlayout
154
155 make CFLAGS="$RPM_OPT_FLAGS -D_GNU_SOURCE"  proto 
156
157 ## check for gcc 3.4 or later
158 CC_VERSION=`${CC} --version | head -1 | awk '{print $3}'`
159 CC_MAJOR=`echo ${CC_VERSION} | cut -d. -f 1`
160 CC_MINOR=`echo ${CC_VERSION} | cut -d. -f 2`
161 if [ ${CC_MAJOR} -ge 3 ]; then
162         if [ ${CC_MAJOR} -gt 3 -o ${CC_MINOR} -ge 4 ]; then
163                 make pch
164         fi
165 fi
166
167
168 make CFLAGS="$RPM_OPT_FLAGS -D_GNU_SOURCE" %{?_smp_mflags} \
169         all modules pam_smbpass
170
171 ## build the cifs fs mount helper
172 cd client
173 gcc  -o mount.cifs $RPM_OPT_FLAGS  -D_GNU_SOURCE -Wall -D_GNU_SOURCE -D_LARGEFILE64_SOURCE mount.cifs.c
174 gcc  -o umount.cifs $RPM_OPT_FLAGS  -D_GNU_SOURCE -Wall -D_GNU_SOURCE -D_LARGEFILE64_SOURCE umount.cifs.c
175 cd ..
176
177 # Remove some permission bits to avoid to many dependencies
178 cd ..
179 find examples docs -type f | xargs -r chmod -x
180
181 %install
182 # Clean up in case there is trash left from a previous build
183 rm -rf $RPM_BUILD_ROOT
184
185 # Create the target build directory hierarchy
186 mkdir -p $RPM_BUILD_ROOT%{_datadir}/swat/{help,include,using_samba/{figs,gifsa}}
187 mkdir -p $RPM_BUILD_ROOT%{_includedir}
188 mkdir -p $RPM_BUILD_ROOT%{_initrddir}
189 mkdir -p $RPM_BUILD_ROOT{%{_libdir},%{_includedir}}
190 mkdir -p $RPM_BUILD_ROOT%{_libdir}/samba/{auth,charset,idmap,vfs,pdb}
191 mkdir -p $RPM_BUILD_ROOT/%{_lib}/security
192 mkdir -p $RPM_BUILD_ROOT%{_mandir}
193 mkdir -p $RPM_BUILD_ROOT%{_prefix}/{bin,sbin}
194 mkdir -p $RPM_BUILD_ROOT%{_prefix}/lib
195 mkdir -p $RPM_BUILD_ROOT/sbin
196 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/{logrotate.d,pam.d,samba}
197 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/{pam.d,logrotate.d}
198 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d
199 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/{samba,sysconfig}
200 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/xinetd.d
201 mkdir -p $RPM_BUILD_ROOT/var/lib/samba/winbindd_privileged
202 mkdir -p $RPM_BUILD_ROOT/var/{log,run/winbindd,spool}/samba
203
204 cd source
205 make DESTDIR=$RPM_BUILD_ROOT \
206         install
207 cd ..
208
209 # pam_smbpass
210 cp source/bin/pam_smbpass.so $RPM_BUILD_ROOT/%{_lib}/security/pam_smbpass.so
211
212 # NSS & PAM winbind support
213 install -m 755 source/bin/pam_winbind.so $RPM_BUILD_ROOT/%{_lib}/security/pam_winbind.so
214 install -m 755 source/nsswitch/libnss_winbind.so $RPM_BUILD_ROOT/%{_lib}/libnss_winbind.so
215 install -m 755 source/nsswitch/libnss_wins.so $RPM_BUILD_ROOT/%{_lib}/libnss_wins.so
216 ( cd $RPM_BUILD_ROOT/%{_lib};
217   ln -sf libnss_winbind.so  libnss_winbind.so.2;
218   ln -sf libnss_wins.so  libnss_wins.so.2 )
219
220 # make install puts libsmbclient.so in the wrong place on x86_64
221 rm -f $RPM_BUILD_ROOT/usr/lib*/samba/libsmbclient.so $RPM_BUILD_ROOT/usr/lib*/samba/libsmbclient.a || true
222 install -m 755 source/bin/libsmbclient.so $RPM_BUILD_ROOT%{_libdir}/libsmbclient.so
223 install -m 755 source/bin/libsmbclient.a $RPM_BUILD_ROOT%{_libdir}/libsmbclient.a
224 install -m 644 source/include/libsmbclient.h $RPM_BUILD_ROOT%{_includedir}
225 ln -s %{_libdir}/libsmbclient.so $RPM_BUILD_ROOT%{_libdir}/libsmbclient.so.0
226
227 # make install puts libmsrpc.so in the wrong place on x86_64
228 rm -f $RPM_BUILD_ROOT/usr/lib*/samba/libmsrpc.so $RPM_BUILD_ROOT/usr/lib*/samba/libmsrpc.a || true
229 install -m 755 source/bin/libmsrpc.so $RPM_BUILD_ROOT%{_libdir}/libmsrpc.so
230 install -m 755 source/bin/libmsrpc.a $RPM_BUILD_ROOT%{_libdir}/libmsrpc.a
231 install -m 644 source/include/libmsrpc.h $RPM_BUILD_ROOT%{_includedir}
232 rm -f $RPM_BUILD_ROOT%{_libdir}/samba/libmsrpc.*
233 ln -s /%{_libdir}/libmsrpc.so $RPM_BUILD_ROOT%{_libdir}/libmsrpc.so.0
234
235 # Install pam_smbpass.so
236 install -m755 source/bin/pam_smbpass.so $RPM_BUILD_ROOT/%{_lib}/security/pam_smbpass.so
237
238 ## cleanup
239 /bin/rm -rf $RPM_BUILD_ROOT/usr/lib*/samba/security
240
241 # we need a symlink for mount to recognise the smb and smbfs filesystem types
242 ln -sf %{_prefix}/bin/smbmount $RPM_BUILD_ROOT/sbin/mount.smbfs
243 ln -sf %{_prefix}/bin/smbmount $RPM_BUILD_ROOT/sbin/mount.smb
244 /bin/rm -f $RPM_BUILD_ROOT/mount.smbfs
245
246 # Install the miscellany
247 echo 127.0.0.1 localhost > $RPM_BUILD_ROOT%{_sysconfdir}/samba/lmhosts
248
249 install -m644 setup/samba.log $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/samba
250 install -m644 setup/swat $RPM_BUILD_ROOT%{_sysconfdir}/xinetd.d/swat
251 install -m644 setup/samba.sysconfig $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/samba
252 install -m755 setup/smb.init $RPM_BUILD_ROOT%{initdir}/smb
253 install -m755 setup/winbind.init $RPM_BUILD_ROOT%{initdir}/winbind
254 install -m644 setup/samba.pamd $RPM_BUILD_ROOT%{_sysconfdir}/pam.d/samba
255 install -m755 setup/smbprint $RPM_BUILD_ROOT%{_bindir}
256 install -m644 setup/smbusers $RPM_BUILD_ROOT%{_sysconfdir}/samba/smbusers
257 install -m644 setup/smb.conf $RPM_BUILD_ROOT%{_sysconfdir}/samba/smb.conf
258 install -m755 source/client/mount.cifs $RPM_BUILD_ROOT/sbin/mount.cifs
259 install -m755 source/client/umount.cifs $RPM_BUILD_ROOT/sbin/umount.cifs
260 install -m755 source/script/mksmbpasswd.sh $RPM_BUILD_ROOT%{_bindir}
261
262 /bin/rm $RPM_BUILD_ROOT%{_sbindir}/*mount.cifs
263
264 ln -s ../..%{initdir}/smb  $RPM_BUILD_ROOT%{_sbindir}/samba
265 ln -s ../..%{initdir}/winbind  $RPM_BUILD_ROOT%{_sbindir}/winbind
266
267 # Remove "*.old" files
268 find $RPM_BUILD_ROOT -name "*.old" -exec rm -f {} \;
269
270 ## don't duplicate the docs.  These are installed by/with SWAT
271 rm -rf docs/htmldocs
272 rm -rf docs/manpages
273 ( cd docs; ln -s %{_prefix}/share/swat/help htmldocs )
274
275 ##
276 ## Clean out man pages for tools not installed here
277 ##
278 rm -f $RPM_BUILD_ROOT%{_mandir}/man1/log2pcap.1*
279 rm -f $RPM_BUILD_ROOT%{_mandir}/man1/smbsh.1*
280 rm -f $RPM_BUILD_ROOT%{_mandir}/man5/vfstest.1*
281
282
283 %clean
284 rm -rf $RPM_BUILD_ROOT
285
286 %post
287 ## deal with an upgrade from a broken 3.0.21b RPM
288 if [ "$1" -eq "2" ]; then
289         if [ -d /var/cache/samba ]; then
290                 for file in `ls /var/cache/samba/*tdb`; do
291                         /bin/cp -up $file /var/lib/samba/`basename $file`
292                 done
293                 mkdir -p /var/lib/samba/eventlog
294                 for file in `ls /var/cache/samba/eventlog/*tdb`; do
295                         /bin/cp -up $file /var/lib/samba/eventlog/`basename $file`
296                 done
297                 /bin/mv /var/cache/samba /var/cache/samba.moved
298         fi
299 fi
300
301 %preun
302 if [ $1 = 0 ] ; then
303     /sbin/chkconfig --del smb
304     /sbin/chkconfig --del winbind
305     # rm -rf /var/log/samba/* /var/lib/samba/*
306     /sbin/service smb stop >/dev/null 2>&1
307 fi
308 exit 0
309
310 %postun
311 if [ "$1" -ge "1" ]; then
312         %{initdir}/smb restart >/dev/null 2>&1
313 fi      
314
315
316 %post swat
317 # Add swat entry to /etc/services if not already there.
318 if [ ! "`grep ^\s**swat /etc/services`" ]; then
319         echo 'swat        901/tcp     # Add swat service used via inetd' >> /etc/services
320 fi
321
322 %post common
323 /sbin/ldconfig
324
325 %postun common 
326 /sbin/ldconfig
327
328 #######################################################################
329 ## Files section                                                     ##
330 #######################################################################
331
332 %files
333 %defattr(-,root,root)
334
335 %config(noreplace) %{_sysconfdir}/sysconfig/samba
336 %config(noreplace) %{_sysconfdir}/samba/smbusers
337 %attr(755,root,root) %config %{initdir}/smb
338 %attr(755,root,root) %config %{initdir}/winbind
339 %config(noreplace) %{_sysconfdir}/logrotate.d/samba
340 %config(noreplace) %{_sysconfdir}/pam.d/samba
341
342 %attr(0755,root,root) %dir /var/log/samba
343 %attr(0755,root,root) %dir /var/lib/samba
344 %attr(1777,root,root) %dir /var/spool/samba
345
346 %{_sbindir}/samba
347 %{_sbindir}/winbind
348
349 %{_sbindir}/smbd
350 %{_sbindir}/nmbd
351 %{_sbindir}/winbindd
352
353 %attr(755,root,root) /%{_lib}/libnss_wins.so*
354 %attr(755,root,root) /%{_lib}/libnss_winbind.so*
355 %attr(755,root,root) /%{_lib}/security/pam_winbind.so
356 %attr(755,root,root) /%{_lib}/security/pam_smbpass.so
357
358 %{_bindir}/mksmbpasswd.sh
359 %{_bindir}/smbcontrol
360 %{_bindir}/smbstatus
361 %{_bindir}/tdbbackup
362 %{_bindir}/tdbtool
363 %{_bindir}/tdbdump
364 %{_bindir}/wbinfo
365 %{_bindir}/ntlm_auth
366 %{_bindir}/pdbedit
367 %{_bindir}/eventlogadm
368
369 %{_libdir}/samba/idmap/*.so
370 %{_libdir}/samba/vfs/*.so
371 %{_libdir}/samba/auth/*.so
372
373 %{_mandir}/man1/smbcontrol.1*
374 %{_mandir}/man1/smbstatus.1*
375 %{_mandir}/man1/vfstest.1*
376 %{_mandir}/man5/smbpasswd.5*
377 %{_mandir}/man7/samba.7*
378 %{_mandir}/man8/nmbd.8*
379 %{_mandir}/man8/pdbedit.8*
380 %{_mandir}/man8/smbd.8*
381 %{_mandir}/man7/pam_winbind.7*
382 %{_mandir}/man8/tdbbackup.8*
383 %{_mandir}/man8/tdbdump.8*
384 %{_mandir}/man8/winbindd.8*
385 %{_mandir}/man1/ntlm_auth.1*
386 %{_mandir}/man1/wbinfo.1*
387
388
389 ##########
390
391 %files doc
392 %defattr(-,root,root)
393 %doc README COPYING Manifest 
394 %doc WHATSNEW.txt Roadmap
395 %doc docs
396 %doc examples/autofs examples/LDAP examples/libsmbclient examples/misc examples/printer-accounting
397 %doc examples/printing
398 %doc %{_datadir}/swat/help
399 %doc %{_datadir}/swat/using_samba
400
401 ##########
402
403 %files swat
404 %defattr(-,root,root)
405 %config(noreplace) %{_sysconfdir}/xinetd.d/swat
406 %dir %{_datadir}/swat
407 %{_datadir}/swat/include
408 %{_datadir}/swat/images
409 %{_datadir}/swat/lang
410 %{_sbindir}/swat
411 %{_mandir}/man8/swat.8*
412
413 ##########
414
415 %files client
416 %defattr(-,root,root)
417 /sbin/mount.smb
418 /sbin/mount.smbfs
419 /sbin/mount.cifs
420 /sbin/umount.cifs
421
422 %{_bindir}/rpcclient
423 %{_bindir}/smbcacls
424 %{_bindir}/smbmount
425 %{_bindir}/smbmnt
426 %{_bindir}/smbumount
427 %{_bindir}/findsmb
428 %{_bindir}/smbcquotas
429 %{_bindir}/nmblookup
430 %{_bindir}/smbget
431 %{_bindir}/smbclient
432 %{_bindir}/smbprint
433 %{_bindir}/smbspool
434 %{_bindir}/smbtar
435 %{_bindir}/net
436 %{_bindir}/smbtree
437
438 %{_mandir}/man8/smbmnt.8*
439 %{_mandir}/man8/smbmount.8*
440 %{_mandir}/man8/smbumount.8*
441 %{_mandir}/man8/mount.cifs.8.*
442 %{_mandir}/man8/umount.cifs.8.*
443 %{_mandir}/man8/smbspool.8*
444 %{_mandir}/man1/smbget.1*
445 %{_mandir}/man5/smbgetrc.5*
446 %{_mandir}/man1/findsmb.1*
447 %{_mandir}/man1/nmblookup.1*
448 %{_mandir}/man1/rpcclient.1*
449 %{_mandir}/man1/smbcacls.1*
450 %{_mandir}/man1/smbclient.1*
451 %{_mandir}/man1/smbtar.1*
452 %{_mandir}/man1/smbtree.1*
453 %{_mandir}/man8/net.8*
454 %{_mandir}/man1/smbcquotas.1*
455
456 ##########
457
458 %files common
459 %defattr(-,root,root)
460 %dir %{_sysconfdir}/samba
461 %config(noreplace) %{_sysconfdir}/samba/smb.conf
462 %config(noreplace) %{_sysconfdir}/samba/lmhosts
463
464 %{_includedir}/libsmbclient.h
465 %{_libdir}/libsmbclient.a
466 %{_libdir}/libsmbclient.so*
467 %{_includedir}/libmsrpc.h
468 %{_libdir}/libmsrpc.a
469 %{_libdir}/libmsrpc.so*
470
471 %{_libdir}/samba/*.dat
472 %{_libdir}/samba/*.msg
473 %{_libdir}/samba/charset/*.so
474
475 %{_bindir}/testparm
476 %{_bindir}/smbpasswd
477 %{_bindir}/profiles
478
479 %{_mandir}/man1/profiles.1*
480 %{_mandir}/man1/testparm.1*
481 %{_mandir}/man5/smb.conf.5*
482 %{_mandir}/man5/lmhosts.5*
483 %{_mandir}/man8/smbpasswd.8*
484 %{_mandir}/man7/libsmbclient.7*
485
486 %changelog
487 * Fri Jan 16 2004 Gerald (Jerry) Carter <jerry@samba,org>
488 - Removed ChangeLog entries since they are kept in CVS
489
490
491