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>. 6# 7# 8 9# Uncomment this to turn on verbose mode. 10#export DH_VERBOSE=1 11 12# This is the debhelper compatability version to use. 13export DH_COMPAT=4 14 15# This has to be exported to make some magic below work. 16export DH_OPTIONS 17 18# Set the host and build architectures for use with config.cache loading, 19# cross-building, etc. 20DEB_HOST_GNU_TYPE := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) 21DEB_BUILD_GNU_TYPE := $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) 22 23export DEB_HOST_GNU_TYPE 24export DEB_BUILD_GNU_TYPE 25 26 27# Support the DEB_BUILD_OPTIONS variable 28CFLAGS = -gstabs -Wall 29INSTALL = install 30 31ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) 32 CFLAGS += -O0 33else 34 CFLAGS += -O2 35endif 36 37ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) 38 INSTALL += -s 39endif 40 41 42DESTDIR=`pwd`/debian/tmp 43 44patch: patch-stamp 45patch-stamp: 46 dh_testdir 47 if [ ! -f patch-stamp ]; then /bin/sh debian/scripts/patch-source; fi 48 touch patch-stamp 49 50unpatch: 51 dh_testdir 52 if [ -f patch-stamp ]; then /bin/sh debian/scripts/unpatch-source; fi 53 rm -f patch-stamp 54 55configure: patch-stamp configure-stamp 56configure-stamp: 57 dh_testdir 58 59 if [ -f debian/config.cache ]; then \ 60 cp -f debian/config.cache source/config.cache; \ 61 fi 62 63 [ -f source/Makefile ] || (cd source && CFLAGS="$(CFLAGS)" ./configure \ 64 --host=$(DEB_HOST_GNU_TYPE) \ 65 --build=$(DEB_BUILD_GNU_TYPE) \ 66 --cache-file=./config.cache \ 67 --with-fhs \ 68 --enable-shared \ 69 --enable-static \ 70 --prefix=/usr \ 71 --sysconfdir=/etc \ 72 --libdir=/etc/samba \ 73 --with-privatedir=/etc/samba \ 74 --with-piddir=/var/run/samba \ 75 --localstatedir=/var \ 76 --with-netatalk \ 77 --with-smbmount \ 78 --with-pam \ 79 --with-syslog \ 80 --with-utmp \ 81 --with-readline \ 82 --with-pam_smbpass \ 83 --with-libsmbclient \ 84 --with-winbind \ 85 --with-msdfs \ 86 --with-automount \ 87 --with-acl-support \ 88 --with-tdbsam \ 89 --with-ldap \ 90 --with-python=python2.3) 91 92 touch configure-stamp 93 94build: patch-stamp configure-stamp build-stamp 95build-stamp: 96 dh_testdir 97 98 $(MAKE) -C source headers 99 $(MAKE) -C source all nsswitch/libnss_wins.so python_ext 100 101 touch build-stamp 102 103clean: unpatch 104 dh_testdir 105 dh_testroot 106 rm -f build-stamp configure-stamp 107 108 # Clean first the Samba package 109# -$(MAKE) -C source realclean 110# -$(MAKE) -C source clean 111 -$(MAKE) -C source python_clean distclean 112 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 116 117 dh_clean 118 119install: DH_OPTIONS= 120install: build 121 dh_testdir 122 dh_testroot 123 dh_clean -k 124 dh_installdirs 125 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.3/site-packages 131 132 # Add here commands to install the package into debian/tmp. 133 $(MAKE) -C source install DESTDIR=$(DESTDIR) 134 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/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 142 # Install other stuff not installed by "make install" 143 install -m 0755 debian/mksmbpasswd.awk $(DESTDIR)/usr/sbin/mksmbpasswd 144 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/ 150 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 154 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/ 160 161 # Create the symlinks that will allow us to do "mount -t smbfs ..." 162 # and "mount -t smb ...". Note that the source/script/installbin.sh 163 # tries to create the first symlink, but we have commented 164 # that code out and do everything here. We also create 165 # symlinks for the man pages. 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 170 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 175 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 178 179 # We don't provide the "Using Samba" book in the swat package. 180 # It's provided in the samba-doc package so in the swat package 181 # we just provide a symlink to the real book. 182 ln -s ../../doc/samba-doc/htmldocs/using_samba \ 183 $(DESTDIR)/usr/share/samba/swat/using_samba 184 185 # Delete unwanted stuff leftover from "make install" 186 187 # The smbwrapper package is not being generated anymore, so we must 188 # delete the related man pages. 189 rm $(DESTDIR)/usr/share/man/man1/smbsh.1 190 191 # We're not providing findsmb (should we?) so let's remove the man 192 # pages. 193 find debian/ -name 'findsmb*' -exec rm -f {} \; 194 195 # Install samba-common's conffiles - they'll get moved later to their 196 # correct place by dh_movefiles. 197 cp debian/smb.conf $(DESTDIR)/usr/share/samba/ 198 install -m755 debian/panic-action $(DESTDIR)/usr/share/samba/ 199 cp debian/gdbcommands $(DESTDIR)/etc/samba/ 200 cp debian/samba.pamd $(DESTDIR)/etc/pam.d/samba 201 install -m755 debian/samba-common.dhcp $(DESTDIR)/etc/dhcp3/dhclient-enter-hooks.d/samba 202 203 # Install the Python modules 204 # 205 # Hmmm... need to figure this out. We have lib.linux-i686-2.2 206 # and lib.linux-i686-2.3 directories. Using only the stuff from 207 # the 2.3 directory for now. peloy.- 208 #cp source/build/lib.*/samba/*.so $(DESTDIR)/usr/lib/python2.3/site-packages/ 209 cp source/build/lib.linux-*-2.3/samba/*.so $(DESTDIR)/usr/lib/python2.3/site-packages/ 210 211 dh_movefiles 212 213# Build architecture-independent files here. 214# Pass -i to all debhelper commands in this target to reduce clutter. 215binary-indep: DH_OPTIONS=-i 216binary-indep: build install 217 dh_testdir 218 dh_testroot 219 dh_installdebconf 220 dh_installdocs -A debian/README.build 221 # dh_installexamples is not available in Debian Potato... 222 [ -x /usr/bin/dh_installexamples ] && DH_OPTIONS= dh_installexamples -v -psamba-doc examples/* 223# dh_installmenu 224# dh_installemacsen 225# dh_installpam 226# dh_installinit 227# dh_installcron 228# dh_installmanpages 229# dh_installinfo 230# dh_undocumented 231 dh_installchangelogs 232 dh_link 233 dh_compress 234 dh_fixperms 235 236 # Get rid of those pesky .cvsignore files to make lintian happy 237 find debian/ -name .cvsignore -exec rm -f {} \; 238 239 dh_installdeb 240# dh_perl 241 dh_gencontrol 242 dh_md5sums 243 dh_builddeb 244 245# Build architecture-dependent files here. 246# Pass -a to all debhelper commands in this target to reduce clutter. 247binary-arch: DH_OPTIONS=-a 248binary-arch: build install 249 dh_testdir 250 dh_testroot 251 dh_installdebconf 252 dh_installdocs -A debian/README.build 253 # dh_installexamples is not available in Debian Potato... 254 [ -x /usr/bin/dh_installexamples ] && DH_OPTIONS= dh_installexamples -v -ppython2.3-samba source/python/examples/* 255# dh_installmenu 256 # dh_installlogrotate is not available in Debian Potato... 257 if [ -x /usr/bin/dh_installlogrotate ]; then \ 258 dh_installlogrotate; \ 259 else \ 260 mkdir -p debian/samba/etc/logrotate.d; \ 261 cp debian/samba.logrotate debian/samba/etc/logrotate.d/samba; \ 262 mkdir -p debian/winbind/etc/logrotate.d; \ 263 cp debian/winbind.logrotate debian/winbind/etc/logrotate.d/winbind; \ 264 fi 265# dh_installemacsen 266# dh_installpam 267 DH_OPTIONS= dh_installinit -psamba -- "defaults 20 19" 268 DH_OPTIONS= dh_installinit -pwinbind 269 dh_installcron 270# dh_installmanpages 271# dh_installinfo 272 cp debian/winbind.lintian debian/winbind/usr/share/lintian/overrides/winbind 273# dh_undocumented 274 dh_installchangelogs -Nlibpam-smbpass 275 DH_OPTIONS= dh_installchangelogs -plibpam-smbpass source/pam_smbpass/CHANGELOG 276 dh_strip 277 dh_link 278 dh_compress 279 dh_fixperms 280 281 # Why this is executable, I have NO idea... 282 chmod a-x debian/libsmbclient-dev/usr/include/libsmbclient.h 283 284 # You may want to make some executables suid here. 285 # The smbmnt and smbumount binaries should be setuid-root. This 286 # has security implications because these programs haven't had 287 # a thorough security audit. smbmount _does not_ have to have 288 # the setuid bit set. In fact, it is a security hole. 289 chmod u+s debian/smbfs/usr/bin/smbmnt 290 chmod u+s debian/smbfs/usr/bin/smbumount 291 292 # Set some reasonable default perms for the samba logdir. 293 chmod 0750 debian/samba/var/log/samba/ 294 chown root.adm debian/samba/var/log/samba/ 295 296 # Get rid of those pesky .cvsignore files to make lintian happy 297 # (maybe we only need the "find ... -exec rm -f {} ;" we have 298 # in the binary-indep target?) peloy.- 299 find debian/ -name .cvsignore -exec rm -f {} \; 300 301 dh_installdeb 302# dh_makeshlibs 303# dh_perl 304 dh_shlibdeps 305 dh_gencontrol 306 dh_md5sums 307 dh_builddeb 308 309binary: binary-indep binary-arch 310.PHONY: build clean binary-indep binary-arch binary install configure 311