File: rules

package info (click to toggle)
openssh 1:7.9p1-10
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 14,136 kB
  • sloc: ansic: 101,922; sh: 11,876; makefile: 1,338; awk: 341; cpp: 82; python: 37; csh: 1
file content (230 lines) | stat: -rwxr-xr-x 6,823 bytes parent folder | download | duplicates (2)
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
#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS := hardening=+all

include /usr/share/dpkg/default.mk

# Uncomment this to turn on verbose mode.
# export DH_VERBOSE=1

# This has to be exported to make some magic below work.
export DH_OPTIONS

ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
  RUN_TESTS := yes
else
  RUN_TESTS :=
endif

ifeq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
  PARALLEL :=
else
  PARALLEL := \
	-j$(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
endif

ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
  CC := gcc
  PKG_CONFIG = pkg-config
else
  CC := $(DEB_HOST_GNU_TYPE)-gcc
  PKG_CONFIG = $(DEB_HOST_GNU_TYPE)-pkg-config
  RUN_TESTS :=
endif

# Change the version string to reflect distribution
SSH_EXTRAVERSION := $(DEB_VENDOR)-$(shell echo '$(DEB_VERSION)' | sed -e 's/.*-//')

UBUNTU := $(shell $(call dpkg_vendor_derives_from,Ubuntu))
ifeq ($(UBUNTU),yes)
DEFAULT_PATH := /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
else
DEFAULT_PATH := /usr/local/bin:/usr/bin:/bin:/usr/games
endif
SUPERUSER_PATH := /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

ifeq ($(UBUNTU),yes)
server_recommends := ssh-import-id
else
server_recommends :=
endif

# Common path configuration.
confflags += --sysconfdir=/etc/ssh
confflags += --libexecdir=\$${prefix}/lib/openssh

# Common build options.
confflags += --disable-strip
confflags += --with-mantype=doc
confflags += --with-4in6
confflags += --with-privsep-path=/run/sshd
confflags += --with-pid-dir=/run

# The Hurd needs libcrypt for res_query et al.
ifeq ($(DEB_HOST_ARCH_OS),hurd)
confflags += --with-libs=-lcrypt
endif

# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60155
ifeq ($(DEB_HOST_ARCH),hppa)
confflags += --without-hardening
endif

# Everything above here is common to the deb and udeb builds.
confflags_udeb := $(confflags)

# Options specific to the deb build.
confflags += --with-tcp-wrappers
confflags += --with-pam
confflags += --with-libedit
confflags += --with-kerberos5=/usr
confflags += --with-ssl-engine
ifeq ($(DEB_HOST_ARCH_OS),linux)
confflags += --with-selinux
confflags += --with-audit=linux
confflags += --with-systemd
endif

# The deb build wants xauth; the udeb build doesn't.
confflags += --with-xauth=/usr/bin/xauth
confflags_udeb += --without-xauth

# Default paths. The udeb build has /usr/games removed.
confflags += --with-default-path=$(DEFAULT_PATH) --with-superuser-path=$(SUPERUSER_PATH)
confflags_udeb += --with-default-path=/usr/local/bin:/usr/bin:/bin --with-superuser-path=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

# Compiler flags.
cflags := $(CPPFLAGS) $(CFLAGS)
cflags += -DSSH_EXTRAVERSION=\"$(SSH_EXTRAVERSION)\"
cflags_udeb := -Os
cflags_udeb += -DSSH_EXTRAVERSION=\"$(SSH_EXTRAVERSION)\"
confflags += --with-cflags='$(cflags)'
confflags_udeb += --with-cflags='$(cflags_udeb)'

# Linker flags.
confflags += --with-ldflags='$(strip -Wl,--as-needed $(LDFLAGS))'
confflags_udeb += --with-ldflags='-Wl,--as-needed'

%:
	dh $@ --with=autoreconf,systemd

autoreconf:
	autoreconf -f -i
	cp -f /usr/share/misc/config.guess /usr/share/misc/config.sub ./

override_dh_autoreconf-arch:
	dh_autoreconf debian/rules -- autoreconf

override_dh_autoreconf-indep:

override_dh_auto_configure-arch:
	dh_auto_configure -Bdebian/build-deb -- $(confflags)
ifeq ($(filter noudeb,$(DEB_BUILD_PROFILES)),)
	dh_auto_configure -Bdebian/build-udeb -- $(confflags_udeb)
	# Avoid libnsl linkage. Ugh.
	perl -pi -e 's/ +-lnsl//' debian/build-udeb/config.status
	cd debian/build-udeb && ./config.status
endif

override_dh_auto_configure-indep:

override_dh_auto_build-arch:
	$(MAKE) -C debian/build-deb $(PARALLEL) ASKPASS_PROGRAM='/usr/bin/ssh-askpass'
	$(MAKE) -C debian/build-deb regress-prep
	$(MAKE) -C debian/build-deb $(PARALLEL) regress-binaries
ifeq ($(filter noudeb,$(DEB_BUILD_PROFILES)),)
	$(MAKE) -C debian/build-udeb $(PARALLEL) ASKPASS_PROGRAM='/usr/bin/ssh-askpass' ssh scp sftp sshd ssh-keygen
endif

ifeq ($(filter pkg.openssh.nognome,$(DEB_BUILD_PROFILES)),)
	$(MAKE) -C contrib gnome-ssh-askpass3 CC='$(CC) $(CPPFLAGS) $(CFLAGS) -Wall -Wl,--as-needed $(LDFLAGS)' PKG_CONFIG=$(PKG_CONFIG)
endif

override_dh_auto_build-indep:

override_dh_auto_test-arch:
ifeq ($(RUN_TESTS),yes)
	$(MAKE) -C debian/build-deb/regress \
		.OBJDIR="$(CURDIR)/debian/build-deb/regress" \
		.CURDIR="$(CURDIR)/regress" \
		unit
	$(MAKE) -C debian/build-deb compat-tests
	$(MAKE) -C debian/keygen-test
endif

override_dh_auto_test-indep:

override_dh_auto_clean:
	rm -rf debian/build-deb debian/build-udeb
ifeq ($(RUN_TESTS),yes)
	$(MAKE) -C debian/keygen-test clean
endif
	$(MAKE) -C contrib clean

override_dh_auto_install-arch:
	$(MAKE) -C debian/build-deb DESTDIR=`pwd`/debian/tmp install-nokeys

override_dh_auto_install-indep:

override_dh_install-arch:
	rm -f debian/tmp/etc/ssh/sshd_config

	dh_install -Nopenssh-client-udeb -Nopenssh-server-udeb --fail-missing
ifeq ($(filter noudeb,$(DEB_BUILD_PROFILES)),)
	dh_install -popenssh-client-udeb -popenssh-server-udeb \
		--sourcedir=debian/build-udeb
endif

	# Remove version control tags to avoid unnecessary conffile
	# resolution steps for administrators.
	sed -i '/\$$OpenBSD:/d' \
		debian/openssh-server/etc/ssh/moduli \
		debian/openssh-client/etc/ssh/ssh_config

# We'd like to use dh_install --fail-missing here, but that doesn't work
# well in combination with dh-exec: it complains that files generated by
# dh-exec for architecture-dependent packages aren't installed.
override_dh_install-indep:
	rm -f debian/tmp/etc/ssh/sshd_config
	dh_install

override_dh_installdocs:
	dh_installdocs -Nopenssh-server -Nopenssh-sftp-server
	dh_installdocs -popenssh-server -popenssh-sftp-server \
		--link-doc=openssh-client
	# Avoid breaking dh_installexamples later.
	mkdir -p debian/openssh-server/usr/share/doc/openssh-client

override_dh_systemd_enable:
	dh_systemd_enable -popenssh-server --name ssh ssh.service
	dh_systemd_enable -popenssh-server --name ssh --no-enable ssh.socket

override_dh_installinit:
	dh_installinit -R --name ssh

debian/openssh-server.sshd.pam: debian/openssh-server.sshd.pam.in
ifeq ($(DEB_HOST_ARCH_OS),linux)
	sed 's/^@IF_KEYINIT@//' $< > $@
else
	sed '/^@IF_KEYINIT@/d' $< > $@
endif

override_dh_installpam: debian/openssh-server.sshd.pam
	dh_installpam --name sshd

override_dh_fixperms-arch:
	dh_fixperms
	chmod u+s debian/openssh-client/usr/lib/openssh/ssh-keysign

# Tighten libssl dependencies to match the check in entropy.c.
override_dh_shlibdeps:
	dh_shlibdeps
	debian/adjust-openssl-dependencies

override_dh_gencontrol:
	dh_gencontrol -- -V'openssh-server:Recommends=$(server_recommends)'

debian/faq.html:
	wget -O - http://www.openssh.com/faq.html | \
		sed 's,\(href="\)\(txt/\|[^":]*\.html\),\1http://www.openssh.com/\2,g' \
		> debian/faq.html