Bringing packaging/Debian/ up to date with the current Samba package
[Samba.git] / packaging / Debian / debian / rules
blob321d02bca4412b9b2220c998b0505cffae43cb7b
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 # $Id: rules,v 1.2.4.1 2003/06/01 04:30:10 peloy Exp $
10 # Uncomment this to turn on verbose mode.
11 #export DH_VERBOSE=1
13 # This is the debhelper compatability version to use.
14 export DH_COMPAT=2
16 # This has to be exported to make some magic below work.
17 export DH_OPTIONS
19 # Set the host and build architectures for use with config.cache loading,
20 # cross-building, etc.
21 DEB_HOST_GNU_TYPE := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
22 DEB_BUILD_GNU_TYPE := $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
24 export DEB_HOST_GNU_TYPE
25 export DEB_BUILD_GNU_TYPE
27 DESTDIR=`pwd`/debian/tmp
28 SWATDIR=`pwd`/debian/swat
29 SAMBABOOK=`pwd`/debian/swat
31 IVARS = BASEDIR=$(DESTDIR)/usr \
32 prefix=$(DESTDIR)/usr \
33 BINDIR=$(DESTDIR)/usr/bin \
34 SBINDIR=$(DESTDIR)/usr/sbin \
35 MANDIR=$(DESTDIR)/usr/share/man \
36 LIBDIR=$(DESTDIR)/etc/samba \
37 VARDIR=$(DESTDIR)/var \
38 INCLUDEDIR=$(DESTDIR)/usr/include \
39 SWATDIR=$(SWATDIR)/usr/share/samba/swat \
40 SAMBABOOK=$(SAMBABOOK)/usr/share/samba/swat/using_samba \
41 CODEPAGEDIR=$(DESTDIR)/usr/share/samba/ \
42 PRIVATEDIR=$(DESTDIR)/etc/samba \
43 CONFIGDIR=$(DESTDIR)/etc/samba
45 patch: patch-stamp
46 patch-stamp:
47 dh_testdir
48 if [ ! -f patch-stamp ]; then /bin/sh debian/scripts/patch-source; fi
49 touch patch-stamp
51 unpatch:
52 dh_testdir
53 if [ -f patch-stamp ]; then /bin/sh debian/scripts/unpatch-source; fi
54 rm -f patch-stamp
56 configure: patch-stamp configure-stamp
57 configure-stamp:
58 dh_testdir
60 if [ -f debian/config.cache ]; then \
61 cp -f debian/config.cache source/config.cache; \
64 [ -f source/Makefile ] || (cd source && ./configure \
65 --host=$(DEB_HOST_GNU_TYPE) \
66 --build=$(DEB_BUILD_GNU_TYPE) \
67 --cache-file=./config.cache \
68 --with-fhs \
69 --enable-shared \
70 --enable-static \
71 --prefix=/usr \
72 --sysconfdir=/etc \
73 --libdir=/etc/samba \
74 --with-privatedir=/etc/samba \
75 --localstatedir=/var \
76 --with-netatalk \
77 --with-smbmount \
78 --with-pam \
79 --with-syslog \
80 --with-sambabook \
81 --with-utmp \
82 --with-readline \
83 --with-pam_smbpass \
84 --with-libsmbclient \
85 --with-winbind \
86 --with-msdfs \
87 --with-automount \
88 --with-acl-support \
89 --with-tdbsam \
90 --with-ldap \
91 --with-python=python2.2)
93 touch configure-stamp
95 build: patch-stamp configure-stamp build-stamp
96 build-stamp:
97 dh_testdir
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 \
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 $(IVARS)
135 # libsmbclient files are not installed by the standard
136 # 'make install' - do it manually.
137 $(MAKE) -C source installclientlib $(IVARS)
138 mv $(DESTDIR)/usr/lib/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
142 # Install other stuff not installed by "make install"
143 install -m 0755 debian/mksmbpasswd.awk $(DESTDIR)/usr/sbin/mksmbpasswd
145 # Install winbind stuff not installed by 'make install'
146 install -m 0644 source/nsswitch/libnss_winbind.so \
147 $(DESTDIR)/lib/libnss_winbind.so.2
148 install -m 0644 source/nsswitch/pam_winbind.so \
149 $(DESTDIR)/lib/security/
151 # Install libnss_wins.so, which is not installed by 'make install' either.
152 install -m 0644 source/nsswitch/libnss_wins.so \
153 $(DESTDIR)/lib/libnss_wins.so.2
155 # pam_smbpass.so isn't being installed by 'make install'.
156 # We'll move it here to $(DESTDIR)/lib/security/ and then
157 # libpam-smbpass.files will make dh_movefiles move it to the
158 # right location in the libpam-smbpass package.
159 install -m 0644 source/bin/pam_smbpass.so $(DESTDIR)/lib/security/
161 # Create the symlink that will allow us to do "mount -t smbfs ...".
162 # Create also a symlink that will allow "mount -t smb ..." to
163 # work too. The symlink is created in $(DESTDIR)/sbin/ but
164 # will be moved by dh_movefiles to the smbfs package later on.
165 ln -s /usr/bin/smbmount $(DESTDIR)/sbin/mount.smbfs
166 ln -s /usr/bin/smbmount $(DESTDIR)/sbin/mount.smb
167 ln -s smbmount.8 $(DESTDIR)/usr/share/man/man8/mount.smb.8
168 ln -s smbmount.8 $(DESTDIR)/usr/share/man/man8/mount.smbfs.8
170 # For CUPS to support printing to samba printers, it's necessary
171 # to make the following symlink (according to
172 # Erich Schubert <debian@vitavonni.de> in #109509):
173 ln -s ../../../bin/smbspool $(DESTDIR)/usr/lib/cups/backend/smb
175 # To avoid duplication of a large number of files, the swat package
176 # does not contain the "Using Samba" book nor the HTML docs.
177 # Instead, these are provided by the samba-doc package and
178 # are accessed through symlinks provided in the swat package.
179 # Here we create the symlink for the book, and the symlinks
180 # for the HTML files are created by the script installswat.sh.
181 ln -s ../../doc/samba-doc/htmldocs/using_samba $(SAMBABOOK)/usr/share/samba/swat/using_samba
183 # Install man pages for files without man pages in the upstream sources
184 install -m 0644 debian/mksmbpasswd.8 $(DESTDIR)/usr/share/man/man8/mksmbpasswd.8
186 # Delete unwanted stuff leftover from "make install"
188 # The smbwrapper package is not being generated anymore, so we must
189 # delete the related man pages.
190 rm $(DESTDIR)/usr/share/man/man1/smbsh.1
192 # We're not providing findsmb (should we?) so let's remove the man
193 # pages.
194 find debian/ -name 'findsmb*' -exec rm -f {} \;
196 # Install samba-common's conffiles - they'll get moved later to their
197 # correct place by dh_movefiles.
198 cp debian/smb.conf $(DESTDIR)/usr/share/samba/
199 install -m755 debian/panic-action $(DESTDIR)/usr/share/samba/
200 cp debian/gdbcommands $(DESTDIR)/etc/samba/
201 cp debian/samba.pamd $(DESTDIR)/etc/pam.d/samba
202 install -m755 debian/samba-common.dhcp $(DESTDIR)/etc/dhcp3/dhclient-enter-hooks.d/samba
204 # Install the Python modules
205 cp source/build/lib.*/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 -n
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