build: Be consistent with the name of smbtorture binaries
[Samba/gebeck_regimport.git] / packaging / RHEL-CTDB / samba.spec.tmpl
bloba57269ea0522943a6b82e0e988a6d3aada5e221d
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:      1GITHASH
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 Source998: filter-requires-samba.sh
19 Source999: setup.tar.bz2
21 Requires: /sbin/chkconfig /bin/mktemp /usr/bin/killall
22 Requires: fileutils sed /etc/init.d
24 Requires: pam >= 0.64 %{auth} 
25 Requires: samba-common = %{version}-%{release}
26 Provides: samba = %{version}
28 Prefix: /usr
29 BuildRoot: %{_tmppath}/%{name}-%{version}-root
30 BuildRequires: pam-devel, readline-devel, fileutils, libacl-devel, openldap-devel, krb5-devel, cups-devel, e2fsprogs-devel, gettext
31 # requirements for building the man pages:
32 BuildRequires: libxslt, docbook-utils, docbook-style-xsl, rsync
33 BuildRequires: ctdb-devel >= 1.2.25
35 # Working around perl dependency problem from docs
36 %define __perl_requires %{SOURCE998}
38 # rpm screws up the arch lib dir when using --target on RHEL5
39 %ifarch i386 i486 i586 i686 ppc s390
40 %define _libarch lib
41 %else
42 %define _libarch %_lib
43 %endif
45 %define _libarchdir /usr/%{_libarch}
47 %define numcpu  %(grep "^processor" /proc/cpuinfo |wc -l | sed -e 's/^0$/1/')
49 %define with_vfs_gpfs PGPFS_DEFAULT
50 %define with_vfs_tsmsm PGPFS_DEFAULT
52 %if %{with_vfs_tsmsm}
53 %define         vfs_tsmsm       ,vfs_tsmsm
54 %endif
56 %if %{with_vfs_gpfs}
57 %define         vfs_gpfs        ,vfs_gpfs
58 %endif
60 %define         vfs_modules %{?vfs_gpfs}%{?vfs_tsmsm}
62 %define         shared_modules idmap_rid,idmap_ad,idmap_tdb2%{vfs_modules}
64 %description
65 Samba is the protocol by which a lot of PC-related machines share
66 files, printers, and other information (such as lists of available
67 files and printers). The Windows NT, OS/2, and Linux operating systems
68 support this natively, and add-on packages can enable the same thing
69 for DOS, Windows, VMS, UNIX of all kinds, MVS, and more. This package
70 provides an SMB server that can be used to provide network services to
71 SMB (sometimes called "Lan Manager") clients. Samba uses NetBIOS over
72 TCP/IP (NetBT) protocols and does NOT need the NetBEUI (Microsoft Raw
73 NetBIOS frame) protocol.
76 ######################################################################
77 %package client
78 Summary: Samba (SMB) client programs.
79 Group: Applications/System
80 Requires: samba-common = %{version}-%{release}
81 Obsoletes: smbfs
82 Provides: samba-client = %{version}-%{release}
84 %description client
85 The samba-client package provides some SMB clients to compliment the
86 built-in SMB filesystem in Linux. These clients allow access of SMB
87 shares and printing to SMB printers.
90 #######################################################################
91 %package common
92 Summary: Files used by both Samba servers and clients.
93 Group: Applications/System
94 Provides: samba-common = %{version}-%{release}
96 %description common
97 Samba-common provides files necessary for both the server and client
98 packages of Samba.
102 #######################################################################
103 %package swat
104 Summary: The Samba SMB server configuration program.
105 Group: Applications/System
106 Requires: samba = %{version} xinetd
107 Provides: samba-swat = %{version}-%{release}
109 %description swat
110 The samba-swat package includes the new SWAT (Samba Web Administration
111 Tool), for remotely managing Samba's smb.conf file using your favorite
112 Web browser.
115 #######################################################################
116 %package doc
117 Summary:      Samba Documentation
118 Group:        Documentation/Other
119 Provides:     samba-doc = %{version}-%{release}
120 Requires:       /usr/bin/find /bin/rm /usr/bin/xargs
122 %description doc
123 The samba-doc package includes the HTML versions of the Samba manpages
124 utilized by SWAT as well as the HTML and PDF version of "Using Samba",
125 "Samba By Example", and "The Official Samba HOWTO and Reference Guide".
128 #######################################################################
130 %prep
131 %setup -q
133 # setup the vendor files (init scripts, etc...)
134 %setup -T -D -a 999 -n samba-%{version} -q
136 %build
138 /bin/cp setup/filter-requires-samba.sh %{SOURCE998}
140 cd source3
141 # RPM_OPT_FLAGS="$RPM_OPT_FLAGS -D_FILE_OFFSET_BITS=64"
143 ## check for ccache
144 if ccache -h >/dev/null 2>&1 ; then
145         CC="ccache gcc"
146 else
147         CC="gcc"
150 export CC
152 ## always run autogen.sh
153 ./autogen.sh
155 CFLAGS="$RPM_OPT_FLAGS $EXTRA -D_GNU_SOURCE" ./configure \
156         --prefix=%{_prefix} \
157         --localstatedir=/var \
158         --with-configdir=%{_sysconfdir}/samba \
159         --libdir=%{_libarchdir} \
160         --with-modulesdir=%{_libarchdir}/samba \
161         --with-pammodulesdir=/%{_libarch}/security \
162         --with-lockdir=/var/lib/samba \
163         --with-logfilebase=/var/log/samba \
164         --mandir=%{_mandir} \
165         --with-piddir=/var/run \
166         --with-privatedir=%{_sysconfdir}/samba \
167         --disable-cups \
168         --with-acl-support \
169         --with-ads \
170         --with-automount \
171         --enable-fhs \
172         --with-pam_smbpass \
173         --with-libsmbclient \
174         --with-libsmbsharemodes \
175         --without-smbwrapper \
176         --with-pam \
177         --with-quotas \
178         --with-shared-modules=%{shared_modules} \
179         --with-syslog \
180         --with-utmp \
181         --with-cluster-support \
182         --with-ctdb=/usr/include \
183         --without-ldb \
184         --without-dnsupdate \
185         --with-aio-support \
186         --disable-merged-build \
187         --disable-smbtorture \
188         --disable-external-libtalloc \
189         --disable-external-libtdb
191 make showlayout
193 ## check for gcc 3.4 or later
194 CC_VERSION=`${CC} --version | head -1 | awk '{print $3}'`
195 CC_MAJOR=`echo ${CC_VERSION} | cut -d. -f 1`
196 CC_MINOR=`echo ${CC_VERSION} | cut -d. -f 2`
197 if [ ${CC_MAJOR} -ge 3 ]; then
198         if [ ${CC_MAJOR} -gt 3 -o ${CC_MINOR} -ge 4 ]; then
199                 make pch
200         fi
204 make -j %{numcpu} %{?_smp_mflags} \
205         everything modules pam_smbpass
207 # check that desired suppor has been compiled into smbd:
208 export LD_LIBRARY_PATH=./bin
210 HAVE_VARS="HAVE_POSIX_ACLS HAVE_LDAP HAVE_KRB5 CLUSTER_SUPPORT"
211 %if %{with_vfs_gpfs}
212         HAVE_VARS="${HAVE_VARS} HAVE_GPFS"
213 %endif
214 for test in ${HAVE_VARS}
216         if ! $(./bin/smbd -b | grep -q $test ) ; then
217                 echo "ERROR: '$test' is not in smbd. Build stopped."
218                 exit 1;
219         fi
220 done
222 # try and build the manpages
223 cd ..
224 ./release-scripts/build-manpages-nogit
226 # Remove some permission bits to avoid to many dependencies
227 find examples docs -type f | xargs -r chmod -x
229 %install
230 # Clean up in case there is trash left from a previous build
231 rm -rf $RPM_BUILD_ROOT
233 # Create the target build directory hierarchy
234 mkdir -p $RPM_BUILD_ROOT%{_datadir}/samba/swat/{help,include,using_samba/{figs,gifsa}}
235 mkdir -p $RPM_BUILD_ROOT%{_includedir}
236 mkdir -p $RPM_BUILD_ROOT%{_initrddir}
237 mkdir -p $RPM_BUILD_ROOT{%{_libarchdir},%{_includedir}}
238 mkdir -p $RPM_BUILD_ROOT%{_libarchdir}/samba/{auth,charset,idmap,vfs,pdb}
239 mkdir -p $RPM_BUILD_ROOT/%{_libarch}/security
240 mkdir -p $RPM_BUILD_ROOT/lib/security
241 mkdir -p $RPM_BUILD_ROOT%{_mandir}
242 mkdir -p $RPM_BUILD_ROOT%{_prefix}/{bin,sbin}
243 mkdir -p $RPM_BUILD_ROOT%{_prefix}/lib
244 mkdir -p $RPM_BUILD_ROOT/sbin
245 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/{pam.d,samba}
246 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/{pam.d}
247 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d
248 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/{samba,sysconfig}
249 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/xinetd.d
250 mkdir -p $RPM_BUILD_ROOT/var/lib/samba/winbindd_privileged
251 mkdir -p $RPM_BUILD_ROOT/var/{log,run/winbindd,spool}/samba
252 mkdir -p $RPM_BUILD_ROOT/%{_libarchdir}/krb5/plugins/libkrb5
254 cd source3
255 make DESTDIR=$RPM_BUILD_ROOT \
256         install
258 make DESTDIR=$RPM_BUILD_ROOT \
259         install-dbwrap_tool install-dbwrap_torture
260 cd ..
262 # NSS winbind support
263 install -m 755 nsswitch/libnss_winbind.so $RPM_BUILD_ROOT/%{_libarch}/libnss_winbind.so.2
264 ( cd $RPM_BUILD_ROOT/%{_libarch};
265   ln -sf libnss_winbind.so.2  libnss_winbind.so )
267 # do not install libnss_wins.so in order to reduce dependencies
268 # (we do not need it for the samba-ctdb scenario)
270 #install -m 755 nsswitch/libnss_wins.so $RPM_BUILD_ROOT/%{_libarch}/libnss_wins.so
271 # ( cd $RPM_BUILD_ROOT/%{_libarch}; ln -sf libnss_wins.so  libnss_wins.so.2 )
273 cp -p source3/bin/winbind_krb5_locator.so ${RPM_BUILD_ROOT}/%{_libarchdir}/krb5/plugins/libkrb5
276 ## cleanup
277 /bin/rm -rf $RPM_BUILD_ROOT/usr/lib*/samba/security
279 # remove installed but unpackaged files:
280 /bin/rm -f $RPM_BUILD_ROOT/usr/lib*/libtalloc.so
281 /bin/rm -f $RPM_BUILD_ROOT/usr/lib*/libtdb.so
282 /bin/rm -f $RPM_BUILD_ROOT/usr/lib*/samba/perfcount/pc_test.so
285 # Install the miscellany
286 echo 127.0.0.1 localhost > $RPM_BUILD_ROOT%{_sysconfdir}/samba/lmhosts
288 install -m644 setup/swat $RPM_BUILD_ROOT%{_sysconfdir}/xinetd.d/swat
289 install -m644 setup/samba.sysconfig $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/samba
290 install -m755 setup/smb.init $RPM_BUILD_ROOT%{initdir}/smb
291 install -m755 setup/winbind.init $RPM_BUILD_ROOT%{initdir}/winbind
292 install -m644 setup/samba.pamd $RPM_BUILD_ROOT%{_sysconfdir}/pam.d/samba
293 install -m755 packaging/printing/smbprint $RPM_BUILD_ROOT%{_bindir}
294 install -m644 setup/smbusers $RPM_BUILD_ROOT%{_sysconfdir}/samba/smbusers
295 install -m644 setup/smb.conf $RPM_BUILD_ROOT%{_sysconfdir}/samba/smb.conf
296 install -m755 source3/script/mksmbpasswd.sh $RPM_BUILD_ROOT%{_bindir}
298 ln -s ../..%{initdir}/smb  $RPM_BUILD_ROOT%{_sbindir}/samba
299 ln -s ../..%{initdir}/winbind  $RPM_BUILD_ROOT%{_sbindir}/winbind
301 # Remove "*.old" files
302 find $RPM_BUILD_ROOT -name "*.old" -exec rm -f {} \;
306 ## Clean out man pages for tools not installed here
308 rm -f $RPM_BUILD_ROOT%{_mandir}/man1/log2pcap.1*
309 rm -f $RPM_BUILD_ROOT%{_mandir}/man1/smbsh.1*
310 rm -f $RPM_BUILD_ROOT%{_mandir}/man5/vfstest.1*
313 %clean
314 rm -rf $RPM_BUILD_ROOT
316 %post
317 ## deal with an upgrade from a broken 3.0.21b RPM
318 if [ "$1" -eq "2" ]; then
319         if [ -d /var/cache/samba ]; then
320                 for file in `ls /var/cache/samba/*tdb`; do
321                         /bin/cp -up $file /var/lib/samba/`basename $file`
322                 done
323                 mkdir -p /var/lib/samba/eventlog
324                 for file in `ls /var/cache/samba/eventlog/*tdb`; do
325                         /bin/cp -up $file /var/lib/samba/eventlog/`basename $file`
326                 done
327                 /bin/mv /var/cache/samba /var/cache/samba.moved
328         fi
331 if [ "$1" -ge "1" ]; then
332         /sbin/service smb condrestart >/dev/null 2>&1 || :
335 %preun
336 if [ $1 = 0 ] ; then
337     /sbin/service smb stop >/dev/null 2>&1 || :
338     /sbin/chkconfig --del smb
339     # rm -rf /var/log/samba/* /var/lib/samba/*
341 exit 0
343 #%postun
345 %post swat
346 # Add swat entry to /etc/services if not already there.
347 if [ ! "`grep ^\s**swat /etc/services`" ]; then
348         echo 'swat        901/tcp     # Add swat service used via inetd' >> /etc/services
351 %post common
352 /sbin/ldconfig
354 if [ "$1" -ge "1" ]; then
355         /sbin/service winbind condrestart >/dev/null 2>&1 || :
358 %preun common
359 if [ $1 = 0 ] ; then
360     /sbin/service winbind stop >/dev/null 2>&1 || :
361     /sbin/chkconfig --del winbind
363 exit 0
365 %postun common 
366 /sbin/ldconfig
368 #######################################################################
369 ## Files section                                                     ##
370 #######################################################################
372 %files
373 %defattr(-,root,root)
375 %config(noreplace) %{_sysconfdir}/sysconfig/samba
376 %config(noreplace) %{_sysconfdir}/samba/smbusers
377 %attr(755,root,root) %config %{initdir}/smb
378 %config(noreplace) %{_sysconfdir}/pam.d/samba
380 %attr(0755,root,root) %dir /var/log/samba
381 %attr(0755,root,root) %dir /var/lib/samba
382 %attr(1777,root,root) %dir /var/spool/samba
384 %{_sbindir}/samba
386 %{_sbindir}/smbd
387 %{_sbindir}/nmbd
389 %{_bindir}/mksmbpasswd.sh
390 %{_bindir}/smbcontrol
391 %{_bindir}/smbstatus
392 %{_bindir}/tdbbackup
393 %{_bindir}/tdbtool
394 %{_bindir}/tdbdump
395 %{_bindir}/tdbrestore
396 %{_bindir}/eventlogadm
398 %{_libarchdir}/samba/auth/script.so
399 %{_libarchdir}/samba/vfs/acl_tdb.so
400 %{_libarchdir}/samba/vfs/acl_xattr.so
401 %{_libarchdir}/samba/vfs/aio_fork.so
402 %{_libarchdir}/samba/vfs/audit.so
403 %{_libarchdir}/samba/vfs/cap.so
404 %{_libarchdir}/samba/vfs/catia.so
405 %{_libarchdir}/samba/vfs/crossrename.so
406 %{_libarchdir}/samba/vfs/default_quota.so
407 %{_libarchdir}/samba/vfs/dirsort.so
408 %{_libarchdir}/samba/vfs/expand_msdfs.so
409 %{_libarchdir}/samba/vfs/extd_audit.so
410 %{_libarchdir}/samba/vfs/fake_perms.so
411 %{_libarchdir}/samba/vfs/fileid.so
412 %{_libarchdir}/samba/vfs/full_audit.so
413 %if %{with_vfs_gpfs}
414 %{_libarchdir}/samba/vfs/gpfs.so
415 %endif
416 %{_libarchdir}/samba/vfs/linux_xfs_sgid.so
417 %{_libarchdir}/samba/vfs/netatalk.so
418 %{_libarchdir}/samba/vfs/preopen.so
419 %{_libarchdir}/samba/vfs/readahead.so
420 %{_libarchdir}/samba/vfs/readonly.so
421 %{_libarchdir}/samba/vfs/recycle.so
422 %{_libarchdir}/samba/vfs/scannedonly.so
423 %{_libarchdir}/samba/vfs/shadow_copy.so
424 %{_libarchdir}/samba/vfs/shadow_copy2.so
425 %{_libarchdir}/samba/vfs/smb_traffic_analyzer.so
426 %{_libarchdir}/samba/vfs/streams_depot.so
427 %{_libarchdir}/samba/vfs/streams_xattr.so
428 %{_libarchdir}/samba/vfs/syncops.so
429 %{_libarchdir}/samba/vfs/time_audit.so
430 %if %{with_vfs_tsmsm}
431 %{_libarchdir}/samba/vfs/tsmsm.so
432 %endif
433 %{_libarchdir}/samba/vfs/xattr_tdb.so
434 %{_libarchdir}/samba/vfs/aio_posix.so
435 %{_libarchdir}/samba/vfs/aio_pthread.so
436 %{_libarchdir}/samba/vfs/media_harmony.so
438 %{_mandir}/man1/smbcontrol.1*
439 %{_mandir}/man1/smbstatus.1*
440 %{_mandir}/man1/vfstest.1*
441 %{_mandir}/man5/smbpasswd.5*
442 %{_mandir}/man5/pam_winbind.conf.5*
443 %{_mandir}/man7/samba.7*
444 %{_mandir}/man8/nmbd.8*
445 %{_mandir}/man8/pdbedit.8*
446 %{_mandir}/man8/smbd.8*
447 %{_mandir}/man8/eventlogadm.8*
448 %{_mandir}/man8/vfs_*.8*
449 %{_mandir}/man8/smbta-util.8*
452 ##########
454 %files doc
455 %defattr(-,root,root)
456 %doc README
457 %doc COPYING
458 %doc WHATSNEW.txt
459 %doc Roadmap
460 %doc docs-xml/archives/THANKS
461 %doc docs-xml/archives/history
462 %doc docs-xml/registry
463 %doc examples/autofs
464 %doc examples/LDAP
465 %doc examples/libsmbclient
466 %doc examples/misc
467 %doc examples/printer-accounting
468 %doc examples/printing
470 ##########
472 %files swat
473 %defattr(-,root,root)
474 %config(noreplace) %{_sysconfdir}/xinetd.d/swat
475 %dir %{_datadir}/samba/swat
476 %{_datadir}/samba/swat/*
477 %{_sbindir}/swat
478 %{_mandir}/man8/swat.8*
479 %attr(755,root,root) %{_datadir}/samba/codepages/*.msg
481 ##########
483 %files client
484 %defattr(-,root,root)
486 %{_bindir}/rpcclient
487 %{_bindir}/smbcacls
488 %{_bindir}/findsmb
489 %{_bindir}/nmblookup
490 %{_bindir}/smbget
491 %{_bindir}/smbclient
492 %{_bindir}/smbprint
493 %{_bindir}/smbspool
494 %{_bindir}/smbtar
495 %{_bindir}/smbtree
496 %{_bindir}/sharesec
497 %{_bindir}/smbta-util
499 %{_mandir}/man8/smbspool.8*
500 %{_mandir}/man1/smbget.1*
501 %{_mandir}/man5/smbgetrc.5*
502 %{_mandir}/man1/findsmb.1*
503 %{_mandir}/man1/nmblookup.1*
504 %{_mandir}/man1/rpcclient.1*
505 %{_mandir}/man1/smbcacls.1*
506 %{_mandir}/man1/smbclient.1*
507 %{_mandir}/man1/smbtar.1*
508 %{_mandir}/man1/smbtree.1*
509 %{_mandir}/man1/sharesec.1*
511 ##########
514 %files common
515 %defattr(-,root,root)
516 %dir %{_sysconfdir}/samba
517 %dir %{_libarchdir}/samba
518 %dir %{_libarchdir}/samba/charset
519 %config(noreplace) %{_sysconfdir}/samba/smb.conf
520 %config(noreplace) %{_sysconfdir}/samba/lmhosts
521 %attr(755,root,root) %config %{initdir}/winbind
523 %attr(755,root,root) /%{_libarch}/libnss_winbind.so
524 %attr(755,root,root) /%{_libarch}/libnss_winbind.so.2
525 %attr(755,root,root) /%{_libarch}/security/pam_winbind.so
526 %attr(755,root,root) /%{_libarch}/security/pam_smbpass.so
527 /usr/share/locale/*/LC_MESSAGES/pam_winbind.mo
528 /usr/share/locale/*/LC_MESSAGES/net.mo
530 %{_libarchdir}/samba/idmap/ad.so
531 %{_libarchdir}/samba/idmap/rid.so
532 %{_libarchdir}/samba/idmap/tdb2.so
533 %{_libarchdir}/samba/idmap/autorid.so
534 %{_libarchdir}/samba/idmap/hash.so
535 %{_libarchdir}/samba/nss_info/hash.so
536 %{_libarchdir}/samba/nss_info/rfc2307.so
537 %{_libarchdir}/samba/nss_info/sfu.so
538 %{_libarchdir}/samba/nss_info/sfu20.so
539 %{_datadir}/samba/codepages/lowcase.dat
540 %{_datadir}/samba/codepages/upcase.dat
541 %{_datadir}/samba/codepages/valid.dat
543 %{_includedir}/libsmbclient.h
544 %{_libarchdir}/libsmbclient.*
545 %{_includedir}/smb_share_modes.h
546 %{_libarchdir}/libsmbsharemodes.so
547 %{_libarchdir}/libsmbsharemodes.so.0
549 %{_includedir}/netapi.h
550 %{_includedir}/wbclient.h
551 %{_libarchdir}/libnetapi.so
552 %{_libarchdir}/libnetapi.so.0
553 %{_libarchdir}/libwbclient.so
554 %{_libarchdir}/libwbclient.so.0
556 %{_libarchdir}/krb5/plugins/libkrb5/winbind_krb5_locator.so
558 %{_sbindir}/winbind
560 %{_sbindir}/winbindd
561 %{_bindir}/testparm
562 %{_bindir}/smbpasswd
563 %{_bindir}/profiles
564 %{_bindir}/net
565 %{_bindir}/wbinfo
566 %{_bindir}/ntlm_auth
567 %{_bindir}/pdbedit
568 %{_bindir}/smbcquotas
569 %{_bindir}/dbwrap_tool
570 %{_bindir}/dbwrap_torture
572 %{_mandir}/man1/ntlm_auth.1*
573 %{_mandir}/man1/profiles.1*
574 %{_mandir}/man1/smbcquotas.1*
575 %{_mandir}/man1/testparm.1*
576 %{_mandir}/man5/smb.conf.5*
577 %{_mandir}/man5/lmhosts.5*
578 %{_mandir}/man8/smbpasswd.8*
579 %{_mandir}/man1/wbinfo.1*
580 %{_mandir}/man8/winbindd.8*
581 %{_mandir}/man8/net.8*
582 %{_mandir}/man8/pam_winbind.8*
583 %{_mandir}/man7/libsmbclient.7*
584 %{_mandir}/man7/winbind_krb5_locator.7*
585 %{_mandir}/man8/idmap_*.8*
589 %changelog
590 * Fri Jan 16 2004 Gerald (Jerry) Carter <jerry@samba,org>
591 - Removed ChangeLog entries since they are kept in CVS