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