r5555: current with 3.0 tree as of r5548; getting ready for 3.0.12pre1
[Samba.git] / packaging / Debian / debian-stable / rules
blobf17ea75c0157329579c1fbd60dc99595d03f77c8
1 #!/usr/bin/make -f
2 #
3 # Important modifications (introduction of a saved config.cache to
4 # solve build problems) introduced in Samba 2.2.1a-5. These
5 # modification were made by Steve Langasek <vorlon@netexpress.net>.
7 # config.cache *DISABLED* to solve problems caused incorrect settings
8 # --SSS
12 # Uncomment this to turn on verbose mode.
13 #export DH_VERBOSE=1
15 # This is the debhelper compatability version to use.
16 export DH_COMPAT=4
18 # This has to be exported to make some magic below work.
19 export DH_OPTIONS
21 # Set the host and build architectures for use with config.cache loading,
22 # cross-building, etc.
23 DEB_HOST_GNU_TYPE := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
24 DEB_BUILD_GNU_TYPE := $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
26 export DEB_HOST_GNU_TYPE
27 export DEB_BUILD_GNU_TYPE
30 # Support the DEB_BUILD_OPTIONS variable
31 CFLAGS = -gstabs -Wall
32 INSTALL = install
34 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
35 CFLAGS += -O0
36 else
37 CFLAGS += -O2
38 endif
40 ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
41 INSTALL += -s
42 endif
45 DESTDIR=`pwd`/debian/tmp
47 patch: patch-stamp
48 patch-stamp:
49 dh_testdir
50 if [ ! -f patch-stamp ]; then /bin/sh debian/scripts/patch-source; fi
51 touch patch-stamp
53 unpatch:
54 dh_testdir
55 if [ -f patch-stamp ]; then /bin/sh debian/scripts/unpatch-source; fi
56 rm -f patch-stamp
58 configure: patch-stamp configure-stamp
59 configure-stamp:
60 dh_testdir
62 # if [ -f debian/config.cache ]; then \
63 # cp -f debian/config.cache source/config.cache; \
64 # fi
66 [ -f source/Makefile ] || (cd source && CFLAGS="$(CFLAGS)" ./configure \
67 --host=$(DEB_HOST_GNU_TYPE) \
68 --build=$(DEB_BUILD_GNU_TYPE) \
69 --with-fhs \
70 --enable-shared \
71 --enable-static \
72 --prefix=/usr \
73 --sysconfdir=/etc \
74 --libdir=/etc/samba \
75 --with-privatedir=/etc/samba \
76 --localstatedir=/var \
77 --with-netatalk \
78 --with-smbmount \
79 --with-pam \
80 --with-syslog \
81 --with-utmp \
82 --with-readline \
83 --with-pam_smbpass \
84 --with-libsmbclient \
85 --with-msdfs \
86 --with-automount \
87 --with-acl-support \
88 --with-quotas \
89 --with-ldap \
90 --with-python=python2.2)
92 touch configure-stamp
94 build: patch-stamp configure-stamp build-stamp
95 build-stamp:
96 dh_testdir
98 $(MAKE) -C source headers
99 $(MAKE) -C source all nsswitch/libnss_wins.so python_ext
100 $(MAKE) -C source client/mount.cifs
102 touch build-stamp
104 clean: unpatch
105 dh_testdir
106 dh_testroot
107 rm -f build-stamp configure-stamp
109 # Clean first the Samba package
110 # -$(MAKE) -C source realclean
111 # -$(MAKE) -C source clean
112 -$(MAKE) -C source python_clean distclean
114 # Delete stuff left after a build that is not deleted by 'make clean'
115 rm -f source/bin/wbinfo source/bin/winbindd source/bin/debug2html \
116 source/bin/libsmbclient.a source/include/stamp-h
118 dh_clean
120 install: DH_OPTIONS=
121 install: build
122 dh_testdir
123 dh_testroot
124 dh_clean -k
125 dh_installdirs
127 mkdir -p $(DESTDIR)/usr/share/man $(DESTDIR)/usr/lib \
128 $(DESTDIR)/lib/security $(DESTDIR)/sbin $(DESTDIR)/etc/samba \
129 $(DESTDIR)/usr/lib/cups/backend $(DESTDIR)/usr/share/samba \
130 $(DESTDIR)/etc/pam.d $(DESTDIR)/etc/dhcp3/dhclient-enter-hooks.d \
131 $(DESTDIR)/usr/lib/python2.2/site-packages
133 # Add here commands to install the package into debian/tmp.
134 $(MAKE) -C source install DESTDIR=$(DESTDIR)
136 # libsmbclient files are not installed by the standard
137 # 'make install' - do it manually.
138 $(MAKE) -C source installclientlib DESTDIR=$(DESTDIR)
139 mv $(DESTDIR)/usr/lib/samba/libsmbclient.so $(DESTDIR)/usr/lib/libsmbclient.so.0.1
140 ln -s libsmbclient.so.0.1 $(DESTDIR)/usr/lib/libsmbclient.so.0
141 ln -s libsmbclient.so.0.1 $(DESTDIR)/usr/lib/libsmbclient.so
142 mv $(DESTDIR)/usr/lib/samba/libsmbclient.a $(DESTDIR)/usr/lib/libsmbclient.a
144 # Install other stuff not installed by "make install"
145 install -m 0755 debian/mksmbpasswd.awk $(DESTDIR)/usr/sbin/mksmbpasswd
147 # Install winbind stuff not installed by 'make install'
148 install -m 0644 source/nsswitch/libnss_winbind.so \
149 $(DESTDIR)/lib/libnss_winbind.so.2
150 install -m 0644 source/nsswitch/pam_winbind.so \
151 $(DESTDIR)/lib/security/
153 # Install libnss_wins.so, which is not installed by 'make install' either.
154 install -m 0644 source/nsswitch/libnss_wins.so \
155 $(DESTDIR)/lib/libnss_wins.so.2
157 # pam_smbpass.so isn't being installed by 'make install'.
158 # We'll move it here to $(DESTDIR)/lib/security/ and then
159 # libpam-smbpass.files will make dh_movefiles move it to the
160 # right location in the libpam-smbpass package.
161 install -m 0644 source/bin/pam_smbpass.so $(DESTDIR)/lib/security/
163 # Create the symlink that will allow us to do "mount -t smbfs ...".
164 # Create also a symlink that will allow "mount -t smb ..." to
165 # work too. The symlink is created in $(DESTDIR)/sbin/ but
166 # will be moved by dh_movefiles to the smbfs package later on.
167 ln -s /usr/bin/smbmount $(DESTDIR)/sbin/mount.smbfs
168 ln -s /usr/bin/smbmount $(DESTDIR)/sbin/mount.smb
169 ln -s smbmount.8 $(DESTDIR)/usr/share/man/man8/mount.smb.8
170 ln -s smbmount.8 $(DESTDIR)/usr/share/man/man8/mount.smbfs.8
172 # Install mount.cifs and its man page
173 install -m 0755 source/client/mount.cifs $(DESTDIR)/sbin/
174 install -m 0644 docs/manpages/mount.cifs.8 $(DESTDIR)/usr/share/man/man8/
176 # For CUPS to support printing to samba printers, it's necessary
177 # to make the following symlink (according to
178 # Erich Schubert <debian@vitavonni.de> in #109509):
179 ln -s ../../../bin/smbspool $(DESTDIR)/usr/lib/cups/backend/smb
181 # Install man pages for files without man pages in the upstream sources
182 install -m 0644 debian/mksmbpasswd.8 $(DESTDIR)/usr/share/man/man8/mksmbpasswd.8
184 # Delete unwanted stuff leftover from "make install"
186 # The smbwrapper package is not being generated anymore, so we must
187 # delete the related man pages.
188 rm $(DESTDIR)/usr/share/man/man1/smbsh.1
190 # We're not providing findsmb (should we?) so let's remove the man
191 # pages.
192 find debian/ -name 'findsmb*' -exec rm -f {} \;
194 # Install samba-common's conffiles - they'll get moved later to their
195 # correct place by dh_movefiles.
196 cp debian/smb.conf $(DESTDIR)/etc/samba/
197 install -m755 debian/panic-action $(DESTDIR)/etc/samba/
198 cp debian/gdbcommands $(DESTDIR)/etc/samba/
199 cp debian/samba.pamd $(DESTDIR)/etc/pam.d/samba
200 install -m755 debian/samba-common.dhcp $(DESTDIR)/etc/dhcp3/dhclient-enter-hooks.d/samba
202 # Install the Python modules
204 #cp source/build/lib.*/samba/*.so $(DESTDIR)/usr/lib/python2.2/site-packages/
205 cp source/build/lib.linux-*-2.2/samba/*.so $(DESTDIR)/usr/lib/python2.2/site-packages/
207 dh_movefiles
209 # Build architecture-independent files here.
210 # Pass -i to all debhelper commands in this target to reduce clutter.
211 binary-indep: DH_OPTIONS=-i
212 binary-indep: build install
213 dh_testdir
214 dh_testroot
215 dh_installdebconf
216 dh_installdocs -A debian/README.build
217 # dh_installexamples is not available in Debian Potato...
218 [ -x /usr/bin/dh_installexamples ] && DH_OPTIONS= dh_installexamples -v -psamba-doc examples/*
219 # dh_installmenu
220 # dh_installemacsen
221 # dh_installpam
222 # dh_installinit
223 # dh_installcron
224 # dh_installmanpages
225 # dh_installinfo
226 # dh_undocumented
227 dh_installchangelogs
228 dh_link
229 dh_compress
230 dh_fixperms
232 # Get rid of those pesky .cvsignore files to make lintian happy
233 find debian/ -name .cvsignore -exec rm -f {} \;
235 dh_installdeb
236 # dh_perl
237 dh_gencontrol
238 dh_md5sums
239 dh_builddeb
241 # Build architecture-dependent files here.
242 # Pass -a to all debhelper commands in this target to reduce clutter.
243 binary-arch: DH_OPTIONS=-a
244 binary-arch: build install
245 dh_testdir
246 dh_testroot
247 dh_installdebconf
248 dh_installdocs -A debian/README.build
249 # dh_installexamples is not available in Debian Potato...
250 [ -x /usr/bin/dh_installexamples ] && DH_OPTIONS= dh_installexamples -v -ppython2.2-samba source/python/examples/*
251 # dh_installmenu
252 # dh_installlogrotate is not available in Debian Potato...
253 if [ -x /usr/bin/dh_installlogrotate ]; then \
254 dh_installlogrotate; \
255 else \
256 mkdir -p debian/samba/etc/logrotate.d; \
257 cp debian/samba.logrotate debian/samba/etc/logrotate.d/samba; \
258 mkdir -p debian/winbind/etc/logrotate.d; \
259 cp debian/winbind.logrotate debian/winbind/etc/logrotate.d/winbind; \
261 # dh_installemacsen
262 # dh_installpam
263 DH_OPTIONS= dh_installinit -psamba -- "defaults 20 19"
264 DH_OPTIONS= dh_installinit -pwinbind
265 dh_installcron
266 # dh_installmanpages
267 # dh_installinfo
268 cp debian/winbind.lintian debian/winbind/usr/share/lintian/overrides/winbind
269 # dh_undocumented
270 dh_installchangelogs -Nlibpam-smbpass
271 DH_OPTIONS= dh_installchangelogs -plibpam-smbpass source/pam_smbpass/CHANGELOG
272 dh_strip
273 dh_link
274 dh_compress
275 dh_fixperms
277 # Why this is executable, I have NO idea...
278 chmod a-x debian/libsmbclient-dev/usr/include/libsmbclient.h
280 # You may want to make some executables suid here.
281 # The smbmnt and smbumount binaries should be setuid-root. This
282 # has security implications because these programs haven't had
283 # a thorough security audit. smbmount _does not_ have to have
284 # the setuid bit set. In fact, it is a security hole.
285 chmod u+s debian/smbfs/usr/bin/smbmnt
286 chmod u+s debian/smbfs/usr/bin/smbumount
288 # Set some reasonable default perms for the samba logdir.
289 chmod 0750 debian/samba/var/log/samba/
290 chown root.adm debian/samba/var/log/samba/
292 # Get rid of those pesky .cvsignore files to make lintian happy
293 # (maybe we only need the "find ... -exec rm -f {} ;" we have
294 # in the binary-indep target?) peloy.-
295 find debian/ -name .cvsignore -exec rm -f {} \;
297 dh_installdeb
298 # dh_makeshlibs
299 # dh_perl
300 dh_shlibdeps
301 dh_gencontrol
302 dh_md5sums
303 dh_builddeb
305 binary: binary-indep binary-arch
306 .PHONY: build clean binary-indep binary-arch binary install configure