summaryrefslogtreecommitdiff
path: root/debian/rules
diff options
context:
space:
mode:
Diffstat (limited to 'debian/rules')
-rwxr-xr-xdebian/rules162
1 files changed, 162 insertions, 0 deletions
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 000000000..54fb4eed9
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,162 @@
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 compatability version to use.
7export DH_COMPAT=1
8
9# This has to be exported to make some magic below work.
10export DH_OPTIONS
11
12ifeq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
13OPTFLAGS := -O2
14else
15OPTFLAGS := -O0
16endif
17
18#PKG_VER = $(shell perl -e 'print <> =~ /\((.*)\)/' debian/changelog)
19
20ifeq (,$(wildcard /usr/bin/po2debconf))
21PO2DEBCONF := no
22MINDEBCONFVER := 0.5
23else
24PO2DEBCONF := yes
25MINDEBCONFVER := 1.2.0
26endif
27
28# We need a new libpam-runtime for sane PAM handling
29# (http://lists.debian.org/debian-devel-announce-0308/msg00012.html).
30# Unfortunately it's hard to detect during the build whether this is
31# appropriate, so woody-compatibility is a pain. I've had to punt and go for
32# a DEB_BUILD_SSH_WOODY environment variable. We can remove this hack once
33# we no longer care about woody.
34ifeq ($(DEB_BUILD_SSH_WOODY),)
35PAMSUBST := no
36PAMDEP := libpam-runtime (>= 0.76-14)
37else
38PAMSUBST := yes
39PAMDEP := libpam-runtime
40endif
41
42# Change the version string to include the Debian version
43SSH_VERSION := $(shell sed -e '/define/!d; s/.*\"\(.*\)\".*/\1/; q' <version.h) Debian $(shell dpkg-parsechangelog | sed -n -e '/^Version:/s/Version: //p')
44
45build: build-stamp
46build-stamp:
47 dh_testdir
48 ./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 \
49 --with-privsep-path=/var/run/sshd --without-rand-helper
50 $(MAKE) -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)\""' \
51 SSH_KEYSIGN='/usr/lib/ssh-keysign'
52 # Support building on Debian 3.0 (with GNOME 1.4) and later.
53 if [ -f /usr/include/libgnomeui-2.0/gnome.h ]; then \
54 $(MAKE) -C contrib gnome-ssh-askpass2 CC='gcc $(OPTFLAGS) -g -Wall'; \
55 elif [ -f /usr/include/gnome-1.0/gnome.h ]; then \
56 $(MAKE) -C contrib gnome-ssh-askpass1 CC='gcc $(OPTFLAGS) -g -Wall'; \
57 fi
58
59 touch build-stamp
60
61clean:
62 dh_testdir
63 rm -f build-stamp
64 -$(MAKE) -i distclean
65 -$(MAKE) -C contrib clean
66 rm -f config.log
67ifeq ($(PO2DEBCONF),yes)
68 # Hack for woody compatibility. This makes sure that the
69 # debian/templates file shipped in the source package doesn't
70 # specify encodings, which woody's debconf can't handle. If building
71 # on a system with po-debconf installed (conveniently debhelper (>=
72 # 4.1.16) depends on it), the binary-arch target will generate a
73 # better version for sarge.
74 echo 1 > debian/po/output
75 po2debconf debian/templates.master > debian/templates
76 rm -f debian/po/output
77endif
78ifeq ($(PAMSUBST),yes)
79 if [ -f debian/ssh.pam.new-style ]; then \
80 mv debian/ssh.pam.new-style debian/ssh.pam; \
81 fi
82endif
83 dh_clean
84
85install: DH_OPTIONS=
86install: build
87 dh_testdir
88 dh_testroot
89 dh_clean -k
90 dh_installdirs
91
92 # Add here commands to install the package into debian/tmp.
93 $(MAKE) DESTDIR=`pwd`/debian/tmp install-nokeys
94
95 rm -f debian/tmp/etc/ssh/sshd_config
96 #Temporary hack: remove /usr/share/Ssh.bin, since we have no smartcard support anyway.
97 rm -f debian/tmp/usr/share/Ssh.bin
98
99 install -m 755 contrib/ssh-copy-id debian/tmp/usr/bin/ssh-copy-id
100 install -m 644 -c contrib/ssh-copy-id.1 debian/tmp/usr/share/man/man1/ssh-copy-id.1
101 install -m 644 debian/moduli.5 debian/tmp/usr/share/man/man5/moduli.5
102
103 if [ -f contrib/gnome-ssh-askpass2 ]; then \
104 install -s -o root -g root -m 755 contrib/gnome-ssh-askpass2 debian/ssh-askpass-gnome/usr/lib/ssh/gnome-ssh-askpass; \
105 elif [ -f contrib/gnome-ssh-askpass1 ]; then \
106 install -s -o root -g root -m 755 contrib/gnome-ssh-askpass1 debian/ssh-askpass-gnome/usr/lib/ssh/gnome-ssh-askpass; \
107 fi
108 install -m 644 debian/gnome-ssh-askpass.1 debian/ssh-askpass-gnome/usr/share/man/man1/gnome-ssh-askpass.1
109
110 install -m 755 debian/ssh-argv0 debian/tmp/usr/bin/ssh-argv0
111 install -m 644 debian/ssh-argv0.1 debian/tmp/usr/share/man/man1/ssh-argv0.1
112
113 install -o root -g root debian/init debian/tmp/etc/init.d/ssh
114 install -o root -g root -m 644 debian/ssh.default debian/tmp/etc/default/ssh
115
116 install -o root -g root -m 755 -d debian/tmp/var/run/sshd
117
118# Build architecture-independent files here.
119binary-indep: build install
120 # nothing to do
121
122# Build architecture-dependent files here.
123binary-arch: build install
124 dh_testdir
125 dh_testroot
126ifeq ($(PO2DEBCONF),yes)
127 po2debconf -e utf8 debian/templates.master > debian/templates
128endif
129 dh_installdebconf
130 dh_installdocs OVERVIEW README
131 cat debian/copyright.head LICENCE > debian/tmp/usr/share/doc/ssh/copyright
132 nroff RFC.nroff > debian/tmp/usr/share/doc/ssh/RFC
133 gzip -9 debian/tmp/usr/share/doc/ssh/RFC
134 rm -rf debian/tmp/usr/share/doc/ssh/RFC.nroff.gz
135ifeq ($(PAMSUBST),yes)
136 # Clean up if we've done this already, to ensure idempotency.
137 if [ -f debian/ssh.pam.new-style ]; then \
138 mv debian/ssh.pam.new-style debian/ssh.pam; \
139 fi
140 cp -a debian/ssh.pam debian/ssh.pam.new-style
141 sed -e "s/@include common-auth/auth required pam_unix.so/" \
142 -e "s/@include common-account/account required pam_unix.so/" \
143 -e "s/@include common-session/session required pam_unix.so/" \
144 -e "s/@include common-password/password required pam_unix.so/" \
145 debian/ssh.pam.new-style > debian/ssh.pam
146endif
147 dh_installpam
148 dh_installchangelogs ChangeLog
149 dh_strip
150 dh_compress
151 dh_fixperms
152 dh_installdeb
153 test ! -e debian/tmp/etc/ssh/ssh_prng_cmds \
154 || echo "/etc/ssh/ssh_prng_cmds" >> debian/tmp/DEBIAN/conffiles
155 dh_shlibdeps
156 dh_gencontrol -- -V'debconf-depends=debconf (>= $(MINDEBCONFVER))' \
157 -V'pam-depends=$(PAMDEP)'
158 dh_md5sums
159 dh_builddeb
160
161binary: binary-indep binary-arch
162.PHONY: build clean binary-indep binary-arch binary install