r2176: syncing necessary changes for 3.0.7
[Samba.git] / packaging / Debian / debian-stable / rules
blob91e77e6d0fd582d184214114b3c9da6206498c8f
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
101 touch build-stamp
103 clean: unpatch
104 dh_testdir
105 dh_testroot
106 rm -f build-stamp configure-stamp
108 # Clean first the Samba package
109 # -$(MAKE) -C source realclean
110 # -$(MAKE) -C source clean
111 -$(MAKE) -C source python_clean distclean
113 # Delete stuff left after a build that is not deleted by 'make clean'
114 rm -f source/bin/wbinfo source/bin/winbindd source/bin/debug2html \
115 source/bin/libsmbclient.a source/include/stamp-h
117 dh_clean
119 install: DH_OPTIONS=
120 install: build
121 dh_testdir
122 dh_testroot
123 dh_clean -k
124 dh_installdirs
126 mkdir -p $(DESTDIR)/usr/share/man $(DESTDIR)/usr/lib \
127 $(DESTDIR)/lib/security $(DESTDIR)/sbin $(DESTDIR)/etc/samba \
128 $(DESTDIR)/usr/lib/cups/backend $(DESTDIR)/usr/share/samba \
129 $(DESTDIR)/etc/pam.d $(DESTDIR)/etc/dhcp3/dhclient-enter-hooks.d \
130 $(DESTDIR)/usr/lib/python2.2/site-packages
132 # Add here commands to install the package into debian/tmp.
133 $(MAKE) -C source install DESTDIR=$(DESTDIR)
135 # libsmbclient files are not installed by the standard
136 # 'make install' - do it manually.
137 $(MAKE) -C source installclientlib DESTDIR=$(DESTDIR)
138 mv $(DESTDIR)/usr/lib/samba/libsmbclient.so $(DESTDIR)/usr/lib/libsmbclient.so.0.1
139 ln -s libsmbclient.so.0.1 $(DESTDIR)/usr/lib/libsmbclient.so.0
140 ln -s libsmbclient.so.0.1 $(DESTDIR)/usr/lib/libsmbclient.so
141 mv $(DESTDIR)/usr/lib/samba/libsmbclient.a $(DESTDIR)/usr/lib/libsmbclient.a
143 # Install other stuff not installed by "make install"
144 install -m 0755 debian/mksmbpasswd.awk $(DESTDIR)/usr/sbin/mksmbpasswd
146 # Install winbind stuff not installed by 'make install'
147 install -m 0644 source/nsswitch/libnss_winbind.so \
148 $(DESTDIR)/lib/libnss_winbind.so.2
149 install -m 0644 source/nsswitch/pam_winbind.so \
150 $(DESTDIR)/lib/security/
152 # Install libnss_wins.so, which is not installed by 'make install' either.
153 install -m 0644 source/nsswitch/libnss_wins.so \
154 $(DESTDIR)/lib/libnss_wins.so.2
156 # pam_smbpass.so isn't being installed by 'make install'.
157 # We'll move it here to $(DESTDIR)/lib/security/ and then
158 # libpam-smbpass.files will make dh_movefiles move it to the
159 # right location in the libpam-smbpass package.
160 install -m 0644 source/bin/pam_smbpass.so $(DESTDIR)/lib/security/
162 # Create the symlink that will allow us to do "mount -t smbfs ...".
163 # Create also a symlink that will allow "mount -t smb ..." to
164 # work too. The symlink is created in $(DESTDIR)/sbin/ but
165 # will be moved by dh_movefiles to the smbfs package later on.
166 ln -s /usr/bin/smbmount $(DESTDIR)/sbin/mount.smbfs
167 ln -s /usr/bin/smbmount $(DESTDIR)/sbin/mount.smb
168 ln -s smbmount.8 $(DESTDIR)/usr/share/man/man8/mount.smb.8
169 ln -s smbmount.8 $(DESTDIR)/usr/share/man/man8/mount.smbfs.8
171 # For CUPS to support printing to samba printers, it's necessary
172 # to make the following symlink (according to
173 # Erich Schubert <debian@vitavonni.de> in #109509):
174 ln -s ../../../bin/smbspool $(DESTDIR)/usr/lib/cups/backend/smb
176 # Install man pages for files without man pages in the upstream sources
177 install -m 0644 debian/mksmbpasswd.8 $(DESTDIR)/usr/share/man/man8/mksmbpasswd.8
179 # Delete unwanted stuff leftover from "make install"
181 # The smbwrapper package is not being generated anymore, so we must
182 # delete the related man pages.
183 rm $(DESTDIR)/usr/share/man/man1/smbsh.1
185 # We're not providing findsmb (should we?) so let's remove the man
186 # pages.
187 find debian/ -name 'findsmb*' -exec rm -f {} \;
189 # Install samba-common's conffiles - they'll get moved later to their
190 # correct place by dh_movefiles.
191 cp debian/smb.conf $(DESTDIR)/etc/samba/
192 install -m755 debian/panic-action $(DESTDIR)/etc/samba/
193 cp debian/gdbcommands $(DESTDIR)/etc/samba/
194 cp debian/samba.pamd $(DESTDIR)/etc/pam.d/samba
195 install -m755 debian/samba-common.dhcp $(DESTDIR)/etc/dhcp3/dhclient-enter-hooks.d/samba
197 # Install the Python modules
199 #cp source/build/lib.*/samba/*.so $(DESTDIR)/usr/lib/python2.2/site-packages/
200 cp source/build/lib.linux-*-2.2/samba/*.so $(DESTDIR)/usr/lib/python2.2/site-packages/
202 dh_movefiles
204 # Build architecture-independent files here.
205 # Pass -i to all debhelper commands in this target to reduce clutter.
206 binary-indep: DH_OPTIONS=-i
207 binary-indep: build install
208 dh_testdir
209 dh_testroot
210 dh_installdebconf
211 dh_installdocs -A debian/README.build
212 # dh_installexamples is not available in Debian Potato...
213 [ -x /usr/bin/dh_installexamples ] && DH_OPTIONS= dh_installexamples -v -psamba-doc examples/*
214 # dh_installmenu
215 # dh_installemacsen
216 # dh_installpam
217 # dh_installinit
218 # dh_installcron
219 # dh_installmanpages
220 # dh_installinfo
221 # dh_undocumented
222 dh_installchangelogs
223 dh_link
224 dh_compress
225 dh_fixperms
227 # Get rid of those pesky .cvsignore files to make lintian happy
228 find debian/ -name .cvsignore -exec rm -f {} \;
230 dh_installdeb
231 # dh_perl
232 dh_gencontrol
233 dh_md5sums
234 dh_builddeb
236 # Build architecture-dependent files here.
237 # Pass -a to all debhelper commands in this target to reduce clutter.
238 binary-arch: DH_OPTIONS=-a
239 binary-arch: build install
240 dh_testdir
241 dh_testroot
242 dh_installdebconf
243 dh_installdocs -A debian/README.build
244 # dh_installexamples is not available in Debian Potato...
245 [ -x /usr/bin/dh_installexamples ] && DH_OPTIONS= dh_installexamples -v -ppython2.2-samba source/python/examples/*
246 # dh_installmenu
247 # dh_installlogrotate is not available in Debian Potato...
248 if [ -x /usr/bin/dh_installlogrotate ]; then \
249 dh_installlogrotate; \
250 else \
251 mkdir -p debian/samba/etc/logrotate.d; \
252 cp debian/samba.logrotate debian/samba/etc/logrotate.d/samba; \
253 mkdir -p debian/winbind/etc/logrotate.d; \
254 cp debian/winbind.logrotate debian/winbind/etc/logrotate.d/winbind; \
256 # dh_installemacsen
257 # dh_installpam
258 DH_OPTIONS= dh_installinit -psamba -- "defaults 20 19"
259 DH_OPTIONS= dh_installinit -pwinbind
260 dh_installcron
261 # dh_installmanpages
262 # dh_installinfo
263 cp debian/winbind.lintian debian/winbind/usr/share/lintian/overrides/winbind
264 # dh_undocumented
265 dh_installchangelogs -Nlibpam-smbpass
266 DH_OPTIONS= dh_installchangelogs -plibpam-smbpass source/pam_smbpass/CHANGELOG
267 dh_strip
268 dh_link
269 dh_compress
270 dh_fixperms
272 # Why this is executable, I have NO idea...
273 chmod a-x debian/libsmbclient-dev/usr/include/libsmbclient.h
275 # You may want to make some executables suid here.
276 # The smbmnt and smbumount binaries should be setuid-root. This
277 # has security implications because these programs haven't had
278 # a thorough security audit. smbmount _does not_ have to have
279 # the setuid bit set. In fact, it is a security hole.
280 chmod u+s debian/smbfs/usr/bin/smbmnt
281 chmod u+s debian/smbfs/usr/bin/smbumount
283 # Set some reasonable default perms for the samba logdir.
284 chmod 0750 debian/samba/var/log/samba/
285 chown root.adm debian/samba/var/log/samba/
287 # Get rid of those pesky .cvsignore files to make lintian happy
288 # (maybe we only need the "find ... -exec rm -f {} ;" we have
289 # in the binary-indep target?) peloy.-
290 find debian/ -name .cvsignore -exec rm -f {} \;
292 dh_installdeb
293 # dh_makeshlibs
294 # dh_perl
295 dh_shlibdeps
296 dh_gencontrol
297 dh_md5sums
298 dh_builddeb
300 binary: binary-indep binary-arch
301 .PHONY: build clean binary-indep binary-arch binary install configure