File: rules

package info (click to toggle)
samba 2:4.9.11+dfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 121,940 kB
  • sloc: ansic: 1,452,689; python: 155,504; xml: 48,263; sh: 46,920; perl: 31,595; asm: 3,281; yacc: 2,332; cpp: 2,225; ada: 1,681; exp: 1,582; makefile: 1,381; pascal: 1,082; cs: 879; lex: 613; awk: 118; csh: 58; sed: 45
file content (290 lines) | stat: -rwxr-xr-x 11,362 bytes parent folder | download
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
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
#!/usr/bin/make -f
# By Jelmer Vernooij <jelmer@samba.org>
#
DESTDIR = $(CURDIR)/debian/tmp

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk
include /usr/share/dpkg/pkg-info.mk

DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
DEB_HOST_ARCH_OS ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
DEB_HOST_ARCH_CPU ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_CPU)

PYVERS=$(shell pyversions -vr)

LDB_VERSION = $(shell pkg-config --modversion ldb)
LDB_EPOCH = $(shell dpkg-query -f '$${Version}' -W libldb-dev | sed 's/:.*//')
LDB_NEXT_VERSION = $(shell python -c "x = '$(LDB_VERSION)'.split('.'); x[-1] = str(int(x[-1])+1); print '.'.join(x)")
# samba ships ldb modules, which are specific to the ldb version, so we need a
# strict dependency on the upstream ldb version
# this also mean samba needs a rebuild when the upstream ldb version changes
LDB_DEPENDS = "libldb1 (<< $(LDB_EPOCH):1.5.1+really$(LDB_NEXT_VERSION)~), libldb1 (>> $(LDB_EPOCH):1.5.1+really$(LDB_VERSION)~)"
export PYSHORT=$(shell pyversions -d)
export PYTHON=$(shell which $(PYSHORT))
export PYTHON_CONFIG="$(PYTHON)-config"
WAF = $(PYTHON) ./buildtools/bin/waf -v

# wrapper around cups-config, to work around #726726
export PATH:=$(CURDIR)/debian/bin:$(PATH)

ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
WAF += -j $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
endif

conf_args = \
		--prefix=/usr \
		--enable-fhs \
		--sysconfdir=/etc \
		--localstatedir=/var \
		--libexecdir=/usr/lib/$(DEB_HOST_MULTIARCH) \
		--with-privatedir=/var/lib/samba/private \
		--with-smbpasswd-file=/etc/samba/smbpasswd \
		--with-piddir=/var/run/samba \
		--with-pammodulesdir=/lib/$(DEB_HOST_MULTIARCH)/security \
		--with-pam \
		--with-syslog \
		--with-utmp \
		--with-winbind \
		--with-shared-modules=idmap_rid,idmap_ad,idmap_adex,idmap_hash,idmap_ldap,idmap_tdb2,vfs_dfs_samba4,auth_samba4,vfs_nfs4acl_xattr \
		--with-automount \
		--with-ldap \
		--with-ads \
		--with-dnsupdate \
		--with-gpgme \
		--libdir=/usr/lib/$(DEB_HOST_MULTIARCH) \
		--with-modulesdir=/usr/lib/$(DEB_HOST_MULTIARCH)/samba \
		--datadir=/usr/share \
		--with-lockdir=/var/run/samba \
		--with-statedir=/var/lib/samba \
		--with-cachedir=/var/cache/samba \
		--enable-avahi \
		--disable-rpath \
		--disable-rpath-install \
		--bundled-libraries=NONE,pytevent,iniparser,roken,replace,wind,hx509,asn1,heimbase,hcrypto,krb5,gssapi,heimntlm,hdb,kdc,com_err,compile_et,asn1_compile \
		--builtin-libraries=ccan,samba-cluster-support \
		--minimum-library-version="$(shell ./debian/autodeps.py --minimum-library-version)" \
		--with-cluster-support \
		--with-socketpath=/var/run/ctdb/ctdbd.socket \
		--with-logdir=/var/log/ctdb

ifeq ($(DEB_HOST_ARCH_OS), linux)
	conf_args += \
		--with-systemd \
		--systemd-install-services \
		--with-systemddir=/lib/systemd/system
else
	conf_args += \
		--without-systemd
endif

ifeq ($(DEB_HOST_ARCH_CPU), amd64)
	conf_args += \
		--accel-aes=intelaesni
endif

%:
	dh $* --with python2

override_dh_auto_configure:
	$(WAF) configure $(conf_args)

override_dh_auto_build:
	DESTDIR="$(DESTDIR)" $(WAF)

override_dh_auto_test:
	# Running make test requires configuration with --enable-selftest, which
	# we don't want to do for production systems.

override_dh_auto_install:
	DESTDIR="$(DESTDIR)" $(WAF) install
	# get list of files in build log
	find ${DESTDIR}
	# Included in python-tevent
	rm $(DESTDIR)/usr/lib/python*/*-packages/_tevent.so
	rm $(DESTDIR)/usr/lib/python*/*-packages/tevent.py
	# Already documented in debian/copyright
	-rm $(DESTDIR)/usr/share/samba/setup/ad-schema/licence.txt
	# System ldb loads its modules from a different path
	mkdir -p $(DESTDIR)/usr/lib/$(DEB_HOST_MULTIARCH)/ldb/modules/ldb
	ln -sf ../../../samba/ldb $(DESTDIR)/usr/lib/$(DEB_HOST_MULTIARCH)/ldb/modules/ldb/samba
	# pam stuff
	mkdir -p $(DESTDIR)/usr/share/pam-configs
	install -m 0644 debian/winbind.pam-config $(DESTDIR)/usr/share/pam-configs/winbind
	mv $(DESTDIR)/usr/lib/$(DEB_HOST_MULTIARCH)/libnss_* $(DESTDIR)/lib/$(DEB_HOST_MULTIARCH)/
	# we don't ship the symlinks
	rm $(DESTDIR)/lib/$(DEB_HOST_MULTIARCH)/libnss_*.so
	#Remove unused vfstest manpage vfstest is no longer installed
	rm $(DESTDIR)/usr/share/man/man1/vfstest.1
	# Debian goodies to set global option in smb.conf and add a share
	install -m 0755 debian/setoption.py $(DESTDIR)/usr/share/samba
	install -m 0755 debian/addshare.py $(DESTDIR)/usr/share/samba
	# Debian goodies
	cp debian/smb.conf* $(DESTDIR)/usr/share/samba/
	install -m755 debian/panic-action $(DESTDIR)/usr/share/samba/panic-action
	install -m755 debian/update-apparmor-samba-profile $(DESTDIR)/usr/share/samba/update-apparmor-samba-profile
	cp debian/gdbcommands $(DESTDIR)/etc/samba/
	mkdir -p $(DESTDIR)/etc/dhcp/dhclient-enter-hooks.d
	install -m755 debian/samba-common.dhcp $(DESTDIR)/etc/dhcp/dhclient-enter-hooks.d/samba
	install -m 0755 debian/mksmbpasswd.awk $(DESTDIR)/usr/sbin/mksmbpasswd
	mkdir -p $(DESTDIR)/etc/ufw/applications.d
	install -m644 debian/samba.ufw.profile $(DESTDIR)/etc/ufw/applications.d/samba
	mkdir -p $(DESTDIR)/usr/share/apport/package-hooks
	install -D -m 644 debian/source_samba.py $(DESTDIR)/usr/share/apport/package-hooks/source_samba.py
	# Install other stuff not installed by "make install"
	mkdir -p debian/samba/usr/lib/$(PYSHORT)/dist-packages/samba
	mv $(DESTDIR)/usr/lib/$(PYSHORT)/dist-packages/samba/dckeytab.so \
	   debian/samba/usr/lib/$(PYSHORT)/dist-packages/samba/dckeytab.so
	# use upstream version of smb.conf.5 if there is no built version
	# this is a temporary workaround for #750593 in xsltproc
	[ -e $(DESTDIR)/usr/share/man/man5/smb.conf.5 ] || \
	   cp docs/manpages/smb.conf.5 $(DESTDIR)/usr/share/man/man5/smb.conf.5
	# Tests that shouldn't be installed
	rm -f $(DESTDIR)/usr/bin/async_connect_send_test
	# Remove ctdb tests
	rm $(DESTDIR)/usr/bin/ctdb_run_tests
	rm $(DESTDIR)/usr/bin/ctdb_run_cluster_tests
	rm -r $(DESTDIR)/usr/lib/*/ctdb/tests
	rm -r $(DESTDIR)/usr/share/ctdb/tests
ifeq ($(DEB_HOST_ARCH_OS), linux)
	# Install systemd configs
	mkdir -p $(DESTDIR)/lib/systemd/system/
	install -m 0644 ctdb/config/ctdb.service $(DESTDIR)/lib/systemd/system/
	# Services fixups
	mv $(DESTDIR)/lib/systemd/system/nmb.service $(DESTDIR)/lib/systemd/system/nmbd.service
	mv $(DESTDIR)/lib/systemd/system/smb.service $(DESTDIR)/lib/systemd/system/smbd.service
	mv $(DESTDIR)/lib/systemd/system/samba.service $(DESTDIR)/lib/systemd/system/samba-ad-dc.service
	sed -i \
	  -e 's|/etc/sysconfig/|/etc/default/|' \
	  -e 's|nmb\.service|nmbd.service|' \
	  -e 's|smb\.service|smbd.service|' \
	  -e 's|samba\.service|samba-ad-dc.service|' \
	  $(DESTDIR)/lib/systemd/system/nmbd.service \
	  $(DESTDIR)/lib/systemd/system/samba-ad-dc.service \
	  $(DESTDIR)/lib/systemd/system/smbd.service \
	  $(DESTDIR)/lib/systemd/system/winbind.service
endif
	# Harmless on systems without systemd-tmpfiles, and other consumers exist
	# such as OpenRC's opentmpfiles
	mkdir -p $(DESTDIR)/usr/lib/tmpfiles.d
	echo "d /run/samba 0755 root root -" > $(DESTDIR)/usr/lib/tmpfiles.d/samba.conf
	echo "d /run/ctdb 0755 root root -" > $(DESTDIR)/usr/lib/tmpfiles.d/ctdb.conf

override_dh_installdocs-arch:
	cp ctdb/config/events/README ctdb/README.eventscripts
	cp ctdb/config/notification.README ctdb/README.notification
	dh_installdocs
ifeq ($(DEB_HOST_ARCH_OS), hurd)
	dh_installdocs -pctdb debian/ctdb.README.hurd
endif
ifeq ($(DEB_HOST_ARCH_OS), kfreebsd)
	dh_installdocs -pctdb debian/ctdb.README.kfreebsd
endif

override_dh_python2:
	dh_python2 --no-guessing-versions

override_dh_installexamples-arch:
	# CTDB config examples and helper scripts
	mkdir -p ctdb/doc/examples/nfs-kernel-server
	cp debian/ctdb.example.enable.nfs.sh ctdb/doc/examples/nfs-kernel-server/enable-nfs.sh
	cp debian/ctdb.example.nfs-common ctdb/doc/examples/nfs-kernel-server/nfs-common
	cp debian/ctdb.example.nfs-kernel-server ctdb/doc/examples/nfs-kernel-server/nfs-kernel-server
	cp debian/ctdb.example.services ctdb/doc/examples/nfs-kernel-server/services
	cp debian/ctdb.example.sysctl-nfs-static-ports.conf ctdb/doc/examples/nfs-kernel-server/99-nfs-static-ports.conf
	dh_installexamples

override_dh_installchangelogs:
	dh_installchangelogs

override_dh_installinit:
ifneq (,$(filter samba, $(shell dh_listpackages)))
	dh_installinit -psamba --name smbd
	dh_installinit -psamba --name nmbd --error-handler nmbd_error_handler
	dh_installinit -psamba --name samba-ad-dc
endif
ifneq (,$(filter winbind, $(shell dh_listpackages)))
	dh_installinit -pwinbind
endif
ifneq (,$(filter ctdb, $(shell dh_listpackages)))
	# Install /etc/init.d/ctdb
	mkdir -p $(CURDIR)/debian/ctdb/etc/init.d
	install -m755 ctdb/config/ctdb.init $(CURDIR)/debian/ctdb/etc/init.d/ctdb
	# Install dh scripts
	dh_installinit -pctdb --no-start --no-stop-on-upgrade --onlyscripts
endif

override_dh_installsystemd:
ifneq (,$(filter samba, $(shell dh_listpackages)))
	dh_installsystemd -psamba
endif
ifneq (,$(filter winbind, $(shell dh_listpackages)))
	dh_installsystemd -pwinbind
endif
ifneq (,$(filter ctdb, $(shell dh_listpackages)))
	dh_installsystemd -pctdb --no-start --no-stop-on-upgrade
endif

override_dh_installpam:
	dh_installpam --name=samba

override_dh_perl-arch:
	dh_perl -a
	# Fix Perl shbangs
	sed -i '1s@^#!/usr/bin/env perl@#!/usr/bin/perl@' \
	  debian/libparse-pidl-perl/usr/bin/pidl \
	  debian/smbclient/usr/bin/findsmb

override_dh_fixperms:
	dh_fixperms
ifneq (,$(filter samba-common, $(shell dh_listpackages)))
	chmod a+x debian/samba-common/usr/share/samba/panic-action
endif
ifneq (,$(filter samba, $(shell dh_listpackages)))
	chmod 1777 debian/samba/var/spool/samba/
endif
ifneq (,$(filter smbclient, $(shell dh_listpackages)))
	chmod 0700 debian/smbclient/usr/lib/*/samba/smbspool_krb5_wrapper
endif

override_dh_missing:
	dh_missing --fail-missing

override_dh_makeshlibs:
	# create symbols and shlibs files in separate wrapper script to deal with
	# private libraries
	debian/make_shlibs

override_dh_shlibdeps:
	LD_LIBRARY_PATH=$(DESTDIR)/usr/lib/$(DEB_HOST_MULTIARCH)/samba:$$LD_LIBRARY_PATH \
	  dh_shlibdeps -a -Xceph.so -Xglusterfs.so -Xsnapper.so
ifeq ($(DEB_HOST_ARCH_OS), linux)
	LD_LIBRARY_PATH=$(DESTDIR)/usr/lib/$(DEB_HOST_MULTIARCH)/samba:$$LD_LIBRARY_PATH \
	  dh_shlibdeps -a -- -pvfsmods -dRecommends \
	    -e debian/samba-vfs-modules/usr/lib/*/samba/vfs/ceph.so \
	    -e debian/samba-vfs-modules/usr/lib/*/samba/vfs/glusterfs.so \
	    -e debian/samba-vfs-modules/usr/lib/*/samba/vfs/snapper.so
else
	LD_LIBRARY_PATH=$(DESTDIR)/usr/lib/$(DEB_HOST_MULTIARCH)/samba:$$LD_LIBRARY_PATH \
	  dh_shlibdeps -a -- -pvfsmods -dRecommends \
	    -e debian/samba-vfs-modules/usr/lib/*/samba/vfs/snapper.so
endif

override_dh_gencontrol:
ifneq (,$(filter libparse-pidl-perl, $(shell dh_listpackages)))
	dh_gencontrol --package=libparse-pidl-perl -- -v$(DEB_VERSION)+really0.02
endif
	dh_gencontrol --remaining-packages -- -Vldb:Depends=$(LDB_DEPENDS)

override_dh_auto_clean:
	-$(WAF) clean
	find . -name "*.pyc" | xargs rm -f
	rm -rf buildtools/bin/.waf-*
	rm -rf bin
	rm -f .lock-wscript
	rm -f ctdb/README.eventscripts
	rm -f ctdb/README.notification
	rm -rf ctdb/doc/examples/nfs-kernel-server/