r11395: Update the Debian packaging.
[Samba.git] / packaging / Debian / debian-sarge / rules
blob25e598d185d548ff933da98a5f1d5e38c4b3bd94
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)
25 DEB_HOST_GNU_SYSTEM := $(shell dpkg-architecture -qDEB_HOST_GNU_SYSTEM)
26 DEB_BUILD_GNU_SYSTEM := $(shell dpkg-architecture -qDEB_BUILD_GNU_SYSTEM)
28 export DEB_HOST_GNU_TYPE
29 export DEB_BUILD_GNU_TYPE
30 export DEB_HOST_GNU_SYSTEM
31 export DEB_BUILD_GNU_SYSTEM
33 # Support the DEB_BUILD_OPTIONS variable
34 CFLAGS = -gstabs -Wall
35 INSTALL = install
37 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
38 CFLAGS += -O0
39 else
40 CFLAGS += -O2
41 endif
43 ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
44 INSTALL += -s
45 endif
48 DESTDIR=`pwd`/debian/tmp
50 conf_args = \
51 --with-fhs \
52 --enable-shared \
53 --enable-static \
54 --prefix=/usr \
55 --sysconfdir=/etc \
56 --libdir=/etc/samba \
57 --with-privatedir=/etc/samba \
58 --with-piddir=/var/run/samba \
59 --localstatedir=/var \
60 --with-netatalk \
61 --with-pam \
62 --with-syslog \
63 --with-utmp \
64 --with-readline \
65 --with-pam_smbpass \
66 --with-libsmbclient \
67 --with-winbind \
68 --with-msdfs \
69 --with-automount \
70 --with-tdbsam \
71 --with-ldap \
72 --with-python=python2.3
74 ifeq ($(DEB_HOST_GNU_SYSTEM),linux)
75 conf_args += \
76 --with-smbmount \
77 --with-acl-support \
78 --with-quotas
79 mount_cifs = yes
80 smbfs = yes
81 else
82 conf_args += --without-quotas
83 mount_cifs = no
84 smbfs = no
85 endif
87 ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
88 conf_args += --build $(DEB_HOST_GNU_TYPE)
89 else
90 conf_args += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
91 endif
93 patch: patch-stamp
94 patch-stamp:
95 dh_testdir
96 if [ ! -f patch-stamp ]; then /bin/sh debian/scripts/patch-source; fi
97 touch patch-stamp
99 unpatch:
100 dh_testdir
101 if [ -f patch-stamp ]; then /bin/sh debian/scripts/unpatch-source; fi
102 rm -f patch-stamp
104 configure: patch-stamp configure-stamp
105 configure-stamp:
106 dh_testdir
108 # if [ -f debian/config.cache ]; then \
109 # cp -f debian/config.cache source/config.cache; \
110 # fi
112 [ -f source/Makefile ] || (cd source && CFLAGS="$(CFLAGS)" ./configure $(conf_args))
114 touch configure-stamp
116 build: patch-stamp configure-stamp build-stamp
117 build-stamp:
118 dh_testdir
120 $(MAKE) -C source headers
121 $(MAKE) -C source all nsswitch/libnss_wins.so python_ext
122 ifeq ($(mount_cifs),yes)
123 $(MAKE) -C source client/mount.cifs
124 endif
126 touch build-stamp
128 clean: unpatch
129 dh_testdir
130 dh_testroot
131 rm -f build-stamp configure-stamp
133 # Clean first the Samba package
134 # -$(MAKE) -C source realclean
135 # -$(MAKE) -C source clean
136 -$(MAKE) -C source python_clean distclean
138 # Delete stuff left after a build that is not deleted by 'make clean'
139 rm -f source/bin/wbinfo source/bin/winbindd source/bin/debug2html \
140 source/bin/libsmbclient.a source/client/mount.cifs \
141 source/include/stamp-h
143 sed -e "s/@libacl@/`type-handling any linux-gnu`/g" \
144 < debian/control.in > debian/control
146 dh_clean
148 install: DH_OPTIONS=
149 install: build
150 dh_testdir
151 dh_testroot
152 dh_clean -k
153 dh_installdirs
155 mkdir -p $(DESTDIR)/usr/share/man $(DESTDIR)/usr/lib/samba \
156 $(DESTDIR)/lib/security $(DESTDIR)/sbin \
157 $(DESTDIR)/usr/lib/cups/backend $(DESTDIR)/usr/share/samba \
158 $(DESTDIR)/etc/pam.d $(DESTDIR)/etc/dhcp3/dhclient-enter-hooks.d \
159 $(DESTDIR)/usr/lib/python2.3/site-packages/samba
161 # Add here commands to install the package into debian/tmp.
162 $(MAKE) -C source install DESTDIR=$(DESTDIR)
164 # libsmbclient files are not installed by the standard
165 # 'make install' - do it manually.
166 $(MAKE) -C source installclientlib DESTDIR=$(DESTDIR)
167 mv $(DESTDIR)/usr/lib/samba/libsmbclient.so $(DESTDIR)/usr/lib/samba/libsmbclient.so.0.1
168 ln -s libsmbclient.so.0.1 $(DESTDIR)/usr/lib/samba/libsmbclient.so.0
169 ln -s libsmbclient.so.0.1 $(DESTDIR)/usr/lib/samba/libsmbclient.so
171 # Starting with Samba 3.0.6 libsmbclient.so is installed in
172 # /usr/lib/samba. We don't want it there since it is not in the
173 # default library path. Here we move it to /usr/lib/.
174 mv $(DESTDIR)/usr/lib/samba/libsmbclient* \
175 $(DESTDIR)/usr/lib/
177 # Install other stuff not installed by "make install"
178 install -m 0755 debian/mksmbpasswd.awk $(DESTDIR)/usr/sbin/mksmbpasswd
180 # Install winbind stuff not installed by 'make install'
181 install -m 0644 source/nsswitch/libnss_winbind.so \
182 $(DESTDIR)/lib/libnss_winbind.so.2
183 install -m 0644 source/nsswitch/pam_winbind.so \
184 $(DESTDIR)/lib/security/
186 # Install libnss_wins.so, which is not installed by 'make install' either.
187 install -m 0644 source/nsswitch/libnss_wins.so \
188 $(DESTDIR)/lib/libnss_wins.so.2
190 # pam_smbpass.so isn't being installed by 'make install'.
191 # We'll move it here to $(DESTDIR)/lib/security/ and then
192 # libpam-smbpass.files will make dh_movefiles move it to the
193 # right location in the libpam-smbpass package.
194 install -m 0644 source/bin/pam_smbpass.so $(DESTDIR)/lib/security/
196 ifeq ($(smbfs),yes)
197 # Create the symlinks that will allow us to do "mount -t smbfs ..."
198 # and "mount -t smb ...". Note that the source/script/installbin.sh
199 # tries to create the first symlink, but we have commented
200 # that code out and do everything here. We also create
201 # symlinks for the man pages.
202 ln -s /usr/bin/smbmount $(DESTDIR)/sbin/mount.smbfs
203 ln -s /usr/bin/smbmount $(DESTDIR)/sbin/mount.smb
204 ln -s smbmount.8 $(DESTDIR)/usr/share/man/man8/mount.smb.8
205 ln -s smbmount.8 $(DESTDIR)/usr/share/man/man8/mount.smbfs.8
206 endif
208 ifeq ($(mount_cifs),yes)
209 # Install mount.cifs and its man page
210 install -m 04755 source/client/mount.cifs $(DESTDIR)/sbin/
211 install -m 0644 docs/manpages/mount.cifs.8 $(DESTDIR)/usr/share/man/man8/
212 endif
214 # For CUPS to support printing to samba printers, it's necessary
215 # to make the following symlink (according to
216 # Erich Schubert <debian@vitavonni.de> in #109509):
217 ln -s ../../../bin/smbspool $(DESTDIR)/usr/lib/cups/backend/smb
219 # Install man pages for files without man pages in the upstream sources
220 install -m 0644 debian/mksmbpasswd.8 $(DESTDIR)/usr/share/man/man8/mksmbpasswd.8
222 # We don't provide the "Using Samba" book in the swat package.
223 # It's provided in the samba-doc package so in the swat package
224 # we just provide a symlink to the real book.
225 ln -s ../../doc/samba-doc/htmldocs/using_samba \
226 $(DESTDIR)/usr/share/samba/swat/using_samba
228 # Delete unwanted stuff leftover from "make install"
230 # The smbwrapper package is not being generated anymore, so we must
231 # delete the related man pages.
232 rm $(DESTDIR)/usr/share/man/man1/smbsh.1
234 # We're not providing findsmb (should we?) so let's remove the man
235 # pages.
236 find debian/ -name 'findsmb*' -exec rm -f {} \;
238 # Install samba-common's conffiles - they'll get moved later to their
239 # correct place by dh_movefiles.
240 cp debian/smb.conf $(DESTDIR)/usr/share/samba/
241 install -m755 debian/panic-action $(DESTDIR)/usr/share/samba/
242 cp debian/gdbcommands $(DESTDIR)/etc/samba/
243 cp debian/samba.pamd $(DESTDIR)/etc/pam.d/samba
244 install -m755 debian/samba-common.dhcp $(DESTDIR)/etc/dhcp3/dhclient-enter-hooks.d/samba
246 # Install the Python modules
248 # Hmmm... need to figure this out. We have lib.linux-i686-2.2
249 # and lib.linux-i686-2.3 directories. Using only the stuff from
250 # the 2.3 directory for now. peloy.-
251 #cp source/build/lib.*/samba/*.so $(DESTDIR)/usr/lib/python2.3/site-packages/
252 cp source/build/lib.*-*-2.3/samba/*.so $(DESTDIR)/usr/lib/python2.3/site-packages/samba/
253 cp source/python/samba/* $(DESTDIR)/usr/lib/python2.3/site-packages/samba/
255 dh_movefiles
257 # Build architecture-independent files here.
258 # Pass -i to all debhelper commands in this target to reduce clutter.
259 binary-indep: DH_OPTIONS=-i
260 binary-indep: build install
261 dh_testdir
262 dh_testroot
263 dh_installdebconf
264 dh_installdocs -A debian/README.build
265 # dh_installexamples is not available in Debian Potato...
266 [ -x /usr/bin/dh_installexamples ] && DH_OPTIONS= dh_installexamples -v -psamba-doc examples/*
267 # dh_installmenu
268 # dh_installemacsen
269 # dh_installpam
270 # dh_installinit
271 # dh_installcron
272 # dh_installmanpages
273 # dh_installinfo
274 # dh_undocumented
275 dh_installchangelogs
276 dh_link
277 dh_compress
278 dh_fixperms
280 # Get rid of those pesky .cvsignore files to make lintian happy
281 find debian/ -name .cvsignore -exec rm -f {} \;
283 dh_installdeb
284 # dh_perl
285 dh_gencontrol
286 dh_md5sums
287 dh_builddeb
289 # Build architecture-dependent files here.
290 # Pass -a to all debhelper commands in this target to reduce clutter.
291 ifeq ($(smbfs),no)
292 DH_EXTRAS=-Nsmbfs
293 endif
295 binary-arch: DH_OPTIONS=-a $(DH_EXTRAS)
296 binary-arch: build install
297 dh_testdir
298 dh_testroot
299 dh_installdebconf
300 dh_installdocs -A debian/README.build
301 # dh_installexamples is not available in Debian Potato...
302 [ -x /usr/bin/dh_installexamples ] && DH_OPTIONS= dh_installexamples -v -ppython2.3-samba source/python/examples/*
303 # dh_installmenu
304 # dh_installlogrotate is not available in Debian Potato...
305 if [ -x /usr/bin/dh_installlogrotate ]; then \
306 dh_installlogrotate; \
307 else \
308 mkdir -p debian/samba/etc/logrotate.d; \
309 cp debian/samba.logrotate debian/samba/etc/logrotate.d/samba; \
310 mkdir -p debian/winbind/etc/logrotate.d; \
311 cp debian/winbind.logrotate debian/winbind/etc/logrotate.d/winbind; \
313 # dh_installemacsen
314 # dh_installpam
315 DH_OPTIONS= dh_installinit -psamba -- "defaults 20 19"
316 DH_OPTIONS= dh_installinit -pwinbind
317 dh_installcron
318 # dh_installmanpages
319 # dh_installinfo
320 cp debian/winbind.lintian debian/winbind/usr/share/lintian/overrides/winbind
321 # dh_undocumented
322 dh_installchangelogs -Nlibpam-smbpass
323 DH_OPTIONS= dh_installchangelogs -plibpam-smbpass source/pam_smbpass/CHANGELOG
324 dh_strip --dbg-package=samba --dbg-package=smbclient
325 cp -a debian/smbclient-dbg/* debian/samba-dbg
326 rm -rf debian/smbclient-dbg
327 dh_link
328 dh_compress
329 dh_fixperms
331 # Why this is executable, I have NO idea...
332 chmod a-x debian/libsmbclient-dev/usr/include/libsmbclient.h
334 ifeq ($(smbfs),yes)
335 # You may want to make some executables suid here.
336 # The smbmnt and smbumount binaries should be setuid-root. This
337 # has security implications because these programs haven't had
338 # a thorough security audit. smbmount _does not_ have to have
339 # the setuid bit set. In fact, it is a security hole.
340 chmod u+s debian/smbfs/usr/bin/smbmnt
341 chmod u+s debian/smbfs/usr/bin/smbumount
342 endif
344 # Set some reasonable default perms for the samba logdir.
345 chmod 0750 debian/samba/var/log/samba/
346 chown root.adm debian/samba/var/log/samba/
348 # Get rid of those pesky .cvsignore files to make lintian happy
349 # (maybe we only need the "find ... -exec rm -f {} ;" we have
350 # in the binary-indep target?) peloy.-
351 find debian/ -name .cvsignore -exec rm -f {} \;
353 dh_installdeb
354 # dh_makeshlibs
355 # dh_perl
356 dh_shlibdeps
357 dh_gencontrol
358 dh_md5sums
359 dh_builddeb
361 binary: binary-indep binary-arch
362 .PHONY: build clean binary-indep binary-arch binary install configure