diff options
Diffstat (limited to 'debian/rules')
-rwxr-xr-x | debian/rules | 361 |
1 files changed, 361 insertions, 0 deletions
diff --git a/debian/rules b/debian/rules new file mode 100755 index 000000000..14c10e7d1 --- /dev/null +++ b/debian/rules | |||
@@ -0,0 +1,361 @@ | |||
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 (,$(findstring 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 | ifeq (,$(wildcard /usr/bin/po2debconf)) | ||
51 | PO2DEBCONF := no | ||
52 | MINDEBCONFVER := 0.5 | ||
53 | else | ||
54 | PO2DEBCONF := yes | ||
55 | MINDEBCONFVER := 1.2.0 | ||
56 | endif | ||
57 | |||
58 | # We need a new libpam-runtime for sane PAM handling | ||
59 | # (http://lists.debian.org/debian-devel-announce-0308/msg00012.html). | ||
60 | # Unfortunately it's hard to detect during the build whether this is | ||
61 | # appropriate, so woody-compatibility is a pain. I've had to punt and go for | ||
62 | # a DEB_BUILD_SSH_WOODY environment variable. We can remove this hack once | ||
63 | # we no longer care about woody. | ||
64 | ifeq ($(DEB_BUILD_SSH_WOODY),) | ||
65 | PAMSUBST := no | ||
66 | PAMDEP := libpam-runtime (>= 0.76-14) | ||
67 | else | ||
68 | PAMSUBST := yes | ||
69 | PAMDEP := libpam-runtime | ||
70 | endif | ||
71 | |||
72 | # The Hurd needs libcrypt for res_query et al. | ||
73 | ifeq ($(DEB_HOST_ARCH_OS),hurd) | ||
74 | FORCE_LIBS := LIBS=-lcrypt | ||
75 | endif | ||
76 | |||
77 | # SELinux support? | ||
78 | ifeq ($(DEB_HOST_ARCH_OS),linux) | ||
79 | SELINUX := --with-selinux | ||
80 | endif | ||
81 | |||
82 | # Change the version string to include the Debian version | ||
83 | SSH_EXTRAVERSION := Debian-$(shell dpkg-parsechangelog | sed -n -e '/^Version:/s/Version: //p' | sed -e 's/[^-]*-//') | ||
84 | |||
85 | DISTRIBUTOR := $(shell lsb_release -is 2>/dev/null || echo Debian) | ||
86 | ifeq ($(DISTRIBUTOR),Ubuntu) | ||
87 | DEFAULT_PATH := /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11:/usr/games | ||
88 | else | ||
89 | DEFAULT_PATH := /usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games | ||
90 | endif | ||
91 | SUPERUSER_PATH := /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11 | ||
92 | |||
93 | build: build-deb build-udeb | ||
94 | |||
95 | build-deb: build-deb-stamp | ||
96 | build-deb-stamp: | ||
97 | dh_testdir | ||
98 | mkdir -p build-deb | ||
99 | cd build-deb && $(FORCE_LIBS) LDFLAGS='$(PIE_LDFLAGS)' ../configure $(confflags) --prefix=/usr --sysconfdir=/etc/ssh --libexecdir=/usr/lib/openssh --mandir=/usr/share/man --with-tcp-wrappers --with-xauth=/usr/bin/X11/xauth --with-default-path=$(DEFAULT_PATH) --with-superuser-path=$(SUPERUSER_PATH) --with-pam --with-4in6 --with-privsep-path=/var/run/sshd --without-rand-helper --with-libedit --with-kerberos5=/usr --with-ssl-engine $(SELINUX) | ||
100 | |||
101 | ifeq ($(DEB_HOST_ARCH_OS),linux) | ||
102 | # Some 2.2 kernels have trouble with setres[ug]id() (bug #239999). | ||
103 | perl -pi -e 's/.*#undef (BROKEN_SETRES[UG]ID).*/#define $$1 1/' build-deb/config.h | ||
104 | endif | ||
105 | # Debian's /var/log/btmp has inappropriate permissions. | ||
106 | perl -pi -e 's,.*#define USE_BTMP .*,/* #undef USE_BTMP */,' build-deb/config.h | ||
107 | |||
108 | $(MAKE) -C build-deb -j 2 ASKPASS_PROGRAM='/usr/bin/ssh-askpass' CFLAGS='$(OPTFLAGS) $(PIE_CFLAGS) -g -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wno-pointer-sign -std=gnu99 -DLOGIN_PROGRAM=\"/bin/login\" -DLOGIN_NO_ENDOPT -DSSHD_PAM_SERVICE=\"ssh\" -DSSH_EXTRAVERSION="\" $(SSH_EXTRAVERSION)\""' | ||
109 | # Support building on Debian 3.0 (with GNOME 1.4) and later. | ||
110 | if [ -f /usr/include/libgnomeui-2.0/gnome.h ]; then \ | ||
111 | $(MAKE) -C contrib gnome-ssh-askpass2 CC='gcc $(OPTFLAGS) -g -Wall'; \ | ||
112 | elif [ -f /usr/include/gnome-1.0/gnome.h ]; then \ | ||
113 | $(MAKE) -C contrib gnome-ssh-askpass1 CC='gcc $(OPTFLAGS) -g -Wall'; \ | ||
114 | fi | ||
115 | |||
116 | touch build-deb-stamp | ||
117 | |||
118 | build-udeb: build-udeb-stamp | ||
119 | build-udeb-stamp: | ||
120 | dh_testdir | ||
121 | mkdir -p build-udeb | ||
122 | cd build-udeb && $(FORCE_LIBS) ../configure $(confflags) --prefix=/usr --sysconfdir=/etc/ssh --libexecdir=/usr/lib/openssh --without-xauth --with-default-path=/usr/local/bin:/usr/bin:/bin --with-superuser-path=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin --with-4in6 --with-privsep-path=/var/run/sshd --without-rand-helper | ||
123 | # Debian's /var/log/btmp has inappropriate permissions. | ||
124 | perl -pi -e 's,.*#define USE_BTMP .*,/* #undef USE_BTMP */,' build-udeb/config.h | ||
125 | # Avoid libnsl linkage. Ugh. | ||
126 | perl -pi -e 's/ +-lnsl//' build-udeb/config.status | ||
127 | cd build-udeb && ./config.status | ||
128 | $(MAKE) -C build-udeb -j 2 ASKPASS_PROGRAM='/usr/bin/ssh-askpass' CFLAGS='-Os -g -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wno-pointer-sign -std=gnu99 -DSSH_EXTRAVERSION="\" $(SSH_EXTRAVERSION)\""' ssh scp sftp sshd ssh-keygen | ||
129 | touch build-udeb-stamp | ||
130 | |||
131 | clean: | ||
132 | dh_testdir | ||
133 | rm -f build-deb-stamp build-udeb-stamp | ||
134 | rm -rf build-deb build-udeb | ||
135 | $(MAKE) -C contrib clean | ||
136 | rm -f config.log | ||
137 | ifeq ($(PO2DEBCONF),yes) | ||
138 | # Hack for woody compatibility. This makes sure that the | ||
139 | # debian/templates file shipped in the source package doesn't | ||
140 | # specify encodings, which woody's debconf can't handle. If building | ||
141 | # on a system with po-debconf installed (conveniently debhelper (>= | ||
142 | # 4.1.16) depends on it), the binary-arch target will generate a | ||
143 | # better version for sarge. | ||
144 | echo '1 popular' > debian/po/output | ||
145 | po2debconf debian/openssh-server.templates.master > debian/openssh-server.templates | ||
146 | rm -f debian/po/output | ||
147 | endif | ||
148 | ifeq ($(PAMSUBST),yes) | ||
149 | if [ -f debian/ssh.pam.new-style ]; then \ | ||
150 | mv debian/ssh.pam.new-style debian/ssh.pam; \ | ||
151 | fi | ||
152 | endif | ||
153 | rm -f debian/ssh-askpass-gnome.png | ||
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 | if [ -f contrib/gnome-ssh-askpass2 ]; then \ | ||
183 | install -s -o root -g root -m 755 contrib/gnome-ssh-askpass2 debian/ssh-askpass-gnome/usr/lib/openssh/gnome-ssh-askpass; \ | ||
184 | elif [ -f contrib/gnome-ssh-askpass1 ]; then \ | ||
185 | install -s -o root -g root -m 755 contrib/gnome-ssh-askpass1 debian/ssh-askpass-gnome/usr/lib/openssh/gnome-ssh-askpass; \ | ||
186 | fi | ||
187 | install -m 644 debian/gnome-ssh-askpass.1 debian/ssh-askpass-gnome/usr/share/man/man1/gnome-ssh-askpass.1 | ||
188 | uudecode -o debian/ssh-askpass-gnome/usr/share/pixmaps/ssh-askpass-gnome.png debian/ssh-askpass-gnome.png.uue | ||
189 | |||
190 | install -m 755 debian/ssh-argv0 debian/openssh-client/usr/bin/ssh-argv0 | ||
191 | install -m 644 debian/ssh-argv0.1 debian/openssh-client/usr/share/man/man1/ssh-argv0.1 | ||
192 | |||
193 | install -o root -g root debian/openssh-server.init debian/openssh-server/etc/init.d/ssh | ||
194 | install -o root -g root -m 644 debian/openssh-server.default debian/openssh-server/etc/default/ssh | ||
195 | install -o root -g root debian/openssh-server.if-up debian/openssh-server/etc/network/if-up.d/openssh-server | ||
196 | |||
197 | install -m 755 build-udeb/ssh debian/openssh-client-udeb/usr/bin/ssh | ||
198 | install -m 755 build-udeb/scp debian/openssh-client-udeb/usr/bin/scp | ||
199 | install -m 755 build-udeb/sftp debian/openssh-client-udeb/usr/bin/sftp | ||
200 | install -m 755 build-udeb/sshd debian/openssh-server-udeb/usr/sbin/sshd | ||
201 | install -m 755 build-udeb/ssh-keygen debian/openssh-server-udeb/usr/bin/ssh-keygen | ||
202 | |||
203 | # Remove version control tags to avoid unnecessary conffile | ||
204 | # resolution steps for administrators. | ||
205 | sed -i '/\$$OpenBSD:/d' \ | ||
206 | debian/openssh-client/etc/ssh/moduli \ | ||
207 | debian/openssh-client/etc/ssh/ssh_config | ||
208 | |||
209 | # Build architecture-independent files here. | ||
210 | binary-indep: binary-ssh binary-ssh-krb5 | ||
211 | |||
212 | # Build architecture-dependent files here. | ||
213 | binary-arch: binary-openssh-client binary-openssh-server | ||
214 | binary-arch: binary-ssh-askpass-gnome | ||
215 | binary-arch: binary-openssh-client-udeb binary-openssh-server-udeb | ||
216 | |||
217 | binary-openssh-client: DH_OPTIONS=-popenssh-client | ||
218 | binary-openssh-client: build install | ||
219 | dh_testdir | ||
220 | dh_testroot | ||
221 | dh_installdebconf | ||
222 | dh_installdocs OVERVIEW README README.dns README.tun | ||
223 | cat debian/copyright.head LICENCE > debian/openssh-client/usr/share/doc/openssh-client/copyright | ||
224 | dh_installchangelogs ChangeLog ChangeLog.gssapi | ||
225 | install -m644 debian/openssh-client.lintian debian/openssh-client/usr/share/lintian/overrides/openssh-client | ||
226 | dh_strip | ||
227 | dh_compress | ||
228 | dh_fixperms | ||
229 | chmod u+s debian/openssh-client/usr/lib/openssh/ssh-keysign | ||
230 | dh_installdeb | ||
231 | test ! -e debian/ssh/etc/ssh/ssh_prng_cmds \ | ||
232 | || echo "/etc/ssh/ssh_prng_cmds" >> debian/openssh-client/DEBIAN/conffiles | ||
233 | perl -i debian/substitute-conffile.pl \ | ||
234 | ETC_SSH_MODULI debian/openssh-client/etc/ssh/moduli \ | ||
235 | ETC_SSH_SSH_CONFIG debian/openssh-client/etc/ssh/ssh_config \ | ||
236 | debian/openssh-client/DEBIAN/preinst | ||
237 | dh_shlibdeps | ||
238 | dh_gencontrol -- -V'debconf-depends=debconf (>= $(MINDEBCONFVER)) | debconf-2.0' | ||
239 | dh_md5sums | ||
240 | dh_builddeb | ||
241 | |||
242 | binary-openssh-server: DH_OPTIONS=-popenssh-server | ||
243 | binary-openssh-server: build install | ||
244 | dh_testdir | ||
245 | dh_testroot | ||
246 | ifeq ($(PO2DEBCONF),yes) | ||
247 | po2debconf -e utf8 debian/openssh-server.templates.master > debian/openssh-server.templates | ||
248 | endif | ||
249 | dh_installdebconf | ||
250 | dh_installdocs | ||
251 | mv debian/openssh-server/usr/share/doc/openssh-server debian/openssh-server/usr/share/doc/openssh-client | ||
252 | rm -f debian/openssh-server/usr/share/doc/openssh-client/copyright | ||
253 | ifeq ($(PAMSUBST),yes) | ||
254 | # Clean up if we've done this already, to ensure idempotency. | ||
255 | if [ -f debian/openssh-server.ssh.pam.new-style ]; then \ | ||
256 | mv debian/openssh-server.ssh.pam.new-style debian/openssh-server.ssh.pam; \ | ||
257 | fi | ||
258 | cp -a debian/openssh-server.ssh.pam debian/openssh-server.ssh.pam.new-style | ||
259 | sed -e "s/@include common-auth/auth required pam_unix.so/" \ | ||
260 | -e "s/@include common-account/account required pam_unix.so/" \ | ||
261 | -e "s/@include common-session/session required pam_unix.so/" \ | ||
262 | -e "s/@include common-password/password required pam_unix.so/" \ | ||
263 | debian/openssh-server.ssh.pam.new-style > debian/openssh-server.ssh.pam | ||
264 | endif | ||
265 | dh_installpam --name ssh # TODO: breaks woody backports | ||
266 | dh_link | ||
267 | dh_strip | ||
268 | dh_compress | ||
269 | dh_fixperms | ||
270 | dh_installdeb | ||
271 | perl -i debian/substitute-conffile.pl \ | ||
272 | ETC_DEFAULT_SSH debian/openssh-server/etc/default/ssh \ | ||
273 | ETC_INIT_D_SSH debian/openssh-server/etc/init.d/ssh \ | ||
274 | ETC_PAM_D_SSH debian/openssh-server/etc/pam.d/ssh \ | ||
275 | debian/openssh-server/DEBIAN/preinst | ||
276 | dh_shlibdeps | ||
277 | dh_gencontrol -- -V'debconf-depends=debconf (>= $(MINDEBCONFVER)) | debconf-2.0' \ | ||
278 | -V'pam-depends=$(PAMDEP)' | ||
279 | dh_md5sums | ||
280 | dh_builddeb | ||
281 | |||
282 | binary-ssh: DH_OPTIONS=-pssh | ||
283 | binary-ssh: build install | ||
284 | dh_testdir | ||
285 | dh_testroot | ||
286 | dh_installdocs | ||
287 | mv debian/ssh/usr/share/doc/ssh debian/ssh/usr/share/doc/openssh-client | ||
288 | rm -f debian/ssh/usr/share/doc/openssh-client/copyright | ||
289 | dh_link | ||
290 | dh_compress | ||
291 | dh_fixperms | ||
292 | dh_installdeb | ||
293 | dh_gencontrol | ||
294 | dh_md5sums | ||
295 | dh_builddeb | ||
296 | |||
297 | binary-ssh-krb5: DH_OPTIONS=-pssh-krb5 | ||
298 | binary-ssh-krb5: build install | ||
299 | dh_testdir | ||
300 | dh_testroot | ||
301 | dh_installdocs | ||
302 | cat debian/copyright.head LICENCE > debian/ssh-krb5/usr/share/doc/ssh-krb5/copyright | ||
303 | dh_installchangelogs ChangeLog ChangeLog.gssapi | ||
304 | dh_link | ||
305 | dh_compress | ||
306 | dh_fixperms | ||
307 | dh_installdeb | ||
308 | dh_gencontrol | ||
309 | dh_md5sums | ||
310 | dh_builddeb | ||
311 | |||
312 | binary-ssh-askpass-gnome: DH_OPTIONS=-pssh-askpass-gnome | ||
313 | binary-ssh-askpass-gnome: build install | ||
314 | dh_testdir | ||
315 | dh_testroot | ||
316 | dh_installdocs | ||
317 | dh_installexamples debian/ssh-askpass-gnome.desktop | ||
318 | dh_installchangelogs ChangeLog ChangeLog.gssapi | ||
319 | dh_strip | ||
320 | dh_compress | ||
321 | dh_fixperms | ||
322 | dh_installdeb | ||
323 | dh_shlibdeps | ||
324 | dh_gencontrol | ||
325 | dh_md5sums | ||
326 | dh_builddeb | ||
327 | |||
328 | binary-openssh-client-udeb: DH_OPTIONS=-popenssh-client-udeb | ||
329 | binary-openssh-client-udeb: build install | ||
330 | dh_testdir | ||
331 | dh_testroot | ||
332 | dh_strip | ||
333 | dh_compress | ||
334 | dh_fixperms | ||
335 | dh_installdeb | ||
336 | install -p -o root -g root -m 755 debian/openssh-client-udeb.isinstallable debian/openssh-client-udeb/DEBIAN/isinstallable | ||
337 | dh_shlibdeps | ||
338 | dh_gencontrol | ||
339 | dh_md5sums | ||
340 | dh_builddeb | ||
341 | |||
342 | binary-openssh-server-udeb: DH_OPTIONS=-popenssh-server-udeb | ||
343 | binary-openssh-server-udeb: build install | ||
344 | dh_testdir | ||
345 | dh_testroot | ||
346 | dh_strip | ||
347 | dh_compress | ||
348 | dh_fixperms | ||
349 | dh_installdeb | ||
350 | dh_shlibdeps | ||
351 | dh_gencontrol | ||
352 | dh_md5sums | ||
353 | dh_builddeb | ||
354 | |||
355 | binary: binary-indep binary-arch | ||
356 | |||
357 | .PHONY: build clean binary-indep binary-arch binary install | ||
358 | .PHONY: build-deb build-udeb | ||
359 | .PHONY: binary-openssh-client binary-openssh-server binary-ssh | ||
360 | .PHONY: binary-ssh-krb5 binary-ssh-askpass-gnome | ||
361 | .PHONY: binary-openssh-client-udeb binary-openssh-server-udeb | ||