More work to adapt to merged libcli/auth function prototypes
[Samba/bb.git] / packaging / RHEL-CTDB / samba.spec.tmpl
blobc8f31f3170d197f3d37accfb2fbf63db3a73d611
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)
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:      ctdb.1
10 Epoch:        0
11 License: GNU GPL version 3
12 Group: System Environment/Daemons
13 URL: http://www.samba.org/
15 Source: samba-%{version}.tar.bz2
17 # Don't depend on Net::LDAP
18 Source997: docs.tar.bz2
19 Source998: filter-requires-samba.sh
20 Source999: setup.tar.bz2
22 Prereq: /sbin/chkconfig /bin/mktemp /usr/bin/killall
23 Prereq: fileutils sed /etc/init.d
25 Requires: pam >= 0.64 %{auth} 
26 Requires: samba-common = %{version}-%{release}
27 Requires: logrotate >= 3.4 initscripts >= 5.54-1
28 Provides: samba = %{version}
30 Prefix: /usr
31 BuildRoot: %{_tmppath}/%{name}-%{version}-root
32 BuildRequires: pam-devel, readline-devel, fileutils, libacl-devel, openldap-devel, krb5-devel, cups-devel, ctdb
34 # Working around perl dependency problem from docs
35 %define __perl_requires %{SOURCE998}
37 # rpm screws up the arch lib dir when using --target on RHEL5
38 %ifarch i386 i486 i586 i686 ppc s390
39 %define _libarch lib
40 %else
41 %define _libarch %_lib
42 %endif
44 %define _libarchdir /usr/%{_libarch}
47 %description
48 Samba is the protocol by which a lot of PC-related machines share
49 files, printers, and other information (such as lists of available
50 files and printers). The Windows NT, OS/2, and Linux operating systems
51 support this natively, and add-on packages can enable the same thing
52 for DOS, Windows, VMS, UNIX of all kinds, MVS, and more. This package
53 provides an SMB server that can be used to provide network services to
54 SMB (sometimes called "Lan Manager") clients. Samba uses NetBIOS over
55 TCP/IP (NetBT) protocols and does NOT need the NetBEUI (Microsoft Raw
56 NetBIOS frame) protocol.
59 ######################################################################
60 %package client
61 Summary: Samba (SMB) client programs.
62 Group: Applications/System
63 Requires: samba-common = %{version}-%{release}
64 Obsoletes: smbfs
65 Provides: samba-client = %{version}-%{release}
67 %description client
68 The samba-client package provides some SMB clients to compliment the
69 built-in SMB filesystem in Linux. These clients allow access of SMB
70 shares and printing to SMB printers.
73 #######################################################################
74 %package common
75 Summary: Files used by both Samba servers and clients.
76 Group: Applications/System
77 Provides: samba-common = %{version}-%{release}
79 %description common
80 Samba-common provides files necessary for both the server and client
81 packages of Samba.
84 #######################################################################
85 %package swat
86 Summary: The Samba SMB server configuration program.
87 Group: Applications/System
88 Requires: samba = %{version} xinetd
89 Provides: samba-swat = %{version}-%{release}
91 %description swat
92 The samba-swat package includes the new SWAT (Samba Web Administration
93 Tool), for remotely managing Samba's smb.conf file using your favorite
94 Web browser.
96 %ifarch i386 i486 i586 i686 ppc s390
97 %package winbind-32bit
98 Summary:        Samba winbind compatibility package for 32bit apps on 64bit archs
99 Group:          Applications/System
101 %description winbind-32bit
102 Compatibility package for 32 bit apps on 64 bit architecures
103 %endif
106 #######################################################################
107 %package doc
108 Summary:      Samba Documentation
109 Group:        Documentation/Other
110 Provides:     samba-doc = %{version}-%{release}
111 Prereq:       /usr/bin/find /bin/rm /usr/bin/xargs
113 %description doc
114 The samba-doc package includes the HTML versions of the Samba manpages
115 utilized by SWAT as well as the HTML and PDF version of "Using Samba",
116 "Samba By Example", and "The Official Samba HOWTO and Reference Guide".
119 #######################################################################
121 %prep
122 %setup -q
124 # setup the vendor files (init scripts, etc...)
125 %setup -T -D -a 999 -n samba-%{version} -q
126 %setup -T -D -a 997 -n samba-%{version} -q
128 %build
130 /bin/cp setup/filter-requires-samba.sh %{SOURCE998}
132 cd source
133 # RPM_OPT_FLAGS="$RPM_OPT_FLAGS -D_FILE_OFFSET_BITS=64"
135 ## check for ccache
136 if ccache -h >/dev/null 2>&1 ; then
137         CC="ccache gcc"
138 else
139         CC="gcc"
142 export CC
144 ## always run autogen.sh
145 ./autogen.sh
147 CFLAGS="$RPM_OPT_FLAGS $EXTRA -D_GNU_SOURCE" ./configure \
148         --prefix=%{_prefix} \
149         --localstatedir=/var \
150         --with-configdir=%{_sysconfdir}/samba \
151         --libdir=%{_libarchdir} \
152         --with-modulesdir=%{_libarchdir}/samba \
153         --with-pammodulesdir=%{_libarch}/security \
154         --with-lockdir=/var/lib/samba \
155         --with-logfilebase=/var/log/samba \
156         --with-mandir=%{_mandir} \
157         --with-piddir=/var/run \
158         --with-privatedir=%{_sysconfdir}/samba \
159         --with-sambabook=%{_datadir}/swat/using_samba \
160         --with-swatdir=%{_datadir}/swat \
161         --disable-cups \
162         --with-acl-support \
163         --with-ads \
164         --with-automount \
165         --with-fhs \
166         --with-pam_smbpass \
167         --with-libsmbclient \
168         --with-libsmbsharemodes \
169         --without-smbwrapper \
170         --with-pam \
171         --with-quotas \
172         --with-shared-modules=idmap_rid,idmap_ad,idmap_tdb2,vfs_gpfs \
173         --with-syslog \
174         --with-utmp \
175         --with-cluster-support \
176         --with-ctdb=/usr/include \
177         --without-ldb \
178         --without-dnsupdate \
179         --with-aio-support
181 make showlayout
183 ## check for gcc 3.4 or later
184 CC_VERSION=`${CC} --version | head -1 | awk '{print $3}'`
185 CC_MAJOR=`echo ${CC_VERSION} | cut -d. -f 1`
186 CC_MINOR=`echo ${CC_VERSION} | cut -d. -f 2`
187 if [ ${CC_MAJOR} -ge 3 ]; then
188         if [ ${CC_MAJOR} -gt 3 -o ${CC_MINOR} -ge 4 ]; then
189                 make pch
190         fi
194 make CFLAGS="$RPM_OPT_FLAGS -D_GNU_SOURCE" %{?_smp_mflags} \
195         all modules pam_smbpass
197 # Remove some permission bits to avoid to many dependencies
198 cd ..
199 find examples docs -type f | xargs -r chmod -x
201 %install
202 # Clean up in case there is trash left from a previous build
203 rm -rf $RPM_BUILD_ROOT
205 # Create the target build directory hierarchy
206 mkdir -p $RPM_BUILD_ROOT%{_datadir}/swat/{help,include,using_samba/{figs,gifsa}}
207 mkdir -p $RPM_BUILD_ROOT%{_includedir}
208 mkdir -p $RPM_BUILD_ROOT%{_initrddir}
209 mkdir -p $RPM_BUILD_ROOT{%{_libarchdir},%{_includedir}}
210 mkdir -p $RPM_BUILD_ROOT%{_libarchdir}/samba/{auth,charset,idmap,vfs,pdb}
211 mkdir -p $RPM_BUILD_ROOT/%{_libarch}/security
212 mkdir -p $RPM_BUILD_ROOT%{_mandir}
213 mkdir -p $RPM_BUILD_ROOT%{_prefix}/{bin,sbin}
214 mkdir -p $RPM_BUILD_ROOT%{_prefix}/lib
215 mkdir -p $RPM_BUILD_ROOT/sbin
216 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/{logrotate.d,pam.d,samba}
217 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/{pam.d,logrotate.d}
218 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d
219 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/{samba,sysconfig}
220 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/xinetd.d
221 mkdir -p $RPM_BUILD_ROOT/var/lib/samba/winbindd_privileged
222 mkdir -p $RPM_BUILD_ROOT/var/{log,run/winbindd,spool}/samba
224 cd source
225 make DESTDIR=$RPM_BUILD_ROOT \
226         install
227 cd ..
229 # NSS winbind support
230 install -m 755 source/nsswitch/libnss_winbind.so $RPM_BUILD_ROOT/%{_libarch}/libnss_winbind.so.2
231 ( cd $RPM_BUILD_ROOT/%{_libarch};
232   ln -sf libnss_winbind.so.2  libnss_winbind.so )
234 # do not install libnss_wins.so in order to reduce dependencies
235 # (we do not need it for the samba-ctdb scenario)
237 #install -m 755 source/nsswitch/libnss_wins.so $RPM_BUILD_ROOT/%{_libarch}/libnss_wins.so
238 # ( cd $RPM_BUILD_ROOT/%{_libarch}; ln -sf libnss_wins.so  libnss_wins.so.2 )
241 ## cleanup
242 /bin/rm -rf $RPM_BUILD_ROOT/usr/lib*/samba/security
244 # Install the miscellany
245 echo 127.0.0.1 localhost > $RPM_BUILD_ROOT%{_sysconfdir}/samba/lmhosts
247 install -m644 setup/samba.log $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/samba
248 install -m644 setup/swat $RPM_BUILD_ROOT%{_sysconfdir}/xinetd.d/swat
249 install -m644 setup/samba.sysconfig $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/samba
250 install -m755 setup/smb.init $RPM_BUILD_ROOT%{initdir}/smb
251 install -m755 setup/winbind.init $RPM_BUILD_ROOT%{initdir}/winbind
252 install -m644 setup/samba.pamd $RPM_BUILD_ROOT%{_sysconfdir}/pam.d/samba
253 install -m755 setup/smbprint $RPM_BUILD_ROOT%{_bindir}
254 install -m644 setup/smbusers $RPM_BUILD_ROOT%{_sysconfdir}/samba/smbusers
255 install -m644 setup/smb.conf $RPM_BUILD_ROOT%{_sysconfdir}/samba/smb.conf
256 install -m755 source/bin/mount.cifs $RPM_BUILD_ROOT/sbin/mount.cifs
257 install -m755 source/bin/umount.cifs $RPM_BUILD_ROOT/sbin/umount.cifs
258 install -m755 source/script/mksmbpasswd.sh $RPM_BUILD_ROOT%{_bindir}
260 /bin/rm $RPM_BUILD_ROOT%{_sbindir}/*mount.cifs
262 ln -s ../..%{initdir}/smb  $RPM_BUILD_ROOT%{_sbindir}/samba
263 ln -s ../..%{initdir}/winbind  $RPM_BUILD_ROOT%{_sbindir}/winbind
265 # Remove "*.old" files
266 find $RPM_BUILD_ROOT -name "*.old" -exec rm -f {} \;
268 ## don't duplicate the docs.  These are installed by/with SWAT
269 rm -rf docs/htmldocs
270 rm -rf docs/manpages
271 ( cd docs; ln -s %{_prefix}/share/swat/help htmldocs )
274 ## Clean out man pages for tools not installed here
276 rm -f $RPM_BUILD_ROOT%{_mandir}/man1/log2pcap.1*
277 rm -f $RPM_BUILD_ROOT%{_mandir}/man1/smbsh.1*
278 rm -f $RPM_BUILD_ROOT%{_mandir}/man5/vfstest.1*
281 %clean
282 rm -rf $RPM_BUILD_ROOT
284 %post
285 ## deal with an upgrade from a broken 3.0.21b RPM
286 if [ "$1" -eq "2" ]; then
287         if [ -d /var/cache/samba ]; then
288                 for file in `ls /var/cache/samba/*tdb`; do
289                         /bin/cp -up $file /var/lib/samba/`basename $file`
290                 done
291                 mkdir -p /var/lib/samba/eventlog
292                 for file in `ls /var/cache/samba/eventlog/*tdb`; do
293                         /bin/cp -up $file /var/lib/samba/eventlog/`basename $file`
294                 done
295                 /bin/mv /var/cache/samba /var/cache/samba.moved
296         fi
299 if [ "$1" -ge "1" ]; then
300         /sbin/service smb condrestart >/dev/null 2>&1 || :
303 %preun
304 if [ $1 = 0 ] ; then
305     /sbin/service smb stop >/dev/null 2>&1 || :
306     /sbin/chkconfig --del smb
307     # rm -rf /var/log/samba/* /var/lib/samba/*
309 exit 0
311 #%postun
313 %post swat
314 # Add swat entry to /etc/services if not already there.
315 if [ ! "`grep ^\s**swat /etc/services`" ]; then
316         echo 'swat        901/tcp     # Add swat service used via inetd' >> /etc/services
319 %post common
320 /sbin/ldconfig
322 if [ "$1" -ge "1" ]; then
323         /sbin/service winbind condrestart >/dev/null 2>&1 || :
326 %preun common
327 if [ $1 = 0 ] ; then
328     /sbin/service winbind stop >/dev/null 2>&1 || :
329     /sbin/chkconfig --del winbind
331 exit 0
333 %postun common 
334 /sbin/ldconfig
336 #######################################################################
337 ## Files section                                                     ##
338 #######################################################################
340 %files
341 %defattr(-,root,root)
343 %config(noreplace) %{_sysconfdir}/sysconfig/samba
344 %config(noreplace) %{_sysconfdir}/samba/smbusers
345 %attr(755,root,root) %config %{initdir}/smb
346 %config(noreplace) %{_sysconfdir}/logrotate.d/samba
347 %config(noreplace) %{_sysconfdir}/pam.d/samba
349 %attr(0755,root,root) %dir /var/log/samba
350 %attr(0755,root,root) %dir /var/lib/samba
351 %attr(1777,root,root) %dir /var/spool/samba
353 %{_sbindir}/samba
355 %{_sbindir}/smbd
356 %{_sbindir}/nmbd
358 %{_bindir}/mksmbpasswd.sh
359 %{_bindir}/smbcontrol
360 %{_bindir}/smbstatus
361 %{_bindir}/tdbbackup
362 %{_bindir}/tdbtool
363 %{_bindir}/tdbdump
364 %{_bindir}/eventlogadm
366 %{_libarchdir}/samba/idmap/*.so
367 %{_libarchdir}/samba/nss_info/*.so
368 %{_libarchdir}/samba/vfs/*.so
369 %{_libarchdir}/samba/auth/*.so
371 %{_mandir}/man1/smbcontrol.1*
372 %{_mandir}/man1/smbstatus.1*
373 %{_mandir}/man1/vfstest.1*
374 %{_mandir}/man5/smbpasswd.5*
375 %{_mandir}/man7/samba.7*
376 %{_mandir}/man8/nmbd.8*
377 %{_mandir}/man8/pdbedit.8*
378 %{_mandir}/man8/smbd.8*
379 %{_mandir}/man8/tdbbackup.8*
380 %{_mandir}/man8/tdbdump.8*
381 %{_mandir}/man8/tdbtool.8*
382 %{_mandir}/man8/eventlogadm.8*
383 %{_mandir}/man8/vfs_*.8*
384 %{_mandir}/man8/idmap_*.8*
387 ##########
389 %files doc
390 %defattr(-,root,root)
391 %doc README COPYING Manifest 
392 %doc WHATSNEW.txt Roadmap
393 %doc docs
394 %doc examples/autofs examples/LDAP examples/libsmbclient examples/misc examples/printer-accounting
395 %doc examples/printing
397 ##########
399 %files swat
400 %defattr(-,root,root)
401 %config(noreplace) %{_sysconfdir}/xinetd.d/swat
402 %dir %{_datadir}/swat
403 %{_datadir}/swat/*
404 %{_sbindir}/swat
405 %{_mandir}/man8/swat.8*
406 %attr(755,root,root) %{_libarchdir}/samba/*.msg
408 ##########
410 %files client
411 %defattr(-,root,root)
412 /sbin/mount.cifs
413 /sbin/umount.cifs
415 %{_sbindir}/cifs.upcall
417 %{_bindir}/rpcclient
418 %{_bindir}/smbcacls
419 %{_bindir}/findsmb
420 %{_bindir}/nmblookup
421 %{_bindir}/smbget
422 %{_bindir}/smbclient
423 %{_bindir}/smbprint
424 %{_bindir}/smbspool
425 %{_bindir}/smbtar
426 %{_bindir}/smbtree
428 %{_mandir}/man8/mount.cifs.8.*
429 %{_mandir}/man8/umount.cifs.8.*
430 %{_mandir}/man8/cifs.upcall.8*
431 %{_mandir}/man8/smbspool.8*
432 %{_mandir}/man1/smbget.1*
433 %{_mandir}/man5/smbgetrc.5*
434 %{_mandir}/man1/findsmb.1*
435 %{_mandir}/man1/nmblookup.1*
436 %{_mandir}/man1/rpcclient.1*
437 %{_mandir}/man1/smbcacls.1*
438 %{_mandir}/man1/smbclient.1*
439 %{_mandir}/man1/smbtar.1*
440 %{_mandir}/man1/smbtree.1*
442 ##########
444 %files common
445 %defattr(-,root,root)
446 %dir %{_sysconfdir}/samba
447 %dir %{_libarchdir}/samba
448 %dir %{_libarchdir}/samba/charset
449 %config(noreplace) %{_sysconfdir}/samba/smb.conf
450 %config(noreplace) %{_sysconfdir}/samba/lmhosts
451 %attr(755,root,root) %config %{initdir}/winbind
453 #%attr(755,root,root) /%{_libarch}/libnss_wins.so*
454 %attr(755,root,root) /%{_libarch}/libnss_winbind.so*
455 %attr(755,root,root) /%{_libarch}/security/pam_winbind.so
456 %attr(755,root,root) /%{_libarch}/security/pam_smbpass.so
458 %{_includedir}/libsmbclient.h
459 %{_libarchdir}/libsmbclient.*
460 #%{_includedir}/libmsrpc.h
461 #%{_libarchdir}/libmsrpc.*
462 %{_includedir}/smb_share_modes.h
463 %{_libarchdir}/libsmbsharemodes.*
465 %{_libarchdir}/samba/*.dat
466 %{_libarchdir}/samba/charset/*.so
468 %{_includedir}/netapi.h
469 %{_includedir}/wbclient.h
470 %{_includedir}/talloc.h
471 %{_includedir}/tdb.h
472 %{_libarchdir}/libnetapi.so*
473 %{_libarchdir}/libtalloc.so*
474 %{_libarchdir}/libtdb.so*
475 %{_libarchdir}/libwbclient.so*
477 %{_sbindir}/winbind
479 %{_sbindir}/winbindd
480 %{_bindir}/testparm
481 %{_bindir}/smbpasswd
482 %{_bindir}/profiles
483 %{_bindir}/net
484 %{_bindir}/ldbadd
485 %{_bindir}/ldbdel
486 %{_bindir}/ldbedit
487 %{_bindir}/ldbmodify
488 %{_bindir}/ldbsearch
489 %{_bindir}/wbinfo
490 %{_bindir}/ntlm_auth
491 %{_bindir}/pdbedit
492 %{_bindir}/smbcquotas
494 %{_mandir}/man1/ntlm_auth.1*
495 %{_mandir}/man1/profiles.1*
496 %{_mandir}/man1/smbcquotas.1*
497 %{_mandir}/man1/testparm.1*
498 %{_mandir}/man5/smb.conf.5*
499 %{_mandir}/man5/lmhosts.5*
500 %{_mandir}/man8/smbpasswd.8*
501 %{_mandir}/man1/wbinfo.1*
502 %{_mandir}/man8/winbindd.8*
503 %{_mandir}/man8/net.8*
504 %{_mandir}/man7/pam_winbind.7*
505 %{_mandir}/man7/libsmbclient.7*
506 %{_mandir}/man1/ldbadd.1*
507 %{_mandir}/man1/ldbdel.1*
508 %{_mandir}/man1/ldbedit.1*
509 %{_mandir}/man1/ldbmodify.1*
510 %{_mandir}/man1/ldbsearch.1*
512 %ifarch i386 i486 i586 i686 ppc s390
513 %files winbind-32bit
514 %attr(755,root,root) /%{_libarch}/libnss_winbind.so*
515 #%attr(755,root,root) /%{_libarch}/libnss_wins.so*
516 %attr(755,root,root) /%{_libarchdir}/libtalloc.so*
517 %attr(755,root,root) /%{_libarchdir}/libtdb.so*
518 %attr(755,root,root) /%{_libarch}/security/pam_winbind.so
519 %endif
523 %changelog
524 * Fri Jan 16 2004 Gerald (Jerry) Carter <jerry@samba,org>
525 - Removed ChangeLog entries since they are kept in CVS