diff options
Diffstat (limited to 'debian/rules')
-rwxr-xr-x | debian/rules | 230 |
1 files changed, 230 insertions, 0 deletions
diff --git a/debian/rules b/debian/rules new file mode 100755 index 000000000..550306d4f --- /dev/null +++ b/debian/rules | |||
@@ -0,0 +1,230 @@ | |||
1 | #!/usr/bin/make -f | ||
2 | |||
3 | export DEB_BUILD_MAINT_OPTIONS := hardening=+all | ||
4 | |||
5 | include /usr/share/dpkg/default.mk | ||
6 | |||
7 | # Uncomment this to turn on verbose mode. | ||
8 | # export DH_VERBOSE=1 | ||
9 | |||
10 | # This has to be exported to make some magic below work. | ||
11 | export DH_OPTIONS | ||
12 | |||
13 | ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) | ||
14 | RUN_TESTS := yes | ||
15 | else | ||
16 | RUN_TESTS := | ||
17 | endif | ||
18 | |||
19 | ifeq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) | ||
20 | PARALLEL := | ||
21 | else | ||
22 | PARALLEL := \ | ||
23 | -j$(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) | ||
24 | endif | ||
25 | |||
26 | ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE)) | ||
27 | CC := gcc | ||
28 | PKG_CONFIG = pkg-config | ||
29 | else | ||
30 | CC := $(DEB_HOST_GNU_TYPE)-gcc | ||
31 | PKG_CONFIG = $(DEB_HOST_GNU_TYPE)-pkg-config | ||
32 | RUN_TESTS := | ||
33 | endif | ||
34 | |||
35 | # Change the version string to reflect distribution | ||
36 | SSH_EXTRAVERSION := $(DEB_VENDOR)-$(shell echo '$(DEB_VERSION)' | sed -e 's/.*-//') | ||
37 | |||
38 | UBUNTU := $(shell $(call dpkg_vendor_derives_from,Ubuntu)) | ||
39 | ifeq ($(UBUNTU),yes) | ||
40 | DEFAULT_PATH := /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games | ||
41 | else | ||
42 | DEFAULT_PATH := /usr/local/bin:/usr/bin:/bin:/usr/games | ||
43 | endif | ||
44 | SUPERUSER_PATH := /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin | ||
45 | |||
46 | ifeq ($(UBUNTU),yes) | ||
47 | server_recommends := ssh-import-id | ||
48 | else | ||
49 | server_recommends := | ||
50 | endif | ||
51 | |||
52 | # Common path configuration. | ||
53 | confflags += --sysconfdir=/etc/ssh | ||
54 | confflags += --libexecdir=\$${prefix}/lib/openssh | ||
55 | |||
56 | # Common build options. | ||
57 | confflags += --disable-strip | ||
58 | confflags += --with-mantype=doc | ||
59 | confflags += --with-4in6 | ||
60 | confflags += --with-privsep-path=/run/sshd | ||
61 | confflags += --with-pid-dir=/run | ||
62 | |||
63 | # The Hurd needs libcrypt for res_query et al. | ||
64 | ifeq ($(DEB_HOST_ARCH_OS),hurd) | ||
65 | confflags += --with-libs=-lcrypt | ||
66 | endif | ||
67 | |||
68 | # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60155 | ||
69 | ifeq ($(DEB_HOST_ARCH),hppa) | ||
70 | confflags += --without-hardening | ||
71 | endif | ||
72 | |||
73 | # Everything above here is common to the deb and udeb builds. | ||
74 | confflags_udeb := $(confflags) | ||
75 | |||
76 | # Options specific to the deb build. | ||
77 | confflags += --with-tcp-wrappers | ||
78 | confflags += --with-pam | ||
79 | confflags += --with-libedit | ||
80 | confflags += --with-kerberos5=/usr | ||
81 | confflags += --with-ssl-engine | ||
82 | ifeq ($(DEB_HOST_ARCH_OS),linux) | ||
83 | confflags += --with-selinux | ||
84 | confflags += --with-audit=linux | ||
85 | confflags += --with-systemd | ||
86 | endif | ||
87 | |||
88 | # The deb build wants xauth; the udeb build doesn't. | ||
89 | confflags += --with-xauth=/usr/bin/xauth | ||
90 | confflags_udeb += --without-xauth | ||
91 | |||
92 | # Default paths. The udeb build has /usr/games removed. | ||
93 | confflags += --with-default-path=$(DEFAULT_PATH) --with-superuser-path=$(SUPERUSER_PATH) | ||
94 | 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 | ||
95 | |||
96 | # Compiler flags. | ||
97 | cflags := $(CPPFLAGS) $(CFLAGS) | ||
98 | cflags += -DSSH_EXTRAVERSION=\"$(SSH_EXTRAVERSION)\" | ||
99 | cflags_udeb := -Os | ||
100 | cflags_udeb += -DSSH_EXTRAVERSION=\"$(SSH_EXTRAVERSION)\" | ||
101 | confflags += --with-cflags='$(cflags)' | ||
102 | confflags_udeb += --with-cflags='$(cflags_udeb)' | ||
103 | |||
104 | # Linker flags. | ||
105 | confflags += --with-ldflags='$(strip -Wl,--as-needed $(LDFLAGS))' | ||
106 | confflags_udeb += --with-ldflags='-Wl,--as-needed' | ||
107 | |||
108 | %: | ||
109 | dh $@ --with=autoreconf,systemd | ||
110 | |||
111 | autoreconf: | ||
112 | autoreconf -f -i | ||
113 | cp -f /usr/share/misc/config.guess /usr/share/misc/config.sub ./ | ||
114 | |||
115 | override_dh_autoreconf-arch: | ||
116 | dh_autoreconf debian/rules -- autoreconf | ||
117 | |||
118 | override_dh_autoreconf-indep: | ||
119 | |||
120 | override_dh_auto_configure-arch: | ||
121 | dh_auto_configure -Bdebian/build-deb -- $(confflags) | ||
122 | ifeq ($(filter noudeb,$(DEB_BUILD_PROFILES)),) | ||
123 | dh_auto_configure -Bdebian/build-udeb -- $(confflags_udeb) | ||
124 | # Avoid libnsl linkage. Ugh. | ||
125 | perl -pi -e 's/ +-lnsl//' debian/build-udeb/config.status | ||
126 | cd debian/build-udeb && ./config.status | ||
127 | endif | ||
128 | |||
129 | override_dh_auto_configure-indep: | ||
130 | |||
131 | override_dh_auto_build-arch: | ||
132 | $(MAKE) -C debian/build-deb $(PARALLEL) ASKPASS_PROGRAM='/usr/bin/ssh-askpass' | ||
133 | $(MAKE) -C debian/build-deb regress-prep | ||
134 | $(MAKE) -C debian/build-deb $(PARALLEL) regress-binaries | ||
135 | ifeq ($(filter noudeb,$(DEB_BUILD_PROFILES)),) | ||
136 | $(MAKE) -C debian/build-udeb $(PARALLEL) ASKPASS_PROGRAM='/usr/bin/ssh-askpass' ssh scp sftp sshd ssh-keygen | ||
137 | endif | ||
138 | |||
139 | ifeq ($(filter pkg.openssh.nognome,$(DEB_BUILD_PROFILES)),) | ||
140 | $(MAKE) -C contrib gnome-ssh-askpass3 CC='$(CC) $(CPPFLAGS) $(CFLAGS) -Wall -Wl,--as-needed $(LDFLAGS)' PKG_CONFIG=$(PKG_CONFIG) | ||
141 | endif | ||
142 | |||
143 | override_dh_auto_build-indep: | ||
144 | |||
145 | override_dh_auto_test-arch: | ||
146 | ifeq ($(RUN_TESTS),yes) | ||
147 | $(MAKE) -C debian/build-deb/regress \ | ||
148 | .OBJDIR="$(CURDIR)/debian/build-deb/regress" \ | ||
149 | .CURDIR="$(CURDIR)/regress" \ | ||
150 | unit | ||
151 | $(MAKE) -C debian/build-deb compat-tests | ||
152 | $(MAKE) -C debian/keygen-test | ||
153 | endif | ||
154 | |||
155 | override_dh_auto_test-indep: | ||
156 | |||
157 | override_dh_auto_clean: | ||
158 | rm -rf debian/build-deb debian/build-udeb | ||
159 | ifeq ($(RUN_TESTS),yes) | ||
160 | $(MAKE) -C debian/keygen-test clean | ||
161 | endif | ||
162 | $(MAKE) -C contrib clean | ||
163 | |||
164 | override_dh_auto_install-arch: | ||
165 | $(MAKE) -C debian/build-deb DESTDIR=`pwd`/debian/tmp install-nokeys | ||
166 | |||
167 | override_dh_auto_install-indep: | ||
168 | |||
169 | override_dh_install-arch: | ||
170 | rm -f debian/tmp/etc/ssh/sshd_config | ||
171 | |||
172 | dh_install -Nopenssh-client-udeb -Nopenssh-server-udeb --fail-missing | ||
173 | ifeq ($(filter noudeb,$(DEB_BUILD_PROFILES)),) | ||
174 | dh_install -popenssh-client-udeb -popenssh-server-udeb \ | ||
175 | --sourcedir=debian/build-udeb | ||
176 | endif | ||
177 | |||
178 | # Remove version control tags to avoid unnecessary conffile | ||
179 | # resolution steps for administrators. | ||
180 | sed -i '/\$$OpenBSD:/d' \ | ||
181 | debian/openssh-server/etc/ssh/moduli \ | ||
182 | debian/openssh-client/etc/ssh/ssh_config | ||
183 | |||
184 | # We'd like to use dh_install --fail-missing here, but that doesn't work | ||
185 | # well in combination with dh-exec: it complains that files generated by | ||
186 | # dh-exec for architecture-dependent packages aren't installed. | ||
187 | override_dh_install-indep: | ||
188 | rm -f debian/tmp/etc/ssh/sshd_config | ||
189 | dh_install | ||
190 | |||
191 | override_dh_installdocs: | ||
192 | dh_installdocs -Nopenssh-server -Nopenssh-sftp-server | ||
193 | dh_installdocs -popenssh-server -popenssh-sftp-server \ | ||
194 | --link-doc=openssh-client | ||
195 | # Avoid breaking dh_installexamples later. | ||
196 | mkdir -p debian/openssh-server/usr/share/doc/openssh-client | ||
197 | |||
198 | override_dh_systemd_enable: | ||
199 | dh_systemd_enable -popenssh-server --name ssh ssh.service | ||
200 | dh_systemd_enable -popenssh-server --name ssh --no-enable ssh.socket | ||
201 | |||
202 | override_dh_installinit: | ||
203 | dh_installinit -R --name ssh | ||
204 | |||
205 | debian/openssh-server.sshd.pam: debian/openssh-server.sshd.pam.in | ||
206 | ifeq ($(DEB_HOST_ARCH_OS),linux) | ||
207 | sed 's/^@IF_KEYINIT@//' $< > $@ | ||
208 | else | ||
209 | sed '/^@IF_KEYINIT@/d' $< > $@ | ||
210 | endif | ||
211 | |||
212 | override_dh_installpam: debian/openssh-server.sshd.pam | ||
213 | dh_installpam --name sshd | ||
214 | |||
215 | override_dh_fixperms-arch: | ||
216 | dh_fixperms | ||
217 | chmod u+s debian/openssh-client/usr/lib/openssh/ssh-keysign | ||
218 | |||
219 | # Tighten libssl dependencies to match the check in entropy.c. | ||
220 | override_dh_shlibdeps: | ||
221 | dh_shlibdeps | ||
222 | debian/adjust-openssl-dependencies | ||
223 | |||
224 | override_dh_gencontrol: | ||
225 | dh_gencontrol -- -V'openssh-server:Recommends=$(server_recommends)' | ||
226 | |||
227 | debian/faq.html: | ||
228 | wget -O - http://www.openssh.com/faq.html | \ | ||
229 | sed 's,\(href="\)\(txt/\|[^":]*\.html\),\1http://www.openssh.com/\2,g' \ | ||
230 | > debian/faq.html | ||