1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
|
#!/usr/bin/make -f
#
# Important modifications (introduction of a saved config.cache to
# solve build problems) we introduced in Samba 2.2.1a-5. These
# modification were made by Steve Langasek <vorlon@netexpress.net>.
#
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
# This is the debhelper compatability version to use.
export DH_COMPAT=2
# This has to be exported to make some magic below work.
export DH_OPTIONS
# Set the host and build architectures for use with config.cache loading,
# cross-building, etc.
DEB_HOST_GNU_TYPE := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE := $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
export DEB_HOST_GNU_TYPE
export DEB_BUILD_GNU_TYPE
BVARS = SMBLOGFILE=/var/log/smb NMBLOGFILE=/var/log/nmb
DESTDIR=`pwd`/debian/samba
SWATDIR=`pwd`/debian/swat
SAMBABOOK=`pwd`/debian/swat
IVARS = BASEDIR=$(DESTDIR)/usr \
BINDIR=$(DESTDIR)/usr/bin \
SBINDIR=$(DESTDIR)/usr/sbin \
MANDIR=$(DESTDIR)/usr/share/man \
LIBDIR=$(DESTDIR)/etc/samba \
VARDIR=$(DESTDIR)/var/state/samba \
INCLUDEDIR=$(DESTDIR)/usr/include \
SWATDIR=$(SWATDIR)/usr/share/samba/swat \
SAMBABOOK=$(SAMBABOOK)/usr/share/samba/swat/using_samba \
CODEPAGEDIR=$(DESTDIR)/usr/share/samba/codepages
patch: patch-stamp
patch-stamp:
dh_testdir
if [ ! -f patch-stamp ]; then debian/scripts/patch-source; fi
touch patch-stamp
unpatch:
dh_testdir
if [ -f patch-stamp ]; then debian/scripts/unpatch-source; fi
rm -f patch-stamp
configure: patch-stamp configure-stamp
configure-stamp:
dh_testdir
# Add here commands to configure the package.
# >
# > Does the --with-fhs option work in configure? I tried it with
# > alpha3, but everything was stored in /usr/local. Is that correct?
# > ...
#
# Yes - the default prefix is still /usr/local; --with-fhs just
# changes the default paths for the config, etc. files to match
# the GNU/FHS specs. To get a complete FHS directory spec, use:
#
# ./configure --with-fhs --prefix=/usr --sysconfdir=/etc \
# --localstatedir=/var
if [ -f debian/config.cache ]; then \
cp -f debian/config.cache source/config.cache; \
fi
# [ -f source/Makefile ] || (cd source && ./configure --with-fhs --prefix=/usr --exec-prefix=/usr --with-netatalk --with-smbmount --with-pam --with-syslog --with-sambabook --with-utmp)
[ -f source/Makefile ] || (cd source && ./configure \
--host=$(DEB_HOST_GNU_TYPE) \
--build=$(DEB_BUILD_GNU_TYPE) \
--with-fhs \
--prefix=/usr \
--sysconfdir=/etc \
--with-privatedir=/etc/samba \
--with-lockdir=/var/state/samba \
--localstatedir=/var \
--with-netatalk \
--with-smbmount \
--with-pam \
--with-syslog \
--with-sambabook \
--with-utmp \
--with-readline \
--with-pam_smbpass \
--with-libsmbclient)
touch configure-stamp
build: patch-stamp configure-stamp build-stamp
build-stamp:
dh_testdir
# Compile the Samba package first
# $(MAKE) -C source $(BVARS) all smbtorture rpctorture debug2html
$(MAKE) -C source all
touch build-stamp
clean: unpatch
dh_testdir
dh_testroot
rm -f build-stamp configure-stamp
# Clean first the Samba package
# -$(MAKE) -C source realclean
# -$(MAKE) -C source clean
-$(MAKE) -C source distclean
# Delete stuff left after a build that is not deleted by 'make clean'
rm -f source/bin/wbinfo source/bin/winbindd source/bin/rpctorture \
source/bin/debug2html
dh_clean
install: DH_OPTIONS=
install: build
dh_testdir
dh_testroot
dh_clean -k
dh_installdirs
# Add here commands to install the package into debian/tmp.
$(MAKE) -C source install $(IVARS)
# libsmbclient is installed in usr/bin/. Move to usr/lib/.
mv $(DESTDIR)/usr/bin/libsmbclient.so $(DESTDIR)/usr/lib/libsmbclient.so.0.1
mv $(DESTDIR)/usr/bin/libsmbclient.a $(DESTDIR)/usr/lib/
# This is to comply with policy (the symlink that ldconfig would
# produce must exist in the package).
/sbin/ldconfig -n $(DESTDIR)/usr/lib/
# libsmbclient include file is not installed by standard
# 'make install' - do it manually.
$(MAKE) -C source installclientlib $(IVARS)
# Install other stuff not installed by "make install"
install -m 0755 debian/mksmbpasswd.awk $(DESTDIR)/usr/sbin/mksmbpasswd
install -m 0755 debian/sambaconfig $(DESTDIR)/usr/sbin/
install -m 0755 source/bin/pam_smbpass.so $(DESTDIR)/lib/security/
# This is only temporary, while we create new packages for winbind and friends
install -m 0644 source/nsswitch/libnss_winbind.so $(DESTDIR)/lib/libnss_winbind.so.2
install -m 0644 source/nsswitch/pam_winbind.so $(DESTDIR)/lib/security/
# Create the symlink that will allow us to do "mount -t smbfs ...".
# Create also a symlink that will allow "mount -t smb ..." to
# work too. The symlink is created in $(DESTDIR)/sbin/ but
# will be moved by dh_movefiles to the smbfs package later on.
ln -s /usr/bin/smbmount $(DESTDIR)/sbin/mount.smbfs
ln -s /usr/bin/smbmount $(DESTDIR)/sbin/mount.smb
ln -s smbmount.8 $(DESTDIR)/usr/share/man/man8/mount.smb.8
ln -s smbmount.8 $(DESTDIR)/usr/share/man/man8/mount.smbfs.8
# For CUPS to support printing to samba printers, it's necessary
# to make the following symlink (according to
# Erich Schubert <debian@vitavonni.de> in #109509):
ln -s /usr/bin/smbspool $(DESTDIR)/usr/lib/cups/backend/smb
# To avoid duplication of a large number of files, the swat package
# does not contain the "Using Samba" book nor the HTML docs.
# Instead, these are provided by the samba-doc package and
# are accessed through symlinks provided in the swat package.
# Here we create the symlink for the book, and the symlinks
# for the HTML files are created by the script installswat.sh.
ln -s ../../../doc/samba-doc/htmldocs/using_samba $(SAMBABOOK)/usr/share/samba/swat/using_samba
# Install man pages for files without man pages in the upstream sources
install -m 0644 debian/sambaconfig.8 $(DESTDIR)/usr/share/man/man8/sambaconfig.8
install -m 0644 debian/mksmbpasswd.8 $(DESTDIR)/usr/share/man/man8/mksmbpasswd.8
# Delete unwanted stuff leftover from "make install"
# The smbwrapper package is not being generated anymore, so we must
# delete the related man pages.
rm $(DESTDIR)/usr/share/man/man1/smbsh.1
# Install samba-common's conffiles - they'll get moved later to their
# correct place by dh_movefiles.
cp debian/smb.conf $(DESTDIR)/etc/samba/
cp debian/samba.pamd $(DESTDIR)/etc/pam.d/samba
dh_movefiles --sourcedir=debian/samba/
# Remove empty directories that will never be used.
rmdir $(DESTDIR)/sbin
# Build architecture-independent files here.
# Pass -i to all debhelper commands in this target to reduce clutter.
binary-indep: DH_OPTIONS=-i
binary-indep: build install
# Need this version of debhelper for DH_OPTIONS to work.
dh_testversion 1.1.17
dh_testdir
dh_testroot
# dh_installdebconf
dh_installdocs -A docs/textdocs/DIAGNOSIS.txt debian/README.build docs/README* docs/Samba-HOWTO-Collection.pdf
# dh_installexamples is not available in Debian Potato...
[ -x /usr/bin/dh_installexamples ] && dh_installexamples
# dh_installmenu
# dh_installemacsen
# dh_installpam
# dh_installinit
# dh_installcron
# dh_installmanpages
# dh_installinfo
# dh_undocumented
dh_installchangelogs
dh_link
dh_compress
dh_fixperms
dh_installdeb
# dh_perl
dh_gencontrol
dh_md5sums
dh_builddeb
# Build architecture-dependent files here.
# Pass -a to all debhelper commands in this target to reduce clutter.
binary-arch: DH_OPTIONS=-a
binary-arch: build install
# Need this version of debhelper for DH_OPTIONS to work.
dh_testversion 1.1.17
dh_testdir
dh_testroot
# dh_installdebconf
dh_installdocs -A docs/textdocs/DIAGNOSIS.txt debian/README.build docs/README* docs/Samba-HOWTO-Collection.pdf
# dh_installexamples is not available in Debian Potato...
[ -x /usr/bin/dh_installexamples ] && dh_installexamples
# dh_installmenu
# dh_installlogrotate is not available in Debian Potato...
if [ -x /usr/bin/dh_installlogrotate ]; then dh_installlogrotate; else mkdir debian/samba/etc/logrotate.d; cp debian/samba.logrotate debian/samba/etc/logrotate.d/samba; fi
# dh_installemacsen
# dh_installpam
dh_installinit
dh_installcron
# dh_installmanpages
# dh_installinfo
dh_undocumented
dh_installchangelogs
dh_strip
dh_link
dh_compress
dh_fixperms
# You may want to make some executables suid here.
# The smbmnt and smbumount binaries should be setuid-root. This
# has security implications because these programs haven't had
# a thorough security audit. smbmount _does not_ have to have
# the setuid bit set. In fact, it is a security hole.
chmod u+s debian/smbfs/usr/bin/smbmnt
chmod u+s debian/smbfs/usr/bin/smbumount
# Set some reasonable default perms for the samba logdir.
chmod 0750 $(DESTDIR)/var/log/samba/
chown root.adm $(DESTDIR)/var/log/samba/
dh_installdeb
# dh_makeshlibs
# dh_perl
dh_shlibdeps
dh_gencontrol
dh_md5sums
dh_builddeb
binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install configure
|