summaryrefslogtreecommitdiff
path: root/debian/rules
diff options
context:
space:
mode:
Diffstat (limited to 'debian/rules')
-rwxr-xr-xdebian/rules296
1 files changed, 296 insertions, 0 deletions
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 000000000..422fafaf9
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,296 @@
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.
7export DH_OPTIONS
8
9ifeq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
10OPTFLAGS := -O2
11else
12OPTFLAGS := -O0
13endif
14
15DEB_HOST_ARCH_OS := $(shell dpkg-architecture -qDEB_HOST_ARCH_OS 2>/dev/null)
16
17# Take account of old dpkg-architecture output.
18ifeq ($(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
23endif
24
25ifeq (,$(wildcard /usr/bin/po2debconf))
26PO2DEBCONF := no
27MINDEBCONFVER := 0.5
28else
29PO2DEBCONF := yes
30MINDEBCONFVER := 1.2.0
31endif
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.
39ifeq ($(DEB_BUILD_SSH_WOODY),)
40PAMSUBST := no
41PAMDEP := libpam-runtime (>= 0.76-14)
42else
43PAMSUBST := yes
44PAMDEP := libpam-runtime
45endif
46
47# The Hurd needs libcrypt for res_query et al.
48ifeq ($(DEB_HOST_ARCH_OS),hurd)
49FORCE_LIBS := LIBS=-lcrypt
50endif
51
52# SELinux support?
53ifeq ($(DEB_HOST_ARCH_OS),linux)
54SELINUX := --with-selinux
55endif
56
57# Change the version string to include the Debian version
58SSH_EXTRAVERSION := Debian-$(shell dpkg-parsechangelog | sed -n -e '/^Version:/s/Version: //p' | sed -e 's/[^-]*-//')
59
60build: build-deb build-udeb
61
62build-deb: build-deb-stamp
63build-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
68ifeq ($(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
71endif
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 -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
85build-udeb: build-udeb-stamp
86build-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 -std=gnu99 -DSSH_EXTRAVERSION="\" $(SSH_EXTRAVERSION)\""' ssh scp sftp sshd ssh-keygen
96 touch build-udeb-stamp
97
98clean:
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
104ifeq ($(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
114endif
115ifeq ($(PAMSUBST),yes)
116 if [ -f debian/ssh.pam.new-style ]; then \
117 mv debian/ssh.pam.new-style debian/ssh.pam; \
118 fi
119endif
120 rm -f debian/ssh-askpass-gnome.png
121 dh_clean
122
123install: DH_OPTIONS=-a
124install: 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# Build architecture-independent files here.
169binary-indep: binary-ssh
170
171# Build architecture-dependent files here.
172binary-arch: binary-openssh-client binary-openssh-server
173binary-arch: binary-ssh-askpass-gnome
174binary-arch: binary-openssh-client-udeb binary-openssh-server-udeb
175
176binary-openssh-client: DH_OPTIONS=-popenssh-client
177binary-openssh-client: build install
178 dh_testdir
179 dh_testroot
180 dh_installdebconf
181 dh_installdocs OVERVIEW README README.dns
182 cat debian/copyright.head LICENCE > debian/openssh-client/usr/share/doc/openssh-client/copyright
183 dh_installchangelogs ChangeLog
184 install -m644 debian/openssh-client.lintian debian/openssh-client/usr/share/lintian/overrides/openssh-client
185 dh_strip
186 dh_compress
187 dh_fixperms
188 chmod u+s debian/openssh-client/usr/lib/openssh/ssh-keysign
189 dh_installdeb
190 test ! -e debian/ssh/etc/ssh/ssh_prng_cmds \
191 || echo "/etc/ssh/ssh_prng_cmds" >> debian/openssh-client/DEBIAN/conffiles
192 dh_shlibdeps
193 dh_gencontrol -- -V'debconf-depends=debconf (>= $(MINDEBCONFVER)) | debconf-2.0'
194 dh_md5sums
195 dh_builddeb
196
197binary-openssh-server: DH_OPTIONS=-popenssh-server
198binary-openssh-server: build install
199 dh_testdir
200 dh_testroot
201ifeq ($(PO2DEBCONF),yes)
202 po2debconf -e utf8 debian/openssh-server.templates.master > debian/openssh-server.templates
203endif
204 dh_installdebconf
205 dh_installdocs
206 mv debian/openssh-server/usr/share/doc/openssh-server debian/openssh-server/usr/share/doc/openssh-client
207 rm -f debian/openssh-server/usr/share/doc/openssh-client/copyright
208ifeq ($(PAMSUBST),yes)
209 # Clean up if we've done this already, to ensure idempotency.
210 if [ -f debian/openssh-server.ssh.pam.new-style ]; then \
211 mv debian/openssh-server.ssh.pam.new-style debian/openssh-server.ssh.pam; \
212 fi
213 cp -a debian/openssh-server.ssh.pam debian/openssh-server.ssh.pam.new-style
214 sed -e "s/@include common-auth/auth required pam_unix.so/" \
215 -e "s/@include common-account/account required pam_unix.so/" \
216 -e "s/@include common-session/session required pam_unix.so/" \
217 -e "s/@include common-password/password required pam_unix.so/" \
218 debian/openssh-server.ssh.pam.new-style > debian/openssh-server.ssh.pam
219endif
220 dh_installpam --name ssh # TODO: breaks woody backports
221 dh_link
222 dh_strip
223 dh_compress
224 dh_fixperms
225 dh_installdeb
226 dh_shlibdeps
227 dh_gencontrol -- -V'debconf-depends=debconf (>= $(MINDEBCONFVER)) | debconf-2.0' \
228 -V'pam-depends=$(PAMDEP)'
229 dh_md5sums
230 dh_builddeb
231
232binary-ssh: DH_OPTIONS=-pssh
233binary-ssh: build install
234 dh_testdir
235 dh_testroot
236 dh_installdocs
237 mv debian/ssh/usr/share/doc/ssh debian/ssh/usr/share/doc/openssh-client
238 rm -f debian/ssh/usr/share/doc/openssh-client/copyright
239 dh_link
240 dh_compress
241 dh_fixperms
242 dh_installdeb
243 dh_gencontrol
244 dh_md5sums
245 dh_builddeb
246
247binary-ssh-askpass-gnome: DH_OPTIONS=-pssh-askpass-gnome
248binary-ssh-askpass-gnome: build install
249 dh_testdir
250 dh_testroot
251 dh_installdocs
252 dh_installexamples debian/ssh-askpass-gnome.desktop
253 dh_installchangelogs ChangeLog
254 dh_strip
255 dh_compress
256 dh_fixperms
257 dh_installdeb
258 dh_shlibdeps
259 dh_gencontrol
260 dh_md5sums
261 dh_builddeb
262
263binary-openssh-client-udeb: DH_OPTIONS=-popenssh-client-udeb
264binary-openssh-client-udeb: build install
265 dh_testdir
266 dh_testroot
267 dh_strip
268 dh_compress
269 dh_fixperms
270 dh_installdeb
271 install -p -o root -g root -m 755 debian/openssh-client-udeb.isinstallable debian/openssh-client-udeb/DEBIAN/isinstallable
272 dh_shlibdeps
273 dh_gencontrol
274 dh_md5sums
275 dh_builddeb
276
277binary-openssh-server-udeb: DH_OPTIONS=-popenssh-server-udeb
278binary-openssh-server-udeb: build install
279 dh_testdir
280 dh_testroot
281 dh_strip
282 dh_compress
283 dh_fixperms
284 dh_installdeb
285 dh_shlibdeps
286 dh_gencontrol
287 dh_md5sums
288 dh_builddeb
289
290binary: binary-indep binary-arch
291
292.PHONY: build clean binary-indep binary-arch binary install
293.PHONY: build-deb build-udeb
294.PHONY: binary-openssh-client binary-openssh-server binary-ssh
295.PHONY: binary-ssh-askpass-gnome
296.PHONY: binary-openssh-client-udeb binary-openssh-server-udeb