diff options
Diffstat (limited to 'debian/rules')
-rwxr-xr-x | debian/rules | 287 |
1 files changed, 287 insertions, 0 deletions
diff --git a/debian/rules b/debian/rules new file mode 100755 index 000000000..6a3f31420 --- /dev/null +++ b/debian/rules | |||
@@ -0,0 +1,287 @@ | |||
1 | #!/usr/bin/make -f | ||
2 | |||
3 | # Uncomment this to turn on verbose mode. | ||
4 | # export DH_VERBOSE=1 | ||
5 | |||
6 | # This is the debhelper compatibility version to use. | ||
7 | export DH_COMPAT=2 | ||
8 | |||
9 | # This has to be exported to make some magic below work. | ||
10 | export DH_OPTIONS | ||
11 | |||
12 | ifeq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) | ||
13 | OPTFLAGS := -O2 | ||
14 | else | ||
15 | OPTFLAGS := -O0 | ||
16 | endif | ||
17 | |||
18 | VERSION := $(shell dpkg-parsechangelog | grep ^Version: | cut -d' ' -f2 | sed 's/.*://') | ||
19 | DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH) | ||
20 | |||
21 | CLIENT_UDEB := openssh-client-udeb_$(VERSION)_$(DEB_HOST_ARCH).udeb | ||
22 | SERVER_UDEB := openssh-server-udeb_$(VERSION)_$(DEB_HOST_ARCH).udeb | ||
23 | |||
24 | ifeq (,$(wildcard /usr/bin/po2debconf)) | ||
25 | PO2DEBCONF := no | ||
26 | MINDEBCONFVER := 0.5 | ||
27 | else | ||
28 | PO2DEBCONF := yes | ||
29 | MINDEBCONFVER := 1.2.0 | ||
30 | endif | ||
31 | |||
32 | # We need a new libpam-runtime for sane PAM handling | ||
33 | # (http://lists.debian.org/debian-devel-announce-0308/msg00012.html). | ||
34 | # Unfortunately it's hard to detect during the build whether this is | ||
35 | # appropriate, so woody-compatibility is a pain. I've had to punt and go for | ||
36 | # a DEB_BUILD_SSH_WOODY environment variable. We can remove this hack once | ||
37 | # we no longer care about woody. | ||
38 | ifeq ($(DEB_BUILD_SSH_WOODY),) | ||
39 | PAMSUBST := no | ||
40 | PAMDEP := libpam-runtime (>= 0.76-14) | ||
41 | else | ||
42 | PAMSUBST := yes | ||
43 | PAMDEP := libpam-runtime | ||
44 | endif | ||
45 | |||
46 | # Temporary linkage hack for amd64 due to lack of res_query weak alias, see | ||
47 | # #242462. Real fix sent upstream. | ||
48 | ifeq ($(DEB_HOST_ARCH),amd64) | ||
49 | FORCE_LIBS = LIBS=-lresolv | ||
50 | endif | ||
51 | |||
52 | # Change the version string to include the Debian version | ||
53 | SSH_EXTRAVERSION := Debian-$(shell dpkg-parsechangelog | sed -n -e '/^Version:/s/Version: //p' | sed -e 's/[^-]*-//') | ||
54 | |||
55 | build: build-deb build-udeb | ||
56 | |||
57 | build-deb: build-deb-stamp | ||
58 | build-deb-stamp: | ||
59 | dh_testdir | ||
60 | mkdir -p build-deb | ||
61 | cd build-deb && $(FORCE_LIBS) ../configure --prefix=/usr --sysconfdir=/etc/ssh --libexecdir=/usr/lib --mandir=/usr/share/man --with-tcp-wrappers --with-xauth=/usr/bin/X11/xauth --with-default-path=/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin --with-superuser-path=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/X11R6/bin --with-pam --with-4in6 --with-privsep-path=/var/run/sshd --without-rand-helper | ||
62 | |||
63 | # Some 2.2 kernels have trouble with setres[ug]id() (bug #239999). | ||
64 | perl -pi -e 's/.*#undef (BROKEN_SETRES[UG]ID).*/#define $$1 1/' build-deb/config.h | ||
65 | # Supply pthread linkage for just those binaries linked to PAM. | ||
66 | perl -pi -e 's/^(LIBPAM=.*)/$$1 -pthread/' build-deb/Makefile | ||
67 | |||
68 | $(MAKE) -C build-deb -j 2 ASKPASS_PROGRAM='/usr/bin/ssh-askpass' CFLAGS='$(OPTFLAGS) -g -Wall -DUSE_POSIX_THREADS -DLOGIN_PROGRAM=\"/bin/login\" -DLOGIN_NO_ENDOPT -DSSHD_PAM_SERVICE=\"ssh\" -DSSH_EXTRAVERSION="\" $(SSH_EXTRAVERSION)\""' SSH_KEYSIGN='/usr/lib/ssh-keysign' | ||
69 | # Support building on Debian 3.0 (with GNOME 1.4) and later. | ||
70 | if [ -f /usr/include/libgnomeui-2.0/gnome.h ]; then \ | ||
71 | $(MAKE) -C contrib gnome-ssh-askpass2 CC='gcc $(OPTFLAGS) -g -Wall'; \ | ||
72 | elif [ -f /usr/include/gnome-1.0/gnome.h ]; then \ | ||
73 | $(MAKE) -C contrib gnome-ssh-askpass1 CC='gcc $(OPTFLAGS) -g -Wall'; \ | ||
74 | fi | ||
75 | |||
76 | touch build-deb-stamp | ||
77 | |||
78 | build-udeb: build-udeb-stamp | ||
79 | build-udeb-stamp: | ||
80 | dh_testdir | ||
81 | mkdir -p build-udeb | ||
82 | cd build-udeb && $(FORCE_LIBS) ../configure --prefix=/usr --sysconfdir=/etc/ssh --without-xauth --with-default-path=/usr/local/bin:/bin:/usr/bin --with-superuser-path=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin --with-4in6 --with-privsep-path=/var/run/sshd --without-rand-helper | ||
83 | # Avoid libnsl linkage. Ugh. | ||
84 | perl -pi -e 's/ +-lnsl//' build-udeb/config.status | ||
85 | cd build-udeb && ./config.status | ||
86 | $(MAKE) -C build-udeb -j 2 ASKPASS_PROGRAM='/usr/bin/ssh-askpass' CFLAGS='-Os -g -Wall -DSSH_EXTRAVERSION="\" $(SSH_EXTRAVERSION)\""' SSH_KEYSIGN='/usr/lib/ssh-keysign' ssh scp sftp sshd ssh-keygen | ||
87 | touch build-udeb-stamp | ||
88 | |||
89 | clean: | ||
90 | dh_testdir | ||
91 | rm -f build-deb-stamp build-udeb-stamp | ||
92 | rm -rf build-deb build-udeb | ||
93 | -$(MAKE) -C contrib clean | ||
94 | rm -f config.log | ||
95 | ifeq ($(PO2DEBCONF),yes) | ||
96 | # Hack for woody compatibility. This makes sure that the | ||
97 | # debian/templates file shipped in the source package doesn't | ||
98 | # specify encodings, which woody's debconf can't handle. If building | ||
99 | # on a system with po-debconf installed (conveniently debhelper (>= | ||
100 | # 4.1.16) depends on it), the binary-arch target will generate a | ||
101 | # better version for sarge. | ||
102 | echo 1 > debian/po/output | ||
103 | po2debconf debian/openssh-client.templates.master > debian/openssh-client.templates | ||
104 | po2debconf debian/openssh-server.templates.master > debian/openssh-server.templates | ||
105 | rm -f debian/po/output | ||
106 | endif | ||
107 | ifeq ($(PAMSUBST),yes) | ||
108 | if [ -f debian/ssh.pam.new-style ]; then \ | ||
109 | mv debian/ssh.pam.new-style debian/ssh.pam; \ | ||
110 | fi | ||
111 | endif | ||
112 | rm -f debian/ssh-askpass-gnome.png | ||
113 | dh_clean | ||
114 | |||
115 | install: DH_OPTIONS=-a | ||
116 | install: build | ||
117 | dh_testdir | ||
118 | dh_testroot | ||
119 | dh_clean -k | ||
120 | dh_installdirs | ||
121 | |||
122 | $(MAKE) -C build-deb DESTDIR=`pwd`/debian/openssh-client install-nokeys | ||
123 | |||
124 | rm -f debian/openssh-client/etc/ssh/sshd_config | ||
125 | #Temporary hack: remove /usr/share/Ssh.bin, since we have no smartcard support anyway. | ||
126 | rm -f debian/openssh-client/usr/share/Ssh.bin | ||
127 | |||
128 | # Split off the server. | ||
129 | mv debian/openssh-client/usr/sbin/sshd debian/openssh-server/usr/sbin/ | ||
130 | mv debian/openssh-client/usr/lib/sftp-server debian/openssh-server/usr/lib/ | ||
131 | mv debian/openssh-client/usr/share/man/man5/sshd_config.5 debian/openssh-server/usr/share/man/man5/ | ||
132 | mv debian/openssh-client/usr/share/man/man8/sshd.8 debian/openssh-server/usr/share/man/man8/ | ||
133 | mv debian/openssh-client/usr/share/man/man8/sftp-server.8 debian/openssh-server/usr/share/man/man8/ | ||
134 | rmdir debian/openssh-client/usr/sbin debian/openssh-client/var/run/sshd | ||
135 | |||
136 | install -m 755 contrib/ssh-copy-id debian/openssh-client/usr/bin/ssh-copy-id | ||
137 | install -m 644 -c contrib/ssh-copy-id.1 debian/openssh-client/usr/share/man/man1/ssh-copy-id.1 | ||
138 | install -m 644 debian/moduli.5 debian/openssh-client/usr/share/man/man5/moduli.5 | ||
139 | |||
140 | if [ -f contrib/gnome-ssh-askpass2 ]; then \ | ||
141 | install -s -o root -g root -m 755 contrib/gnome-ssh-askpass2 debian/ssh-askpass-gnome/usr/lib/ssh/gnome-ssh-askpass; \ | ||
142 | elif [ -f contrib/gnome-ssh-askpass1 ]; then \ | ||
143 | install -s -o root -g root -m 755 contrib/gnome-ssh-askpass1 debian/ssh-askpass-gnome/usr/lib/ssh/gnome-ssh-askpass; \ | ||
144 | fi | ||
145 | install -m 644 debian/gnome-ssh-askpass.1 debian/ssh-askpass-gnome/usr/share/man/man1/gnome-ssh-askpass.1 | ||
146 | uudecode -o debian/ssh-askpass-gnome/usr/share/pixmaps/ssh-askpass-gnome.png debian/ssh-askpass-gnome.png.uue | ||
147 | |||
148 | install -m 755 debian/ssh-argv0 debian/openssh-client/usr/bin/ssh-argv0 | ||
149 | install -m 644 debian/ssh-argv0.1 debian/openssh-client/usr/share/man/man1/ssh-argv0.1 | ||
150 | |||
151 | install -o root -g root debian/openssh-server.init debian/openssh-server/etc/init.d/ssh | ||
152 | install -o root -g root -m 644 debian/openssh-server.default debian/openssh-server/etc/default/ssh | ||
153 | |||
154 | install -m 755 build-udeb/ssh debian/openssh-client-udeb/usr/bin/ssh | ||
155 | install -m 755 build-udeb/scp debian/openssh-client-udeb/usr/bin/scp | ||
156 | install -m 755 build-udeb/sftp debian/openssh-client-udeb/usr/bin/sftp | ||
157 | install -m 755 build-udeb/sshd debian/openssh-server-udeb/usr/sbin/sshd | ||
158 | install -m 755 build-udeb/ssh-keygen debian/openssh-server-udeb/usr/bin/ssh-keygen | ||
159 | |||
160 | # Build architecture-independent files here. | ||
161 | binary-indep: binary-ssh | ||
162 | |||
163 | # Build architecture-dependent files here. | ||
164 | binary-arch: binary-openssh-client binary-openssh-server | ||
165 | binary-arch: binary-ssh-askpass-gnome | ||
166 | binary-arch: binary-openssh-client-udeb binary-openssh-server-udeb | ||
167 | |||
168 | binary-openssh-client: DH_OPTIONS=-popenssh-client | ||
169 | binary-openssh-client: build install | ||
170 | dh_testdir | ||
171 | dh_testroot | ||
172 | ifeq ($(PO2DEBCONF),yes) | ||
173 | po2debconf -e utf8 debian/openssh-client.templates.master > debian/openssh-client.templates | ||
174 | endif | ||
175 | dh_installdebconf | ||
176 | dh_installdocs OVERVIEW README | ||
177 | cat debian/copyright.head LICENCE > debian/openssh-client/usr/share/doc/openssh-client/copyright | ||
178 | dh_installchangelogs ChangeLog | ||
179 | dh_strip | ||
180 | dh_compress | ||
181 | dh_fixperms | ||
182 | dh_installdeb | ||
183 | test ! -e debian/ssh/etc/ssh/ssh_prng_cmds \ | ||
184 | || echo "/etc/ssh/ssh_prng_cmds" >> debian/openssh-client/DEBIAN/conffiles | ||
185 | dh_shlibdeps | ||
186 | dh_gencontrol -- -V'debconf-depends=debconf (>= $(MINDEBCONFVER)) | debconf-2.0' | ||
187 | dh_md5sums | ||
188 | dh_builddeb | ||
189 | |||
190 | binary-openssh-server: DH_OPTIONS=-popenssh-server | ||
191 | binary-openssh-server: build install | ||
192 | dh_testdir | ||
193 | dh_testroot | ||
194 | ifeq ($(PO2DEBCONF),yes) | ||
195 | po2debconf -e utf8 debian/openssh-server.templates.master > debian/openssh-server.templates | ||
196 | endif | ||
197 | dh_installdebconf | ||
198 | dh_installdocs OVERVIEW README | ||
199 | cat debian/copyright.head LICENCE > debian/openssh-server/usr/share/doc/openssh-server/copyright | ||
200 | ifeq ($(PAMSUBST),yes) | ||
201 | # Clean up if we've done this already, to ensure idempotency. | ||
202 | if [ -f debian/openssh-server.ssh.pam.new-style ]; then \ | ||
203 | mv debian/openssh-server.ssh.pam.new-style debian/openssh-server.ssh.pam; \ | ||
204 | fi | ||
205 | cp -a debian/openssh-server.ssh.pam debian/openssh-server.ssh.pam.new-style | ||
206 | sed -e "s/@include common-auth/auth required pam_unix.so/" \ | ||
207 | -e "s/@include common-account/account required pam_unix.so/" \ | ||
208 | -e "s/@include common-session/session required pam_unix.so/" \ | ||
209 | -e "s/@include common-password/password required pam_unix.so/" \ | ||
210 | debian/openssh-server.ssh.pam.new-style > debian/openssh-server.ssh.pam | ||
211 | endif | ||
212 | dh_installpam --name ssh # TODO: breaks woody backports | ||
213 | dh_installchangelogs ChangeLog | ||
214 | dh_strip | ||
215 | dh_compress | ||
216 | dh_fixperms | ||
217 | dh_installdeb | ||
218 | dh_shlibdeps | ||
219 | dh_gencontrol -- -V'debconf-depends=debconf (>= $(MINDEBCONFVER)) | debconf-2.0' \ | ||
220 | -V'pam-depends=$(PAMDEP)' | ||
221 | dh_md5sums | ||
222 | dh_builddeb | ||
223 | |||
224 | binary-ssh: DH_OPTIONS=-pssh | ||
225 | binary-ssh: build install | ||
226 | dh_testdir | ||
227 | dh_testroot | ||
228 | dh_installdocs | ||
229 | cat debian/copyright.head LICENCE > debian/ssh/usr/share/doc/ssh/copyright | ||
230 | dh_installchangelogs | ||
231 | dh_compress | ||
232 | dh_fixperms | ||
233 | dh_installdeb | ||
234 | dh_gencontrol | ||
235 | dh_md5sums | ||
236 | dh_builddeb | ||
237 | |||
238 | binary-ssh-askpass-gnome: DH_OPTIONS=-pssh-askpass-gnome | ||
239 | binary-ssh-askpass-gnome: build install | ||
240 | dh_testdir | ||
241 | dh_testroot | ||
242 | dh_installdocs | ||
243 | dh_installexamples debian/ssh-askpass-gnome.desktop | ||
244 | dh_installchangelogs ChangeLog | ||
245 | dh_strip | ||
246 | dh_compress | ||
247 | dh_fixperms | ||
248 | dh_installdeb | ||
249 | dh_shlibdeps | ||
250 | dh_gencontrol | ||
251 | dh_md5sums | ||
252 | dh_builddeb | ||
253 | |||
254 | binary-openssh-client-udeb: DH_OPTIONS=-popenssh-client-udeb | ||
255 | binary-openssh-client-udeb: build install | ||
256 | dh_testdir | ||
257 | dh_testroot | ||
258 | dh_strip | ||
259 | dh_compress | ||
260 | dh_fixperms | ||
261 | dh_installdeb | ||
262 | install -p -o root -g root -m 755 debian/openssh-client-udeb.isinstallable debian/openssh-client-udeb/DEBIAN/isinstallable | ||
263 | dh_shlibdeps | ||
264 | dh_gencontrol -- -fdebian/files~ | ||
265 | dpkg-distaddfile $(CLIENT_UDEB) debian-installer optional | ||
266 | dh_builddeb --filename=$(CLIENT_UDEB) | ||
267 | |||
268 | binary-openssh-server-udeb: DH_OPTIONS=-popenssh-server-udeb | ||
269 | binary-openssh-server-udeb: build install | ||
270 | dh_testdir | ||
271 | dh_testroot | ||
272 | dh_strip | ||
273 | dh_compress | ||
274 | dh_fixperms | ||
275 | dh_installdeb | ||
276 | dh_shlibdeps | ||
277 | dh_gencontrol -- -fdebian/files~ | ||
278 | dpkg-distaddfile $(SERVER_UDEB) debian-installer optional | ||
279 | dh_builddeb --filename=$(SERVER_UDEB) | ||
280 | |||
281 | binary: binary-indep binary-arch | ||
282 | |||
283 | .PHONY: build clean binary-indep binary-arch binary install | ||
284 | .PHONY: build-deb build-udeb | ||
285 | .PHONY: binary-openssh-client binary-openssh-server binary-ssh | ||
286 | .PHONY: binary-ssh-askpass-gnome | ||
287 | .PHONY: binary-openssh-client-udeb binary-openssh-server-udeb | ||