1
|
#!/usr/bin/make -f
|
2
|
|
3
|
# This has to be exported to make some magic below work.
|
4
|
export DH_OPTIONS
|
5
|
|
6
|
# Set the host and build architectures for use with config.cache loading,
|
7
|
# cross-building, etc.
|
8
|
DEB_HOST_GNU_TYPE := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
|
9
|
DEB_BUILD_GNU_TYPE := $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
|
10
|
DEB_HOST_ARCH_OS := $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)
|
11
|
|
12
|
export DEB_HOST_GNU_TYPE
|
13
|
export DEB_BUILD_GNU_TYPE
|
14
|
export DEB_HOST_ARCH_OS
|
15
|
|
16
|
CFLAGS = -g -Wall
|
17
|
|
18
|
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
|
19
|
CFLAGS += -O0
|
20
|
else
|
21
|
CFLAGS += -O2
|
22
|
endif
|
23
|
|
24
|
# Enable BIND_NOW to maximize benefit of RELRO hardening
|
25
|
LDFLAGS += -Wl,-z,now
|
26
|
|
27
|
DESTDIR=`pwd`/debian/tmp
|
28
|
|
29
|
conf_args = \
|
30
|
--cache-file=./config.cache \
|
31
|
--with-fhs \
|
32
|
--enable-shared \
|
33
|
--enable-static \
|
34
|
--prefix=/usr \
|
35
|
--sysconfdir=/etc \
|
36
|
--libdir=/usr/lib/samba \
|
37
|
--with-privatedir=/etc/samba \
|
38
|
--with-piddir=/var/run/samba \
|
39
|
--localstatedir=/var \
|
40
|
--with-rootsbindir=/sbin \
|
41
|
--with-pammodulesdir=/lib/security \
|
42
|
--with-pam \
|
43
|
--with-syslog \
|
44
|
--with-utmp \
|
45
|
--with-readline \
|
46
|
--with-pam_smbpass \
|
47
|
--with-libsmbclient \
|
48
|
--with-winbind \
|
49
|
--with-shared-modules=idmap_rid,idmap_ad,idmap_adex,idmap_hash,idmap_ldap,idmap_tdb2 \
|
50
|
--with-automount \
|
51
|
--with-ldap \
|
52
|
--with-ads \
|
53
|
--with-dnsupdate \
|
54
|
--without-libtdb \
|
55
|
--without-libnetapi \
|
56
|
--with-modulesdir=/usr/lib/samba \
|
57
|
--datarootdir=/usr/share \
|
58
|
--datadir=/usr/share/samba \
|
59
|
--with-swatdir=/usr/share/samba/swat \
|
60
|
--with-lockdir=/var/run/samba \
|
61
|
--with-statedir=/var/lib/samba \
|
62
|
--with-cachedir=/var/cache/samba \
|
63
|
--with-codepagedir=/usr/share/samba \
|
64
|
--enable-external-libtalloc \
|
65
|
--without-libtalloc \
|
66
|
--disable-avahi
|
67
|
|
68
|
ifeq ($(DEB_HOST_ARCH_OS),linux)
|
69
|
conf_args += \
|
70
|
--with-acl-support \
|
71
|
--with-quotas \
|
72
|
--without-cifsmount \
|
73
|
--without-cifsupcall
|
74
|
else
|
75
|
conf_args += --without-quotas --without-cifsmount
|
76
|
endif
|
77
|
|
78
|
ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
|
79
|
conf_args += --build $(DEB_BUILD_GNU_TYPE)
|
80
|
else
|
81
|
conf_args += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
|
82
|
endif
|
83
|
|
84
|
configure:
|
85
|
dh_testdir
|
86
|
|
87
|
if [ -f debian/config.cache ]; then \
|
88
|
cp -f debian/config.cache source3/config.cache; \
|
89
|
fi
|
90
|
|
91
|
[ -f source3/Makefile ] || (cd source3 && LDFLAGS="$(LDFLAGS)" CFLAGS="$(CFLAGS)" ./configure $(conf_args))
|
92
|
|
93
|
touch configure-stamp
|
94
|
|
95
|
build: configure build-stamp
|
96
|
build-stamp:
|
97
|
dh_testdir
|
98
|
|
99
|
$(MAKE) -C source3 # headers
|
100
|
$(MAKE) -C source3 everything
|
101
|
$(MAKE) -C source3 nsswitch
|
102
|
|
103
|
touch build-stamp
|
104
|
|
105
|
clean:
|
106
|
dh_testdir
|
107
|
dh_testroot
|
108
|
rm -f build-stamp configure-stamp
|
109
|
|
110
|
[ ! -f source3/Makefile ] || $(MAKE) -C source3 distclean
|
111
|
|
112
|
# Delete stuff left after a build that is not deleted by 'make clean'
|
113
|
rm -f source3/pkgconfig/*.pc \
|
114
|
source3/exports/libsmbclient.syms \
|
115
|
source3/exports/libsmbsharemodes.syms
|
116
|
|
117
|
debconf-updatepo
|
118
|
|
119
|
dh_clean
|
120
|
|
121
|
install: DH_OPTIONS=$(DH_EXTRAS)
|
122
|
install: build
|
123
|
dh_testdir
|
124
|
dh_testroot
|
125
|
dh_clean -k
|
126
|
dh_installdirs
|
127
|
|
128
|
mkdir -p $(DESTDIR)/usr/lib/cups/backend $(DESTDIR)/usr/share/samba \
|
129
|
$(DESTDIR)/etc/pam.d $(DESTDIR)/etc/dhcp3/dhclient-enter-hooks.d \
|
130
|
$(DESTDIR)/etc/ufw/applications.d
|
131
|
|
132
|
$(MAKE) -C source3 install DESTDIR=$(DESTDIR)
|
133
|
|
134
|
# Rename to *.samba3 for alternatives
|
135
|
mv $(DESTDIR)/usr/bin/smbstatus $(DESTDIR)/usr/bin/smbstatus.samba3
|
136
|
mv $(DESTDIR)/usr/bin/nmblookup $(DESTDIR)/usr/bin/nmblookup.samba3
|
137
|
mv $(DESTDIR)/usr/share/man/man1/nmblookup.1 $(DESTDIR)/usr/share/man/man1/nmblookup.samba3.1
|
138
|
mv $(DESTDIR)/usr/share/man/man1/smbstatus.1 $(DESTDIR)/usr/share/man/man1/smbstatus.samba3.1
|
139
|
mv $(DESTDIR)/usr/bin/net $(DESTDIR)/usr/bin/net.samba3
|
140
|
mv $(DESTDIR)/usr/share/man/man8/net.8 $(DESTDIR)/usr/share/man/man8/net.samba3.8
|
141
|
mv $(DESTDIR)/usr/bin/testparm $(DESTDIR)/usr/bin/testparm.samba3
|
142
|
mv $(DESTDIR)/usr/share/man/man1/testparm.1 $(DESTDIR)/usr/share/man/man1/testparm.samba3.1
|
143
|
|
144
|
# Starting with Samba 3.0.6 libsmbclient.so is installed in
|
145
|
# /usr/lib/samba. We don't want it there since it is not in the
|
146
|
# default library path. Here we move it to /usr/lib/.
|
147
|
mv $(DESTDIR)/usr/lib/samba/libsmbclient* $(DESTDIR)/usr/lib/
|
148
|
|
149
|
# same problem with libwbclient.
|
150
|
mv $(DESTDIR)/usr/lib/samba/libwbclient* $(DESTDIR)/usr/lib/
|
151
|
|
152
|
# Install other stuff not installed by "make install"
|
153
|
install -m 0755 debian/mksmbpasswd.awk $(DESTDIR)/usr/sbin/mksmbpasswd
|
154
|
install -m 0644 debian/mksmbpasswd.8 $(DESTDIR)/usr/share/man/man8/mksmbpasswd.8
|
155
|
install -m 0644 nsswitch/libnss_winbind.so $(DESTDIR)/lib/libnss_winbind.so.2
|
156
|
install -m 0644 nsswitch/libnss_wins.so $(DESTDIR)/lib/libnss_wins.so.2
|
157
|
# Install torture stuff
|
158
|
install -m 0755 source3/bin/smbtorture $(DESTDIR)/usr/bin/smbtorture
|
159
|
install -m 0755 source3/bin/msgtest $(DESTDIR)/usr/bin/msgtest
|
160
|
install -m 0755 source3/bin/masktest $(DESTDIR)/usr/bin/masktest
|
161
|
install -m 0755 source3/bin/locktest $(DESTDIR)/usr/bin/locktest
|
162
|
install -m 0755 source3/bin/locktest2 $(DESTDIR)/usr/bin/locktest2
|
163
|
install -m 0755 source3/bin/nsstest $(DESTDIR)/usr/bin/nsstest
|
164
|
install -m 0755 source3/bin/vfstest $(DESTDIR)/usr/bin/vfstest
|
165
|
install -m 0755 source3/bin/pdbtest $(DESTDIR)/usr/bin/pdbtest
|
166
|
install -m 0755 source3/bin/replacetort $(DESTDIR)/usr/bin/replacetort
|
167
|
install -m 0755 source3/bin/tdbtorture $(DESTDIR)/usr/bin/tdbtorture
|
168
|
install -m 0755 source3/bin/smbconftort $(DESTDIR)/usr/bin/smbconftort
|
169
|
mkdir -p $(DESTDIR)/usr/share/pam-configs
|
170
|
install -m 0644 debian/libpam-smbpass.pam-config $(DESTDIR)/usr/share/pam-configs/smbpasswd-migrate
|
171
|
install -m 0644 debian/winbind.pam-config $(DESTDIR)/usr/share/pam-configs/winbind
|
172
|
|
173
|
# For CUPS to support printing to samba printers, it's necessary
|
174
|
# to make the following symlink (according to
|
175
|
# Erich Schubert <debian@vitavonni.de> in #109509):
|
176
|
ln -s ../../../bin/smbspool $(DESTDIR)/usr/lib/cups/backend/smb
|
177
|
|
178
|
|
179
|
# ufw integration
|
180
|
install -m644 debian/samba.ufw.profile $(DESTDIR)/etc/ufw/applications.d/samba
|
181
|
|
182
|
cp debian/smb.conf* $(DESTDIR)/usr/share/samba/
|
183
|
install -m755 debian/panic-action $(DESTDIR)/usr/share/samba/panic-action
|
184
|
# Install samba-common's conffiles - they'll get moved later to their
|
185
|
# correct place by dh_movefiles.
|
186
|
cp debian/gdbcommands $(DESTDIR)/etc/samba/
|
187
|
install -m755 debian/samba-common.dhcp $(DESTDIR)/etc/dhcp3/dhclient-enter-hooks.d/samba
|
188
|
mkdir -p $(DESTDIR)/etc/network/if-up.d
|
189
|
install -o root -g root debian/samba.if-up $(DESTDIR)/etc/network/if-up.d/samba
|
190
|
install -D -m 644 debian/source_samba.py $(DESTDIR)/usr/share/apport/package-hooks/source_samba.py
|
191
|
|
192
|
dh_movefiles
|
193
|
dh_installpam --name=samba
|
194
|
|
195
|
# Build architecture-independent files here.
|
196
|
# Pass -i to all debhelper commands in this target to reduce clutter.
|
197
|
binary-indep: DH_OPTIONS=-i
|
198
|
binary-indep: build install
|
199
|
dh_testdir
|
200
|
dh_testroot
|
201
|
dh_installdebconf
|
202
|
dh_installdocs -A debian/README.build
|
203
|
# Ignore COPYING. Otherwise, an extra copy of the GPL licence
|
204
|
# in smbldap-tools example is included in samba-doc
|
205
|
dh_installexamples -Xsmbldap-tools-* -XCOPYING
|
206
|
dh_installchangelogs
|
207
|
dh_link
|
208
|
dh_compress
|
209
|
dh_fixperms
|
210
|
dh_installdeb
|
211
|
dh_gencontrol
|
212
|
dh_md5sums
|
213
|
dh_builddeb
|
214
|
|
215
|
# Build architecture-dependent files here.
|
216
|
# Pass -a to all debhelper commands in this target to reduce clutter.
|
217
|
|
218
|
binary-arch: DH_OPTIONS=-a $(DH_EXTRAS)
|
219
|
binary-arch: build install
|
220
|
dh_testdir
|
221
|
dh_testroot
|
222
|
dh_installdebconf
|
223
|
dh_installdocs -A debian/README.build
|
224
|
dh_installexamples
|
225
|
dh_installlogrotate
|
226
|
dh_installlogcheck
|
227
|
DH_OPTIONS= dh_installinit -psamba --upstart-only --no-start --name smbd
|
228
|
DH_OPTIONS= dh_installinit -psamba --upstart-only --no-start --name nmbd
|
229
|
DH_OPTIONS= dh_installinit -pwinbind --no-start
|
230
|
dh_installcron
|
231
|
dh_lintian
|
232
|
dh_installchangelogs -Nlibpam-smbpass
|
233
|
DH_OPTIONS= dh_installchangelogs -plibpam-smbpass source3/pam_smbpass/CHANGELOG
|
234
|
DH_OPTIONS= dh_strip -psamba -psmbclient -pwinbind -psamba-common-bin --dbg-package=samba-dbg
|
235
|
DH_OPTIONS= dh_strip -Nsamba -Nsmbclient -Nwinbind -Nsamba-common-bin
|
236
|
dh_link
|
237
|
dh_compress
|
238
|
dh_fixperms
|
239
|
|
240
|
# Upstream makefile installs this using "install" without -m, so
|
241
|
# it becomes executable
|
242
|
chmod a-x debian/libsmbclient-dev/usr/include/libsmbclient.h
|
243
|
|
244
|
# Set some reasonable default perms for the samba logdir.
|
245
|
chmod 0750 debian/samba-common/var/log/samba/
|
246
|
chown root:adm debian/samba-common/var/log/samba/
|
247
|
chmod 1777 debian/samba/var/spool/samba/
|
248
|
|
249
|
DH_OPTIONS= dh_makeshlibs -plibsmbclient -V'libsmbclient (>= 2:3.2.0)'
|
250
|
DH_OPTIONS= dh_makeshlibs -plibwbclient0 -V'libwbclient0 (>= 2:3.5.0~pre2)'
|
251
|
dh_installdeb
|
252
|
dh_shlibdeps
|
253
|
dh_gencontrol
|
254
|
dh_md5sums
|
255
|
dh_builddeb
|
256
|
|
257
|
binary: binary-indep binary-arch
|
258
|
|
259
|
.PHONY: build clean binary-indep binary-arch binary install configure
|