summaryrefslogtreecommitdiff
path: root/debian/rules
diff options
context:
space:
mode:
Diffstat (limited to 'debian/rules')
-rwxr-xr-xdebian/rules160
1 files changed, 160 insertions, 0 deletions
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 000000000..0575bfc94
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,160 @@
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-deb-stamp
46build-deb-stamp:
47 dh_testdir
48 mkdir -p build-deb
49 cd build-deb && ../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
50 # Some 2.2 kernels have trouble with setres[ug]id() (bug #239999).
51 perl -pi -e 's/.*#undef (BROKEN_SETRES[UG]ID).*/#define $$1 1/' build-deb/config.h
52 $(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'
53 # Support building on Debian 3.0 (with GNOME 1.4) and later.
54 if [ -f /usr/include/libgnomeui-2.0/gnome.h ]; then \
55 $(MAKE) -C contrib gnome-ssh-askpass2 CC='gcc $(OPTFLAGS) -g -Wall'; \
56 elif [ -f /usr/include/gnome-1.0/gnome.h ]; then \
57 $(MAKE) -C contrib gnome-ssh-askpass1 CC='gcc $(OPTFLAGS) -g -Wall'; \
58 fi
59
60 touch build-deb-stamp
61
62clean:
63 dh_testdir
64 rm -f build-deb-stamp
65 rm -rf build-deb
66 -$(MAKE) -C contrib clean
67 rm -f config.log
68ifeq ($(PO2DEBCONF),yes)
69 # Hack for woody compatibility. This makes sure that the
70 # debian/templates file shipped in the source package doesn't
71 # specify encodings, which woody's debconf can't handle. If building
72 # on a system with po-debconf installed (conveniently debhelper (>=
73 # 4.1.16) depends on it), the binary-arch target will generate a
74 # better version for sarge.
75 echo 1 > debian/po/output
76 po2debconf debian/templates.master > debian/templates
77 rm -f debian/po/output
78endif
79ifeq ($(PAMSUBST),yes)
80 if [ -f debian/ssh.pam.new-style ]; then \
81 mv debian/ssh.pam.new-style debian/ssh.pam; \
82 fi
83endif
84 dh_clean
85
86install: DH_OPTIONS=
87install: build
88 dh_testdir
89 dh_testroot
90 dh_clean -k
91 dh_installdirs
92
93 # Add here commands to install the package into debian/tmp.
94 $(MAKE) -C build-deb DESTDIR=`pwd`/debian/tmp install-nokeys
95
96 rm -f debian/tmp/etc/ssh/sshd_config
97 #Temporary hack: remove /usr/share/Ssh.bin, since we have no smartcard support anyway.
98 rm -f debian/tmp/usr/share/Ssh.bin
99
100 install -m 755 contrib/ssh-copy-id debian/tmp/usr/bin/ssh-copy-id
101 install -m 644 -c contrib/ssh-copy-id.1 debian/tmp/usr/share/man/man1/ssh-copy-id.1
102 install -m 644 debian/moduli.5 debian/tmp/usr/share/man/man5/moduli.5
103
104 if [ -f contrib/gnome-ssh-askpass2 ]; then \
105 install -s -o root -g root -m 755 contrib/gnome-ssh-askpass2 debian/ssh-askpass-gnome/usr/lib/ssh/gnome-ssh-askpass; \
106 elif [ -f contrib/gnome-ssh-askpass1 ]; then \
107 install -s -o root -g root -m 755 contrib/gnome-ssh-askpass1 debian/ssh-askpass-gnome/usr/lib/ssh/gnome-ssh-askpass; \
108 fi
109 install -m 644 debian/gnome-ssh-askpass.1 debian/ssh-askpass-gnome/usr/share/man/man1/gnome-ssh-askpass.1
110
111 install -m 755 debian/ssh-argv0 debian/tmp/usr/bin/ssh-argv0
112 install -m 644 debian/ssh-argv0.1 debian/tmp/usr/share/man/man1/ssh-argv0.1
113
114 install -o root -g root debian/init debian/tmp/etc/init.d/ssh
115 install -o root -g root -m 644 debian/ssh.default debian/tmp/etc/default/ssh
116
117 install -o root -g root -m 755 -d debian/tmp/var/run/sshd
118
119# Build architecture-independent files here.
120binary-indep: build install
121 # nothing to do
122
123# Build architecture-dependent files here.
124binary-arch: build install
125 dh_testdir
126 dh_testroot
127ifeq ($(PO2DEBCONF),yes)
128 po2debconf -e utf8 debian/templates.master > debian/templates
129endif
130 dh_installdebconf
131 dh_installdocs OVERVIEW README
132 cat debian/copyright.head LICENCE > debian/tmp/usr/share/doc/ssh/copyright
133ifeq ($(PAMSUBST),yes)
134 # Clean up if we've done this already, to ensure idempotency.
135 if [ -f debian/ssh.pam.new-style ]; then \
136 mv debian/ssh.pam.new-style debian/ssh.pam; \
137 fi
138 cp -a debian/ssh.pam debian/ssh.pam.new-style
139 sed -e "s/@include common-auth/auth required pam_unix.so/" \
140 -e "s/@include common-account/account required pam_unix.so/" \
141 -e "s/@include common-session/session required pam_unix.so/" \
142 -e "s/@include common-password/password required pam_unix.so/" \
143 debian/ssh.pam.new-style > debian/ssh.pam
144endif
145 dh_installpam
146 dh_installchangelogs ChangeLog
147 dh_strip
148 dh_compress
149 dh_fixperms
150 dh_installdeb
151 test ! -e debian/tmp/etc/ssh/ssh_prng_cmds \
152 || echo "/etc/ssh/ssh_prng_cmds" >> debian/tmp/DEBIAN/conffiles
153 dh_shlibdeps
154 dh_gencontrol -- -V'debconf-depends=debconf (>= $(MINDEBCONFVER))' \
155 -V'pam-depends=$(PAMDEP)'
156 dh_md5sums
157 dh_builddeb
158
159binary: binary-indep binary-arch
160.PHONY: build clean binary-indep binary-arch binary install