summaryrefslogtreecommitdiff
path: root/debian/rules
blob: f33d30cfdeb896e7a695d14e864487f96ce17ec4 (plain)
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
#!/usr/bin/make -f

# Set the host and build architectures for use with config.cache loading,
# cross-building, etc.
DEB_HOST_ARCH_OS	:= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)
DEB_HOST_MULTIARCH	?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

export DEB_CFLAGS_MAINT_APPEND  := -Wall
export DEB_BUILD_MAINT_OPTIONS	:= hardening=+bindnow

# Ignore these files which would otherwise be pulled into our examples
export DH_ALWAYS_EXCLUDE := COPYING:Makefile.internal:history

DESTDIR=`pwd`/debian/tmp

%:
	dh $@ --sourcedirectory=source3

conf_args = \
		--cache-file=./config.cache \
		--with-fhs \
		--enable-static \
		--with-privatedir=/etc/samba \
		--with-piddir=/var/run/samba \
		--with-rootsbindir=/sbin \
		--with-pammodulesdir=/lib/$(DEB_HOST_MULTIARCH)/security \
		--with-pam \
		--with-syslog \
		--with-utmp \
		--with-readline \
		--with-pam_smbpass \
		--with-winbind \
		--with-shared-modules=idmap_rid,idmap_ad,idmap_adex,idmap_hash,idmap_ldap,idmap_tdb2 \
		--with-automount \
		--with-ldap \
		--with-ads \
		--with-dnsupdate \
		--without-libtdb \
		--without-libnetapi \
		--with-modulesdir=/usr/lib/samba \
		--datadir=/usr/share/samba \
		--with-swatdir=/usr/share/samba/swat \
		--with-lockdir=/var/run/samba \
		--with-statedir=/var/lib/samba \
		--with-cachedir=/var/cache/samba \
		--with-codepagedir=/usr/share/samba \
		--with-nmbdsocketdir=/var/run/samba \
		--enable-external-libtalloc \
		--without-libtalloc \
		--without-cifsmount \
		--disable-avahi \
		--without-libtdb \
		--enable-external-libtdb

ifeq ($(DEB_HOST_ARCH_OS),linux)
  conf_args += \
		--with-ctdb=/usr --with-cluster-support=yes \
		--with-acl-support \
		--with-quotas \
		--without-cifsupcall          
	  else
  conf_args +=	--without-quotas
endif

override_dh_auto_configure:
	if [ -f debian/config.cache ]; then \
		cp -f debian/config.cache source3/config.cache; \
	fi
	dh_auto_configure -- $(conf_args)

override_dh_auto_build:
	dh_auto_build -- everything nsswitch

# our test suite requires including a wrapper lib we don't want to ship.
override_dh_auto_test:

override_dh_auto_install:
	dh_auto_install

	# Rename to *.samba3 for alternatives
	mv $(DESTDIR)/usr/bin/smbstatus $(DESTDIR)/usr/bin/smbstatus.samba3
	mv $(DESTDIR)/usr/bin/nmblookup $(DESTDIR)/usr/bin/nmblookup.samba3
	mv $(DESTDIR)/usr/share/man/man1/nmblookup.1 $(DESTDIR)/usr/share/man/man1/nmblookup.samba3.1
	mv $(DESTDIR)/usr/share/man/man1/smbstatus.1 $(DESTDIR)/usr/share/man/man1/smbstatus.samba3.1
	mv $(DESTDIR)/usr/bin/net $(DESTDIR)/usr/bin/net.samba3
	mv $(DESTDIR)/usr/share/man/man8/net.8 $(DESTDIR)/usr/share/man/man8/net.samba3.8
	mv $(DESTDIR)/usr/bin/testparm $(DESTDIR)/usr/bin/testparm.samba3
	mv $(DESTDIR)/usr/share/man/man1/testparm.1 $(DESTDIR)/usr/share/man/man1/testparm.samba3.1

	# Install other stuff not installed by "make install"
	install -m 0755 debian/mksmbpasswd.awk $(DESTDIR)/usr/sbin/mksmbpasswd
	install -m 0644 nsswitch/libnss_winbind.so $(DESTDIR)/lib/$(DEB_HOST_MULTIARCH)/libnss_winbind.so.2
	install -m 0644 nsswitch/libnss_wins.so $(DESTDIR)/lib/$(DEB_HOST_MULTIARCH)/libnss_wins.so.2
	mkdir -p $(DESTDIR)/usr/share/pam-configs
	install -m 0644 debian/libpam-smbpass.pam-config $(DESTDIR)/usr/share/pam-configs/smbpasswd-migrate
	install -m 0644 debian/winbind.pam-config $(DESTDIR)/usr/share/pam-configs/winbind

	# Install samba-common's conffiles - they'll get moved later to their
	# correct place by dh_install
	mkdir -p $(DESTDIR)/etc/dhcp3/dhclient-enter-hooks.d
	install -m755 debian/samba-common.dhcp $(DESTDIR)/etc/dhcp3/dhclient-enter-hooks.d/samba
	mkdir -p $(DESTDIR)/etc/network/if-up.d
	install -o root -g root debian/samba.if-up $(DESTDIR)/etc/network/if-up.d/samba

override_dh_installpam:
	dh_installpam --name=samba

override_dh_installchangelogs:
	dh_installchangelogs -Nlibpam-smbpass
ifneq (,$(filter libpam-smbpass, $(shell dh_listpackages)))
	dh_installchangelogs -plibpam-smbpass source3/pam_smbpass/CHANGELOG
endif

override_dh_installinit:
ifneq (,$(filter samba, $(shell dh_listpackages)))
	dh_installinit -psamba -- "defaults 20 19"
endif
ifneq (,$(filter winbind, $(shell dh_listpackages)))
	dh_installinit -pwinbind
endif

override_dh_strip:
	dh_strip -psamba -psmbclient -pwinbind -psamba-common-bin --dbg-package=samba-dbg
	dh_strip -Nsamba -Nsmbclient -Nwinbind -Nsamba-common-bin

override_dh_fixperms:
	dh_fixperms
ifneq (,$(filter samba-common, $(shell dh_listpackages)))
	chmod a+x debian/samba-common/usr/share/samba/panic-action
	# Set some reasonable default perms for the samba logdir.
	chmod 0750 debian/samba-common/var/log/samba/
	chown root:adm debian/samba-common/var/log/samba/
endif
ifneq (,$(filter samba, $(shell dh_listpackages)))
	chmod 1777 debian/samba/var/spool/samba/
endif

override_dh_makeshlibs:
	dh_makeshlibs -plibsmbclient -V'libsmbclient (>= 2:3.2.0)'
	dh_makeshlibs -plibwbclient0 -V'libwbclient0 (>= 2:3.5.0~pre2)'