diff options
Diffstat (limited to 'debian/rules')
-rwxr-xr-x | debian/rules | 241 |
1 files changed, 241 insertions, 0 deletions
diff --git a/debian/rules b/debian/rules new file mode 100755 index 000000000..4960ad921 --- /dev/null +++ b/debian/rules | |||
@@ -0,0 +1,241 @@ | |||
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_VERSION := $(shell sed -e '/define/!d; s/.*\"\(.*\)\".*/\1/; q' <version.h) Debian $(shell dpkg-parsechangelog | sed -n -e '/^Version:/s/Version: //p') | ||
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 | # Some 2.2 kernels have trouble with setres[ug]id() (bug #239999). | ||
63 | perl -pi -e 's/.*#undef (BROKEN_SETRES[UG]ID).*/#define $$1 1/' build-deb/config.h | ||
64 | $(MAKE) -C build-deb -j 2 ASKPASS_PROGRAM='/usr/bin/ssh-askpass' CFLAGS='$(OPTFLAGS) -g -Wall -DLOGIN_PROGRAM=\"/bin/login\" -DLOGIN_NO_ENDOPT -DSSHD_PAM_SERVICE=\"ssh\" -DSSH_VERSION="\"$(SSH_VERSION)\""' SSH_KEYSIGN='/usr/lib/ssh-keysign' | ||
65 | # Support building on Debian 3.0 (with GNOME 1.4) and later. | ||
66 | if [ -f /usr/include/libgnomeui-2.0/gnome.h ]; then \ | ||
67 | $(MAKE) -C contrib gnome-ssh-askpass2 CC='gcc $(OPTFLAGS) -g -Wall'; \ | ||
68 | elif [ -f /usr/include/gnome-1.0/gnome.h ]; then \ | ||
69 | $(MAKE) -C contrib gnome-ssh-askpass1 CC='gcc $(OPTFLAGS) -g -Wall'; \ | ||
70 | fi | ||
71 | |||
72 | touch build-deb-stamp | ||
73 | |||
74 | build-udeb: build-udeb-stamp | ||
75 | build-udeb-stamp: | ||
76 | dh_testdir | ||
77 | mkdir -p build-udeb | ||
78 | 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 | ||
79 | # Avoid libnsl linkage. Ugh. | ||
80 | perl -pi -e 's/ +-lnsl//' build-udeb/config.status | ||
81 | cd build-udeb && ./config.status | ||
82 | $(MAKE) -C build-udeb -j 2 ASKPASS_PROGRAM='/usr/bin/ssh-askpass' CFLAGS='-Os -g -Wall -DSSH_VERSION="\"$(SSH_VERSION)\""' SSH_KEYSIGN='/usr/lib/ssh-keysign' ssh scp sftp sshd ssh-keygen | ||
83 | touch build-udeb-stamp | ||
84 | |||
85 | clean: | ||
86 | dh_testdir | ||
87 | rm -f build-deb-stamp build-udeb-stamp | ||
88 | rm -rf build-deb build-udeb | ||
89 | -$(MAKE) -C contrib clean | ||
90 | rm -f config.log | ||
91 | ifeq ($(PO2DEBCONF),yes) | ||
92 | # Hack for woody compatibility. This makes sure that the | ||
93 | # debian/templates file shipped in the source package doesn't | ||
94 | # specify encodings, which woody's debconf can't handle. If building | ||
95 | # on a system with po-debconf installed (conveniently debhelper (>= | ||
96 | # 4.1.16) depends on it), the binary-arch target will generate a | ||
97 | # better version for sarge. | ||
98 | echo 1 > debian/po/output | ||
99 | po2debconf debian/templates.master > debian/templates | ||
100 | rm -f debian/po/output | ||
101 | endif | ||
102 | ifeq ($(PAMSUBST),yes) | ||
103 | if [ -f debian/ssh.pam.new-style ]; then \ | ||
104 | mv debian/ssh.pam.new-style debian/ssh.pam; \ | ||
105 | fi | ||
106 | endif | ||
107 | rm -f debian/ssh-askpass-gnome.png | ||
108 | dh_clean | ||
109 | |||
110 | install: DH_OPTIONS=-a | ||
111 | install: build | ||
112 | dh_testdir | ||
113 | dh_testroot | ||
114 | dh_clean -k | ||
115 | dh_installdirs | ||
116 | |||
117 | # Add here commands to install the package into debian/ssh. | ||
118 | $(MAKE) -C build-deb DESTDIR=`pwd`/debian/ssh install-nokeys | ||
119 | |||
120 | rm -f debian/ssh/etc/ssh/sshd_config | ||
121 | #Temporary hack: remove /usr/share/Ssh.bin, since we have no smartcard support anyway. | ||
122 | rm -f debian/ssh/usr/share/Ssh.bin | ||
123 | |||
124 | install -m 755 contrib/ssh-copy-id debian/ssh/usr/bin/ssh-copy-id | ||
125 | install -m 644 -c contrib/ssh-copy-id.1 debian/ssh/usr/share/man/man1/ssh-copy-id.1 | ||
126 | install -m 644 debian/moduli.5 debian/ssh/usr/share/man/man5/moduli.5 | ||
127 | |||
128 | if [ -f contrib/gnome-ssh-askpass2 ]; then \ | ||
129 | install -s -o root -g root -m 755 contrib/gnome-ssh-askpass2 debian/ssh-askpass-gnome/usr/lib/ssh/gnome-ssh-askpass; \ | ||
130 | elif [ -f contrib/gnome-ssh-askpass1 ]; then \ | ||
131 | install -s -o root -g root -m 755 contrib/gnome-ssh-askpass1 debian/ssh-askpass-gnome/usr/lib/ssh/gnome-ssh-askpass; \ | ||
132 | fi | ||
133 | install -m 644 debian/gnome-ssh-askpass.1 debian/ssh-askpass-gnome/usr/share/man/man1/gnome-ssh-askpass.1 | ||
134 | install -m 644 debian/ssh-askpass-gnome.desktop debian/ssh-askpass-gnome/usr/share/applications/ssh-askpass-gnome.desktop | ||
135 | uudecode -o debian/ssh-askpass-gnome/usr/share/pixmaps/ssh-askpass-gnome.png debian/ssh-askpass-gnome.png.uue | ||
136 | |||
137 | install -m 755 debian/ssh-argv0 debian/ssh/usr/bin/ssh-argv0 | ||
138 | install -m 644 debian/ssh-argv0.1 debian/ssh/usr/share/man/man1/ssh-argv0.1 | ||
139 | |||
140 | install -o root -g root debian/init debian/ssh/etc/init.d/ssh | ||
141 | install -o root -g root -m 644 debian/ssh.default debian/ssh/etc/default/ssh | ||
142 | |||
143 | install -o root -g root -m 755 -d debian/ssh/var/run/sshd | ||
144 | |||
145 | install -m 755 build-udeb/ssh debian/openssh-client-udeb/usr/bin/ssh | ||
146 | install -m 755 build-udeb/scp debian/openssh-client-udeb/usr/bin/scp | ||
147 | install -m 755 build-udeb/sftp debian/openssh-client-udeb/usr/bin/sftp | ||
148 | install -m 755 build-udeb/sshd debian/openssh-server-udeb/usr/sbin/sshd | ||
149 | install -m 755 build-udeb/ssh-keygen debian/openssh-server-udeb/usr/bin/ssh-keygen | ||
150 | |||
151 | # Build architecture-independent files here. | ||
152 | binary-indep: build install | ||
153 | # nothing to do | ||
154 | |||
155 | # Build architecture-dependent files here. | ||
156 | binary-arch: binary-ssh binary-ssh-askpass-gnome | ||
157 | binary-arch: binary-openssh-client-udeb binary-openssh-server-udeb | ||
158 | |||
159 | binary-ssh: DH_OPTIONS=-pssh | ||
160 | binary-ssh: build install | ||
161 | dh_testdir | ||
162 | dh_testroot | ||
163 | ifeq ($(PO2DEBCONF),yes) | ||
164 | po2debconf -e utf8 debian/templates.master > debian/templates | ||
165 | endif | ||
166 | dh_installdebconf | ||
167 | dh_installdocs OVERVIEW README | ||
168 | cat debian/copyright.head LICENCE > debian/ssh/usr/share/doc/ssh/copyright | ||
169 | ifeq ($(PAMSUBST),yes) | ||
170 | # Clean up if we've done this already, to ensure idempotency. | ||
171 | if [ -f debian/ssh.pam.new-style ]; then \ | ||
172 | mv debian/ssh.pam.new-style debian/ssh.pam; \ | ||
173 | fi | ||
174 | cp -a debian/ssh.pam debian/ssh.pam.new-style | ||
175 | sed -e "s/@include common-auth/auth required pam_unix.so/" \ | ||
176 | -e "s/@include common-account/account required pam_unix.so/" \ | ||
177 | -e "s/@include common-session/session required pam_unix.so/" \ | ||
178 | -e "s/@include common-password/password required pam_unix.so/" \ | ||
179 | debian/ssh.pam.new-style > debian/ssh.pam | ||
180 | endif | ||
181 | dh_installpam | ||
182 | dh_installchangelogs ChangeLog | ||
183 | dh_strip | ||
184 | dh_compress | ||
185 | dh_fixperms | ||
186 | dh_installdeb | ||
187 | test ! -e debian/ssh/etc/ssh/ssh_prng_cmds \ | ||
188 | || echo "/etc/ssh/ssh_prng_cmds" >> debian/ssh/DEBIAN/conffiles | ||
189 | dh_shlibdeps | ||
190 | dh_gencontrol -- -V'debconf-depends=debconf (>= $(MINDEBCONFVER))' \ | ||
191 | -V'pam-depends=$(PAMDEP)' | ||
192 | dh_md5sums | ||
193 | dh_builddeb | ||
194 | |||
195 | binary-ssh-askpass-gnome: DH_OPTIONS=-pssh-askpass-gnome | ||
196 | binary-ssh-askpass-gnome: build install | ||
197 | dh_testdir | ||
198 | dh_testroot | ||
199 | dh_installdocs | ||
200 | dh_installchangelogs ChangeLog | ||
201 | dh_strip | ||
202 | dh_compress | ||
203 | dh_fixperms | ||
204 | dh_installdeb | ||
205 | dh_shlibdeps | ||
206 | dh_gencontrol | ||
207 | dh_md5sums | ||
208 | dh_builddeb | ||
209 | |||
210 | binary-openssh-client-udeb: DH_OPTIONS=-popenssh-client-udeb | ||
211 | binary-openssh-client-udeb: build install | ||
212 | dh_testdir | ||
213 | dh_testroot | ||
214 | dh_strip | ||
215 | dh_compress | ||
216 | dh_fixperms | ||
217 | dh_installdeb | ||
218 | install -p -o root -g root -m 755 debian/openssh-client-udeb.isinstallable debian/openssh-client-udeb/DEBIAN/isinstallable | ||
219 | dh_shlibdeps | ||
220 | dh_gencontrol -- -fdebian/files~ | ||
221 | dpkg-distaddfile $(CLIENT_UDEB) debian-installer optional | ||
222 | dh_builddeb --filename=$(CLIENT_UDEB) | ||
223 | |||
224 | binary-openssh-server-udeb: DH_OPTIONS=-popenssh-server-udeb | ||
225 | binary-openssh-server-udeb: build install | ||
226 | dh_testdir | ||
227 | dh_testroot | ||
228 | dh_strip | ||
229 | dh_compress | ||
230 | dh_fixperms | ||
231 | dh_installdeb | ||
232 | dh_shlibdeps | ||
233 | dh_gencontrol -- -fdebian/files~ | ||
234 | dpkg-distaddfile $(SERVER_UDEB) debian-installer optional | ||
235 | dh_builddeb --filename=$(SERVER_UDEB) | ||
236 | |||
237 | binary: binary-indep binary-arch | ||
238 | |||
239 | .PHONY: build clean binary-indep binary-arch binary install | ||
240 | .PHONY: build-deb build-udeb binary-ssh binary-ssh-askpass-gnome | ||
241 | .PHONY: binary-openssh-client-udeb binary-openssh-server-udeb | ||