diff options
Diffstat (limited to 'debian/rules')
-rwxr-xr-x | debian/rules | 326 |
1 files changed, 326 insertions, 0 deletions
diff --git a/debian/rules b/debian/rules new file mode 100755 index 000000000..e18c77153 --- /dev/null +++ b/debian/rules | |||
@@ -0,0 +1,326 @@ | |||
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_ARCH_OS := $(shell dpkg-architecture -qDEB_HOST_ARCH_OS 2>/dev/null) | ||
16 | |||
17 | # Take account of old dpkg-architecture output. | ||
18 | ifeq ($(DEB_HOST_ARCH_OS),) | ||
19 | DEB_HOST_ARCH_OS := $(subst -gnu,,$(shell dpkg-architecture -qDEB_HOST_GNU_SYSTEM)) | ||
20 | ifeq ($(DEB_HOST_ARCH_OS),gnu) | ||
21 | DEB_HOST_ARCH_OS := hurd | ||
22 | endif | ||
23 | endif | ||
24 | |||
25 | ifeq (,$(wildcard /usr/bin/po2debconf)) | ||
26 | PO2DEBCONF := no | ||
27 | MINDEBCONFVER := 0.5 | ||
28 | else | ||
29 | PO2DEBCONF := yes | ||
30 | MINDEBCONFVER := 1.2.0 | ||
31 | endif | ||
32 | |||
33 | # We need a new libpam-runtime for sane PAM handling | ||
34 | # (http://lists.debian.org/debian-devel-announce-0308/msg00012.html). | ||
35 | # Unfortunately it's hard to detect during the build whether this is | ||
36 | # appropriate, so woody-compatibility is a pain. I've had to punt and go for | ||
37 | # a DEB_BUILD_SSH_WOODY environment variable. We can remove this hack once | ||
38 | # we no longer care about woody. | ||
39 | ifeq ($(DEB_BUILD_SSH_WOODY),) | ||
40 | PAMSUBST := no | ||
41 | PAMDEP := libpam-runtime (>= 0.76-14) | ||
42 | else | ||
43 | PAMSUBST := yes | ||
44 | PAMDEP := libpam-runtime | ||
45 | endif | ||
46 | |||
47 | # The Hurd needs libcrypt for res_query et al. | ||
48 | ifeq ($(DEB_HOST_ARCH_OS),hurd) | ||
49 | FORCE_LIBS := LIBS=-lcrypt | ||
50 | endif | ||
51 | |||
52 | # SELinux support? | ||
53 | ifeq ($(DEB_HOST_ARCH_OS),linux) | ||
54 | SELINUX := --with-selinux | ||
55 | endif | ||
56 | |||
57 | # Change the version string to include the Debian version | ||
58 | SSH_EXTRAVERSION := Debian-$(shell dpkg-parsechangelog | sed -n -e '/^Version:/s/Version: //p' | sed -e 's/[^-]*-//') | ||
59 | |||
60 | build: build-deb build-udeb | ||
61 | |||
62 | build-deb: build-deb-stamp | ||
63 | build-deb-stamp: | ||
64 | dh_testdir | ||
65 | mkdir -p build-deb | ||
66 | cd build-deb && $(FORCE_LIBS) ../configure --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=/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games --with-superuser-path=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11 --with-pam --with-4in6 --with-privsep-path=/var/run/sshd --without-rand-helper --with-libedit --with-kerberos5=/usr $(SELINUX) | ||
67 | |||
68 | ifeq ($(DEB_HOST_ARCH_OS),linux) | ||
69 | # Some 2.2 kernels have trouble with setres[ug]id() (bug #239999). | ||
70 | perl -pi -e 's/.*#undef (BROKEN_SETRES[UG]ID).*/#define $$1 1/' build-deb/config.h | ||
71 | endif | ||
72 | # Debian's /var/log/btmp has inappropriate permissions. | ||
73 | perl -pi -e 's,.*#define USE_BTMP .*,/* #undef USE_BTMP */,' build-deb/config.h | ||
74 | |||
75 | $(MAKE) -C build-deb -j 2 ASKPASS_PROGRAM='/usr/bin/ssh-askpass' CFLAGS='$(OPTFLAGS) -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)\""' | ||
76 | # Support building on Debian 3.0 (with GNOME 1.4) and later. | ||
77 | if [ -f /usr/include/libgnomeui-2.0/gnome.h ]; then \ | ||
78 | $(MAKE) -C contrib gnome-ssh-askpass2 CC='gcc $(OPTFLAGS) -g -Wall'; \ | ||
79 | elif [ -f /usr/include/gnome-1.0/gnome.h ]; then \ | ||
80 | $(MAKE) -C contrib gnome-ssh-askpass1 CC='gcc $(OPTFLAGS) -g -Wall'; \ | ||
81 | fi | ||
82 | |||
83 | touch build-deb-stamp | ||
84 | |||
85 | build-udeb: build-udeb-stamp | ||
86 | build-udeb-stamp: | ||
87 | dh_testdir | ||
88 | mkdir -p build-udeb | ||
89 | cd build-udeb && $(FORCE_LIBS) ../configure --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 | ||
90 | # Debian's /var/log/btmp has inappropriate permissions. | ||
91 | perl -pi -e 's,.*#define USE_BTMP .*,/* #undef USE_BTMP */,' build-udeb/config.h | ||
92 | # Avoid libnsl linkage. Ugh. | ||
93 | perl -pi -e 's/ +-lnsl//' build-udeb/config.status | ||
94 | cd build-udeb && ./config.status | ||
95 | $(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 | ||
96 | touch build-udeb-stamp | ||
97 | |||
98 | clean: | ||
99 | dh_testdir | ||
100 | rm -f build-deb-stamp build-udeb-stamp | ||
101 | rm -rf build-deb build-udeb | ||
102 | -$(MAKE) -C contrib clean | ||
103 | rm -f config.log | ||
104 | ifeq ($(PO2DEBCONF),yes) | ||
105 | # Hack for woody compatibility. This makes sure that the | ||
106 | # debian/templates file shipped in the source package doesn't | ||
107 | # specify encodings, which woody's debconf can't handle. If building | ||
108 | # on a system with po-debconf installed (conveniently debhelper (>= | ||
109 | # 4.1.16) depends on it), the binary-arch target will generate a | ||
110 | # better version for sarge. | ||
111 | echo '1 popular' > debian/po/output | ||
112 | po2debconf debian/openssh-server.templates.master > debian/openssh-server.templates | ||
113 | rm -f debian/po/output | ||
114 | endif | ||
115 | ifeq ($(PAMSUBST),yes) | ||
116 | if [ -f debian/ssh.pam.new-style ]; then \ | ||
117 | mv debian/ssh.pam.new-style debian/ssh.pam; \ | ||
118 | fi | ||
119 | endif | ||
120 | rm -f debian/ssh-askpass-gnome.png | ||
121 | dh_clean | ||
122 | |||
123 | install: DH_OPTIONS=-a | ||
124 | install: build | ||
125 | dh_testdir | ||
126 | dh_testroot | ||
127 | dh_clean -k | ||
128 | dh_installdirs | ||
129 | |||
130 | $(MAKE) -C build-deb DESTDIR=`pwd`/debian/openssh-client install-nokeys | ||
131 | |||
132 | rm -f debian/openssh-client/etc/ssh/sshd_config | ||
133 | #Temporary hack: remove /usr/share/Ssh.bin, since we have no smartcard support anyway. | ||
134 | rm -f debian/openssh-client/usr/share/Ssh.bin | ||
135 | |||
136 | # Split off the server. | ||
137 | mv debian/openssh-client/usr/sbin/sshd debian/openssh-server/usr/sbin/ | ||
138 | mv debian/openssh-client/usr/lib/openssh/sftp-server debian/openssh-server/usr/lib/openssh/ | ||
139 | mv debian/openssh-client/usr/share/man/man5/sshd_config.5 debian/openssh-server/usr/share/man/man5/ | ||
140 | mv debian/openssh-client/usr/share/man/man8/sshd.8 debian/openssh-server/usr/share/man/man8/ | ||
141 | mv debian/openssh-client/usr/share/man/man8/sftp-server.8 debian/openssh-server/usr/share/man/man8/ | ||
142 | rmdir debian/openssh-client/usr/sbin debian/openssh-client/var/run/sshd | ||
143 | |||
144 | install -m 755 contrib/ssh-copy-id debian/openssh-client/usr/bin/ssh-copy-id | ||
145 | install -m 644 -c contrib/ssh-copy-id.1 debian/openssh-client/usr/share/man/man1/ssh-copy-id.1 | ||
146 | install -m 644 debian/moduli.5 debian/openssh-client/usr/share/man/man5/moduli.5 | ||
147 | |||
148 | if [ -f contrib/gnome-ssh-askpass2 ]; then \ | ||
149 | install -s -o root -g root -m 755 contrib/gnome-ssh-askpass2 debian/ssh-askpass-gnome/usr/lib/openssh/gnome-ssh-askpass; \ | ||
150 | elif [ -f contrib/gnome-ssh-askpass1 ]; then \ | ||
151 | install -s -o root -g root -m 755 contrib/gnome-ssh-askpass1 debian/ssh-askpass-gnome/usr/lib/openssh/gnome-ssh-askpass; \ | ||
152 | fi | ||
153 | install -m 644 debian/gnome-ssh-askpass.1 debian/ssh-askpass-gnome/usr/share/man/man1/gnome-ssh-askpass.1 | ||
154 | uudecode -o debian/ssh-askpass-gnome/usr/share/pixmaps/ssh-askpass-gnome.png debian/ssh-askpass-gnome.png.uue | ||
155 | |||
156 | install -m 755 debian/ssh-argv0 debian/openssh-client/usr/bin/ssh-argv0 | ||
157 | install -m 644 debian/ssh-argv0.1 debian/openssh-client/usr/share/man/man1/ssh-argv0.1 | ||
158 | |||
159 | install -o root -g root debian/openssh-server.init debian/openssh-server/etc/init.d/ssh | ||
160 | install -o root -g root -m 644 debian/openssh-server.default debian/openssh-server/etc/default/ssh | ||
161 | |||
162 | install -m 755 build-udeb/ssh debian/openssh-client-udeb/usr/bin/ssh | ||
163 | install -m 755 build-udeb/scp debian/openssh-client-udeb/usr/bin/scp | ||
164 | install -m 755 build-udeb/sftp debian/openssh-client-udeb/usr/bin/sftp | ||
165 | install -m 755 build-udeb/sshd debian/openssh-server-udeb/usr/sbin/sshd | ||
166 | install -m 755 build-udeb/ssh-keygen debian/openssh-server-udeb/usr/bin/ssh-keygen | ||
167 | |||
168 | # Remove version control tags to avoid unnecessary conffile | ||
169 | # resolution steps for administrators. | ||
170 | sed -i '/\$$OpenBSD:/d' \ | ||
171 | debian/openssh-client/etc/ssh/moduli \ | ||
172 | debian/openssh-client/etc/ssh/ssh_config | ||
173 | |||
174 | # Build architecture-independent files here. | ||
175 | binary-indep: binary-ssh binary-ssh-krb5 | ||
176 | |||
177 | # Build architecture-dependent files here. | ||
178 | binary-arch: binary-openssh-client binary-openssh-server | ||
179 | binary-arch: binary-ssh-askpass-gnome | ||
180 | binary-arch: binary-openssh-client-udeb binary-openssh-server-udeb | ||
181 | |||
182 | binary-openssh-client: DH_OPTIONS=-popenssh-client | ||
183 | binary-openssh-client: build install | ||
184 | dh_testdir | ||
185 | dh_testroot | ||
186 | dh_installdebconf | ||
187 | dh_installdocs OVERVIEW README README.dns README.tun | ||
188 | cat debian/copyright.head LICENCE > debian/openssh-client/usr/share/doc/openssh-client/copyright | ||
189 | dh_installchangelogs ChangeLog ChangeLog.gssapi | ||
190 | install -m644 debian/openssh-client.lintian debian/openssh-client/usr/share/lintian/overrides/openssh-client | ||
191 | dh_strip | ||
192 | dh_compress | ||
193 | dh_fixperms | ||
194 | chmod u+s debian/openssh-client/usr/lib/openssh/ssh-keysign | ||
195 | dh_installdeb | ||
196 | test ! -e debian/ssh/etc/ssh/ssh_prng_cmds \ | ||
197 | || echo "/etc/ssh/ssh_prng_cmds" >> debian/openssh-client/DEBIAN/conffiles | ||
198 | perl -i debian/substitute-conffile.pl \ | ||
199 | ETC_SSH_MODULI debian/openssh-client/etc/ssh/moduli \ | ||
200 | ETC_SSH_SSH_CONFIG debian/openssh-client/etc/ssh/ssh_config \ | ||
201 | debian/openssh-client/DEBIAN/preinst | ||
202 | dh_shlibdeps | ||
203 | dh_gencontrol -- -V'debconf-depends=debconf (>= $(MINDEBCONFVER)) | debconf-2.0' | ||
204 | dh_md5sums | ||
205 | dh_builddeb | ||
206 | |||
207 | binary-openssh-server: DH_OPTIONS=-popenssh-server | ||
208 | binary-openssh-server: build install | ||
209 | dh_testdir | ||
210 | dh_testroot | ||
211 | ifeq ($(PO2DEBCONF),yes) | ||
212 | po2debconf -e utf8 debian/openssh-server.templates.master > debian/openssh-server.templates | ||
213 | endif | ||
214 | dh_installdebconf | ||
215 | dh_installdocs | ||
216 | mv debian/openssh-server/usr/share/doc/openssh-server debian/openssh-server/usr/share/doc/openssh-client | ||
217 | rm -f debian/openssh-server/usr/share/doc/openssh-client/copyright | ||
218 | ifeq ($(PAMSUBST),yes) | ||
219 | # Clean up if we've done this already, to ensure idempotency. | ||
220 | if [ -f debian/openssh-server.ssh.pam.new-style ]; then \ | ||
221 | mv debian/openssh-server.ssh.pam.new-style debian/openssh-server.ssh.pam; \ | ||
222 | fi | ||
223 | cp -a debian/openssh-server.ssh.pam debian/openssh-server.ssh.pam.new-style | ||
224 | sed -e "s/@include common-auth/auth required pam_unix.so/" \ | ||
225 | -e "s/@include common-account/account required pam_unix.so/" \ | ||
226 | -e "s/@include common-session/session required pam_unix.so/" \ | ||
227 | -e "s/@include common-password/password required pam_unix.so/" \ | ||
228 | debian/openssh-server.ssh.pam.new-style > debian/openssh-server.ssh.pam | ||
229 | endif | ||
230 | dh_installpam --name ssh # TODO: breaks woody backports | ||
231 | dh_link | ||
232 | dh_strip | ||
233 | dh_compress | ||
234 | dh_fixperms | ||
235 | dh_installdeb | ||
236 | perl -i debian/substitute-conffile.pl \ | ||
237 | ETC_DEFAULT_SSH debian/openssh-server/etc/default/ssh \ | ||
238 | ETC_INIT_D_SSH debian/openssh-server/etc/init.d/ssh \ | ||
239 | ETC_PAM_D_SSH debian/openssh-server/etc/pam.d/ssh \ | ||
240 | debian/openssh-server/DEBIAN/preinst | ||
241 | dh_shlibdeps | ||
242 | dh_gencontrol -- -V'debconf-depends=debconf (>= $(MINDEBCONFVER)) | debconf-2.0' \ | ||
243 | -V'pam-depends=$(PAMDEP)' | ||
244 | dh_md5sums | ||
245 | dh_builddeb | ||
246 | |||
247 | binary-ssh: DH_OPTIONS=-pssh | ||
248 | binary-ssh: build install | ||
249 | dh_testdir | ||
250 | dh_testroot | ||
251 | dh_installdocs | ||
252 | mv debian/ssh/usr/share/doc/ssh debian/ssh/usr/share/doc/openssh-client | ||
253 | rm -f debian/ssh/usr/share/doc/openssh-client/copyright | ||
254 | dh_link | ||
255 | dh_compress | ||
256 | dh_fixperms | ||
257 | dh_installdeb | ||
258 | dh_gencontrol | ||
259 | dh_md5sums | ||
260 | dh_builddeb | ||
261 | |||
262 | binary-ssh-krb5: DH_OPTIONS=-pssh-krb5 | ||
263 | binary-ssh-krb5: build install | ||
264 | dh_testdir | ||
265 | dh_testroot | ||
266 | dh_installdocs | ||
267 | cat debian/copyright.head LICENCE > debian/ssh-krb5/usr/share/doc/ssh-krb5/copyright | ||
268 | dh_installchangelogs ChangeLog ChangeLog.gssapi | ||
269 | dh_link | ||
270 | dh_compress | ||
271 | dh_fixperms | ||
272 | dh_installdeb | ||
273 | dh_gencontrol | ||
274 | dh_md5sums | ||
275 | dh_builddeb | ||
276 | |||
277 | binary-ssh-askpass-gnome: DH_OPTIONS=-pssh-askpass-gnome | ||
278 | binary-ssh-askpass-gnome: build install | ||
279 | dh_testdir | ||
280 | dh_testroot | ||
281 | dh_installdocs | ||
282 | dh_installexamples debian/ssh-askpass-gnome.desktop | ||
283 | dh_installchangelogs ChangeLog ChangeLog.gssapi | ||
284 | dh_strip | ||
285 | dh_compress | ||
286 | dh_fixperms | ||
287 | dh_installdeb | ||
288 | dh_shlibdeps | ||
289 | dh_gencontrol | ||
290 | dh_md5sums | ||
291 | dh_builddeb | ||
292 | |||
293 | binary-openssh-client-udeb: DH_OPTIONS=-popenssh-client-udeb | ||
294 | binary-openssh-client-udeb: build install | ||
295 | dh_testdir | ||
296 | dh_testroot | ||
297 | dh_strip | ||
298 | dh_compress | ||
299 | dh_fixperms | ||
300 | dh_installdeb | ||
301 | install -p -o root -g root -m 755 debian/openssh-client-udeb.isinstallable debian/openssh-client-udeb/DEBIAN/isinstallable | ||
302 | dh_shlibdeps | ||
303 | dh_gencontrol | ||
304 | dh_md5sums | ||
305 | dh_builddeb | ||
306 | |||
307 | binary-openssh-server-udeb: DH_OPTIONS=-popenssh-server-udeb | ||
308 | binary-openssh-server-udeb: build install | ||
309 | dh_testdir | ||
310 | dh_testroot | ||
311 | dh_strip | ||
312 | dh_compress | ||
313 | dh_fixperms | ||
314 | dh_installdeb | ||
315 | dh_shlibdeps | ||
316 | dh_gencontrol | ||
317 | dh_md5sums | ||
318 | dh_builddeb | ||
319 | |||
320 | binary: binary-indep binary-arch | ||
321 | |||
322 | .PHONY: build clean binary-indep binary-arch binary install | ||
323 | .PHONY: build-deb build-udeb | ||
324 | .PHONY: binary-openssh-client binary-openssh-server binary-ssh | ||
325 | .PHONY: binary-ssh-krb5 binary-ssh-askpass-gnome | ||
326 | .PHONY: binary-openssh-client-udeb binary-openssh-server-udeb | ||