diff options
Diffstat (limited to 'debian/rules')
-rwxr-xr-x | debian/rules | 348 |
1 files changed, 348 insertions, 0 deletions
diff --git a/debian/rules b/debian/rules new file mode 100755 index 000000000..0c48082b5 --- /dev/null +++ b/debian/rules | |||
@@ -0,0 +1,348 @@ | |||
1 | #!/usr/bin/make -f | ||
2 | |||
3 | # Uncomment this to turn on verbose mode. | ||
4 | # export DH_VERBOSE=1 | ||
5 | |||
6 | # This has to be exported to make some magic below work. | ||
7 | export DH_OPTIONS | ||
8 | |||
9 | ifeq (,$(filter noopt,$(DEB_BUILD_OPTIONS))) | ||
10 | OPTFLAGS := -O2 | ||
11 | else | ||
12 | OPTFLAGS := -O0 | ||
13 | endif | ||
14 | |||
15 | DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) | ||
16 | DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) | ||
17 | |||
18 | ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE)) | ||
19 | confflags += --build=$(DEB_HOST_GNU_TYPE) | ||
20 | else | ||
21 | confflags += --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE) | ||
22 | endif | ||
23 | |||
24 | DEB_HOST_ARCH_OS := $(shell dpkg-architecture -qDEB_HOST_ARCH_OS 2>/dev/null) | ||
25 | DEB_HOST_ARCH_CPU := $(shell dpkg-architecture -qDEB_HOST_ARCH_CPU 2>/dev/null) | ||
26 | |||
27 | # Take account of old dpkg-architecture output. | ||
28 | ifeq ($(DEB_HOST_ARCH_OS),) | ||
29 | DEB_HOST_ARCH_OS := $(subst -gnu,,$(shell dpkg-architecture -qDEB_HOST_GNU_SYSTEM)) | ||
30 | ifeq ($(DEB_HOST_ARCH_OS),gnu) | ||
31 | DEB_HOST_ARCH_OS := hurd | ||
32 | endif | ||
33 | endif | ||
34 | ifeq ($(DEB_HOST_ARCH_CPU),) | ||
35 | DEB_HOST_ARCH_CPU := $(shell dpkg-architecture -qDEB_HOST_GNU_CPU) | ||
36 | ifeq ($(DEB_HOST_ARCH_CPU),x86_64) | ||
37 | DEB_HOST_ARCH_CPU := amd64 | ||
38 | endif | ||
39 | endif | ||
40 | |||
41 | ifneq (,$(findstring :$(DEB_HOST_ARCH_OS):,:linux:knetbsd:)) | ||
42 | ifeq (,$(findstring :$(DEB_HOST_ARCH_CPU):,:hppa:m68k:)) | ||
43 | # Use position-independent executables to take advantage of address space | ||
44 | # layout randomisation. TODO: This should be done in configure. | ||
45 | PIE_CFLAGS := -fPIE | ||
46 | PIE_LDFLAGS := -fPIE -pie | ||
47 | endif | ||
48 | endif | ||
49 | |||
50 | # Change the version string to include the Debian version | ||
51 | SSH_EXTRAVERSION := Debian-$(shell dpkg-parsechangelog | sed -n -e '/^Version:/s/Version: //p' | sed -e 's/[^-]*-//') | ||
52 | |||
53 | DISTRIBUTOR := $(shell lsb_release -is 2>/dev/null || echo Debian) | ||
54 | ifeq ($(DISTRIBUTOR),Ubuntu) | ||
55 | DEFAULT_PATH := /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11:/usr/games | ||
56 | else | ||
57 | DEFAULT_PATH := /usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games | ||
58 | endif | ||
59 | SUPERUSER_PATH := /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11 | ||
60 | |||
61 | # Common path configuration. | ||
62 | confflags += --prefix=/usr --sysconfdir=/etc/ssh --libexecdir=/usr/lib/openssh --mandir=/usr/share/man | ||
63 | |||
64 | # Common build options. | ||
65 | confflags += --with-mantype=doc | ||
66 | confflags += --with-4in6 | ||
67 | confflags += --with-privsep-path=/var/run/sshd | ||
68 | confflags += --without-rand-helper | ||
69 | |||
70 | # The Hurd needs libcrypt for res_query et al. | ||
71 | ifeq ($(DEB_HOST_ARCH_OS),hurd) | ||
72 | confflags += --with-libs=-lcrypt | ||
73 | endif | ||
74 | |||
75 | # Everything above here is common to the deb and udeb builds. | ||
76 | confflags_udeb := $(confflags) | ||
77 | |||
78 | # Options specific to the deb build. | ||
79 | confflags += --with-tcp-wrappers | ||
80 | confflags += --with-pam | ||
81 | confflags += --with-libedit | ||
82 | confflags += --with-kerberos5=/usr | ||
83 | confflags += --with-ssl-engine | ||
84 | ifeq ($(DEB_HOST_ARCH_OS),linux) | ||
85 | confflags += --with-selinux | ||
86 | endif | ||
87 | |||
88 | # The deb build wants xauth; the udeb build doesn't. | ||
89 | confflags += --with-xauth=/usr/bin/X11/xauth | ||
90 | confflags_udeb += --without-xauth | ||
91 | |||
92 | # Default paths. The udeb build has /usr/bin/X11 and /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 := $(OPTFLAGS) $(PIE_CFLAGS) | ||
98 | cflags += -DLOGIN_PROGRAM=\"/bin/login\" -DLOGIN_NO_ENDOPT | ||
99 | cflags += -DSSH_EXTRAVERSION=\"$(SSH_EXTRAVERSION)\" | ||
100 | cflags_udeb := -Os | ||
101 | cflags_udeb += -DSSH_EXTRAVERSION=\"$(SSH_EXTRAVERSION)\" | ||
102 | confflags += --with-cflags='$(cflags)' | ||
103 | confflags_udeb += --with-cflags='$(cflags_udeb)' | ||
104 | |||
105 | # Linker flags. | ||
106 | ifneq ($(PIE_LDFLAGS),) | ||
107 | confflags += --with-ldflags='$(PIE_LDFLAGS)' | ||
108 | endif | ||
109 | |||
110 | build: build-deb build-udeb | ||
111 | |||
112 | build-deb: build-deb-stamp | ||
113 | build-deb-stamp: | ||
114 | dh_testdir | ||
115 | mkdir -p build-deb | ||
116 | cd build-deb && ../configure $(confflags) | ||
117 | |||
118 | ifeq ($(DEB_HOST_ARCH_OS),linux) | ||
119 | # Some 2.2 kernels have trouble with setres[ug]id() (bug #239999). | ||
120 | perl -pi -e 's/.*#undef (BROKEN_SETRES[UG]ID).*/#define $$1 1/' build-deb/config.h | ||
121 | endif | ||
122 | # Debian's /var/log/btmp has inappropriate permissions. | ||
123 | perl -pi -e 's,.*#define USE_BTMP .*,/* #undef USE_BTMP */,' build-deb/config.h | ||
124 | |||
125 | $(MAKE) -C build-deb -j 2 ASKPASS_PROGRAM='/usr/bin/ssh-askpass' | ||
126 | $(MAKE) -C contrib gnome-ssh-askpass2 CC='gcc $(OPTFLAGS) -g -Wall' | ||
127 | $(MAKE) -C debian/tests | ||
128 | |||
129 | touch build-deb-stamp | ||
130 | |||
131 | build-udeb: build-udeb-stamp | ||
132 | build-udeb-stamp: | ||
133 | dh_testdir | ||
134 | mkdir -p build-udeb | ||
135 | cd build-udeb && ../configure $(confflags_udeb) | ||
136 | # Debian's /var/log/btmp has inappropriate permissions. | ||
137 | perl -pi -e 's,.*#define USE_BTMP .*,/* #undef USE_BTMP */,' build-udeb/config.h | ||
138 | # Avoid libnsl linkage. Ugh. | ||
139 | perl -pi -e 's/ +-lnsl//' build-udeb/config.status | ||
140 | cd build-udeb && ./config.status | ||
141 | $(MAKE) -C build-udeb -j 2 ASKPASS_PROGRAM='/usr/bin/ssh-askpass' ssh scp sftp sshd ssh-keygen | ||
142 | touch build-udeb-stamp | ||
143 | |||
144 | clean: | ||
145 | dh_testdir | ||
146 | rm -f build-deb-stamp build-udeb-stamp | ||
147 | rm -rf build-deb build-udeb | ||
148 | $(MAKE) -C debian/tests clean | ||
149 | $(MAKE) -C contrib clean | ||
150 | rm -f config.log | ||
151 | rm -f debian/ssh-askpass-gnome.png | ||
152 | (cat debian/copyright.head; iconv -f ISO-8859-1 -t UTF-8 LICENCE) \ | ||
153 | > debian/copyright | ||
154 | dh_clean | ||
155 | |||
156 | install: DH_OPTIONS=-a | ||
157 | install: build | ||
158 | dh_testdir | ||
159 | dh_testroot | ||
160 | dh_clean -k | ||
161 | dh_installdirs | ||
162 | |||
163 | $(MAKE) -C build-deb DESTDIR=`pwd`/debian/openssh-client install-nokeys | ||
164 | |||
165 | rm -f debian/openssh-client/etc/ssh/sshd_config | ||
166 | #Temporary hack: remove /usr/share/Ssh.bin, since we have no smartcard support anyway. | ||
167 | rm -f debian/openssh-client/usr/share/Ssh.bin | ||
168 | |||
169 | # Split off the server. | ||
170 | mv debian/openssh-client/usr/sbin/sshd debian/openssh-server/usr/sbin/ | ||
171 | mv debian/openssh-client/usr/lib/openssh/sftp-server debian/openssh-server/usr/lib/openssh/ | ||
172 | mv debian/openssh-client/usr/share/man/man5/authorized_keys.5 debian/openssh-server/usr/share/man/man5/ | ||
173 | mv debian/openssh-client/usr/share/man/man5/sshd_config.5 debian/openssh-server/usr/share/man/man5/ | ||
174 | mv debian/openssh-client/usr/share/man/man8/sshd.8 debian/openssh-server/usr/share/man/man8/ | ||
175 | mv debian/openssh-client/usr/share/man/man8/sftp-server.8 debian/openssh-server/usr/share/man/man8/ | ||
176 | rmdir debian/openssh-client/usr/sbin debian/openssh-client/var/run/sshd | ||
177 | |||
178 | install -m 755 contrib/ssh-copy-id debian/openssh-client/usr/bin/ssh-copy-id | ||
179 | install -m 644 -c contrib/ssh-copy-id.1 debian/openssh-client/usr/share/man/man1/ssh-copy-id.1 | ||
180 | install -m 644 debian/moduli.5 debian/openssh-client/usr/share/man/man5/moduli.5 | ||
181 | |||
182 | install -s -o root -g root -m 755 contrib/gnome-ssh-askpass2 debian/ssh-askpass-gnome/usr/lib/openssh/gnome-ssh-askpass | ||
183 | install -m 644 debian/gnome-ssh-askpass.1 debian/ssh-askpass-gnome/usr/share/man/man1/gnome-ssh-askpass.1 | ||
184 | uudecode -o debian/ssh-askpass-gnome/usr/share/pixmaps/ssh-askpass-gnome.png debian/ssh-askpass-gnome.png.uue | ||
185 | |||
186 | install -m 755 debian/ssh-argv0 debian/openssh-client/usr/bin/ssh-argv0 | ||
187 | install -m 644 debian/ssh-argv0.1 debian/openssh-client/usr/share/man/man1/ssh-argv0.1 | ||
188 | |||
189 | install -o root -g root debian/openssh-server.init debian/openssh-server/etc/init.d/ssh | ||
190 | install -o root -g root -m 644 debian/openssh-server.default debian/openssh-server/etc/default/ssh | ||
191 | install -o root -g root debian/openssh-server.if-up debian/openssh-server/etc/network/if-up.d/openssh-server | ||
192 | |||
193 | install -m 755 build-udeb/ssh debian/openssh-client-udeb/usr/bin/ssh | ||
194 | install -m 755 build-udeb/scp debian/openssh-client-udeb/usr/bin/scp | ||
195 | install -m 755 build-udeb/sftp debian/openssh-client-udeb/usr/bin/sftp | ||
196 | install -m 755 build-udeb/sshd debian/openssh-server-udeb/usr/sbin/sshd | ||
197 | install -m 755 build-udeb/ssh-keygen debian/openssh-server-udeb/usr/bin/ssh-keygen | ||
198 | |||
199 | # Remove version control tags to avoid unnecessary conffile | ||
200 | # resolution steps for administrators. | ||
201 | sed -i '/\$$OpenBSD:/d' \ | ||
202 | debian/openssh-client/etc/ssh/moduli \ | ||
203 | debian/openssh-client/etc/ssh/ssh_config | ||
204 | |||
205 | # Build architecture-independent files here. | ||
206 | binary-indep: binary-ssh binary-ssh-krb5 | ||
207 | |||
208 | # Build architecture-dependent files here. | ||
209 | binary-arch: binary-openssh-client binary-openssh-server | ||
210 | binary-arch: binary-ssh-askpass-gnome | ||
211 | binary-arch: binary-openssh-client-udeb binary-openssh-server-udeb | ||
212 | |||
213 | binary-openssh-client: DH_OPTIONS=-popenssh-client | ||
214 | binary-openssh-client: build install | ||
215 | dh_testdir | ||
216 | dh_testroot | ||
217 | dh_installdebconf | ||
218 | dh_installdocs OVERVIEW README README.dns README.tun debian/faq.html debian/README.compromised-keys | ||
219 | dh_installchangelogs ChangeLog ChangeLog.gssapi | ||
220 | install -m644 debian/openssh-client.lintian debian/openssh-client/usr/share/lintian/overrides/openssh-client | ||
221 | dh_strip | ||
222 | dh_compress | ||
223 | dh_fixperms | ||
224 | chmod u+s debian/openssh-client/usr/lib/openssh/ssh-keysign | ||
225 | dh_installdeb | ||
226 | test ! -e debian/ssh/etc/ssh/ssh_prng_cmds \ | ||
227 | || echo "/etc/ssh/ssh_prng_cmds" >> debian/openssh-client/DEBIAN/conffiles | ||
228 | perl -i debian/substitute-conffile.pl \ | ||
229 | ETC_SSH_MODULI debian/openssh-client/etc/ssh/moduli \ | ||
230 | ETC_SSH_SSH_CONFIG debian/openssh-client/etc/ssh/ssh_config \ | ||
231 | debian/openssh-client/DEBIAN/preinst | ||
232 | dh_shlibdeps | ||
233 | dh_gencontrol | ||
234 | dh_md5sums | ||
235 | dh_builddeb | ||
236 | |||
237 | binary-openssh-server: DH_OPTIONS=-popenssh-server | ||
238 | binary-openssh-server: build install | ||
239 | dh_testdir | ||
240 | dh_testroot | ||
241 | dh_installdebconf | ||
242 | dh_installdocs | ||
243 | mv debian/openssh-server/usr/share/doc/openssh-server debian/openssh-server/usr/share/doc/openssh-client | ||
244 | rm -f debian/openssh-server/usr/share/doc/openssh-client/copyright | ||
245 | dh_installpam --name sshd | ||
246 | dh_link | ||
247 | dh_strip | ||
248 | dh_compress | ||
249 | dh_fixperms | ||
250 | dh_installdeb | ||
251 | perl -i debian/substitute-conffile.pl \ | ||
252 | ETC_DEFAULT_SSH debian/openssh-server/etc/default/ssh \ | ||
253 | ETC_INIT_D_SSH debian/openssh-server/etc/init.d/ssh \ | ||
254 | ETC_PAM_D_SSH debian/openssh-server/etc/pam.d/ssh \ | ||
255 | debian/openssh-server/DEBIAN/preinst | ||
256 | dh_shlibdeps | ||
257 | dh_gencontrol | ||
258 | dh_md5sums | ||
259 | dh_builddeb | ||
260 | |||
261 | binary-ssh: DH_OPTIONS=-pssh | ||
262 | binary-ssh: build install | ||
263 | dh_testdir | ||
264 | dh_testroot | ||
265 | dh_installdocs | ||
266 | mv debian/ssh/usr/share/doc/ssh debian/ssh/usr/share/doc/openssh-client | ||
267 | rm -f debian/ssh/usr/share/doc/openssh-client/copyright | ||
268 | dh_link | ||
269 | dh_compress | ||
270 | dh_fixperms | ||
271 | dh_installdeb | ||
272 | dh_gencontrol | ||
273 | dh_md5sums | ||
274 | dh_builddeb | ||
275 | |||
276 | binary-ssh-krb5: DH_OPTIONS=-pssh-krb5 | ||
277 | binary-ssh-krb5: build install | ||
278 | dh_testdir | ||
279 | dh_testroot | ||
280 | dh_installdocs | ||
281 | dh_installchangelogs ChangeLog ChangeLog.gssapi | ||
282 | dh_link | ||
283 | dh_compress | ||
284 | dh_fixperms | ||
285 | dh_installdeb | ||
286 | dh_gencontrol | ||
287 | dh_md5sums | ||
288 | dh_builddeb | ||
289 | |||
290 | binary-ssh-askpass-gnome: DH_OPTIONS=-pssh-askpass-gnome | ||
291 | binary-ssh-askpass-gnome: build install | ||
292 | dh_testdir | ||
293 | dh_testroot | ||
294 | dh_installdocs | ||
295 | dh_installexamples debian/ssh-askpass-gnome.desktop | ||
296 | dh_installchangelogs ChangeLog ChangeLog.gssapi | ||
297 | dh_strip | ||
298 | dh_compress | ||
299 | dh_fixperms | ||
300 | dh_installdeb | ||
301 | dh_shlibdeps | ||
302 | dh_gencontrol | ||
303 | dh_md5sums | ||
304 | dh_builddeb | ||
305 | |||
306 | binary-openssh-client-udeb: DH_OPTIONS=-popenssh-client-udeb | ||
307 | binary-openssh-client-udeb: build install | ||
308 | dh_testdir | ||
309 | dh_testroot | ||
310 | dh_strip | ||
311 | dh_compress | ||
312 | dh_fixperms | ||
313 | dh_installdeb | ||
314 | dh_shlibdeps | ||
315 | dh_gencontrol | ||
316 | dh_md5sums | ||
317 | dh_builddeb | ||
318 | |||
319 | binary-openssh-server-udeb: DH_OPTIONS=-popenssh-server-udeb | ||
320 | binary-openssh-server-udeb: build install | ||
321 | dh_testdir | ||
322 | dh_testroot | ||
323 | dh_strip | ||
324 | dh_compress | ||
325 | dh_fixperms | ||
326 | dh_installdeb | ||
327 | dh_shlibdeps | ||
328 | dh_gencontrol | ||
329 | dh_md5sums | ||
330 | dh_builddeb | ||
331 | |||
332 | binary: binary-indep binary-arch | ||
333 | |||
334 | debian/faq.html: | ||
335 | wget -O - http://www.openssh.org/faq.html | \ | ||
336 | sed 's,\(href="\)\(txt/\|[^":]*\.html\),\1http://www.openssh.org/\2,g' \ | ||
337 | > debian/faq.html | ||
338 | |||
339 | debian/moduli.5: | ||
340 | wget -q -O - 'http://www.openbsd.org/cgi-bin/cvsweb/~checkout~/src/share/man/man5/moduli.5?content-type=text/plain' | \ | ||
341 | sed 's,/etc/moduli,/etc/ssh/moduli,g; s/\$$Mdocdate\$$/$(shell date +'%B %-d %Y')/' \ | ||
342 | > debian/moduli.5 | ||
343 | |||
344 | .PHONY: build clean binary-indep binary-arch binary install | ||
345 | .PHONY: build-deb build-udeb | ||
346 | .PHONY: binary-openssh-client binary-openssh-server binary-ssh | ||
347 | .PHONY: binary-ssh-krb5 binary-ssh-askpass-gnome | ||
348 | .PHONY: binary-openssh-client-udeb binary-openssh-server-udeb | ||