summaryrefslogtreecommitdiff
path: root/debian/rules
blob: 0a58b753bb14967d6a5ebc1efc2ff22fd0ff7eca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#!/usr/bin/make -f

# Uncomment this to turn on verbose mode.
# export DH_VERBOSE=1

# This is the debhelper compatability version to use.
export DH_COMPAT=1

# This has to be exported to make some magic below work.
export DH_OPTIONS

ifeq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
OPTFLAGS := -O2
else
OPTFLAGS := -O0
endif

#PKG_VER = $(shell perl -e 'print <> =~ /\((.*)\)/' debian/changelog)

ifeq (,$(wildcard /usr/bin/po2debconf))
PO2DEBCONF := no
MINDEBCONFVER := 0.5
else
PO2DEBCONF := yes
MINDEBCONFVER := 1.2.0
endif

build: build-stamp
build-stamp:
	dh_testdir
#Change the version string to include the Debian Version
	if <version.h sed -e "/define/s/\"\(.*\)\"/\"\1 Debian `dpkg-parsechangelog | sed -n -e '/^Version:/s/Version: //p'`\"/" >version.h.new; \
	then mv version.h version.h.upstream; mv version.h.new version.h; \
	else echo "Version number change failed"; exit 1; \
	fi
	./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=/bin:/usr/bin:/usr/local/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
	$(MAKE) -j 2 ASKPASS_PROGRAM='/usr/bin/ssh-askpass' CFLAGS='$(OPTFLAGS) -g -Wall -fno-builtin-log -DLOGIN_PROGRAM=\"/bin/login\" -DLOGIN_NO_ENDOPT -DSSHD_PAM_SERVICE=\"ssh\" -D__FILE_OFFSET_BITS=64 -DHAVE_MMAP_ANON_SHARED' \
		SSH_KEYSIGN='/usr/lib/ssh-keysign'
	# Support building on Debian 3.0 (with GNOME 1.4) and later.
	if [ -f /usr/include/libgnomeui-2.0/gnome.h ]; then \
		$(MAKE) -C contrib gnome-ssh-askpass2 CC='gcc $(OPTFLAGS) -g -Wall'; \
	elif [ -f /usr/include/gnome-1.0/gnome.h ]; then \
		$(MAKE) -C contrib gnome-ssh-askpass1 CC='gcc $(OPTFLAGS) -g -Wall'; \
	fi

	touch build-stamp

clean:
	dh_testdir
	rm -f build-stamp
	-$(MAKE) -i distclean
	-$(MAKE) -C contrib clean
	rm -f config.log
	if [ -f version.h.upstream ]; then mv version.h.upstream version.h; \
	fi
ifeq ($(PO2DEBCONF),yes)
	# Hack for woody compatibility. This makes sure that the
	# debian/templates file shipped in the source package doesn't
	# specify encodings, which woody's debconf can't handle. If building
	# on a system with po-debconf installed (conveniently debhelper (>=
	# 4.1.16) depends on it), the binary-arch target will generate a
	# better version for sarge.
	echo 1 > debian/po/output
	po2debconf debian/templates.master > debian/templates
	rm -f debian/po/output
endif
	dh_clean

install: DH_OPTIONS=
install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs

	# Add here commands to install the package into debian/tmp.
	$(MAKE) DESTDIR=`pwd`/debian/tmp install-nokeys

	rm -f debian/tmp/etc/ssh/sshd_config
	#Temporary hack: remove /usr/share/Ssh.bin, since we have no smartcard support anyway.
	rm -f debian/tmp/usr/share/Ssh.bin

	install -m 755 contrib/ssh-copy-id debian/tmp/usr/bin/ssh-copy-id
	install -m 644 -c contrib/ssh-copy-id.1 debian/tmp/usr/share/man/man1/ssh-copy-id.1
	install -m 644 debian/moduli.5 debian/tmp/usr/share/man/man5/moduli.5

	if [ -f contrib/gnome-ssh-askpass2 ]; then \
		install -s -o root -g root -m 755 contrib/gnome-ssh-askpass2 debian/ssh-askpass-gnome/usr/lib/ssh/gnome-ssh-askpass; \
	elif [ -f contrib/gnome-ssh-askpass1 ]; then \
		install -s -o root -g root -m 755 contrib/gnome-ssh-askpass1 debian/ssh-askpass-gnome/usr/lib/ssh/gnome-ssh-askpass; \
	fi
	install -m 644 debian/gnome-ssh-askpass.1 debian/ssh-askpass-gnome/usr/share/man/man1/gnome-ssh-askpass.1

	install -m 755 debian/ssh-argv0 debian/tmp/usr/bin/ssh-argv0
	install -m 644 debian/ssh-argv0.1 debian/tmp/usr/share/man/man1/ssh-argv0.1

	install -o root -g root debian/init debian/tmp/etc/init.d/ssh
	install -o root -g root -m 644 debian/ssh.default debian/tmp/etc/default/ssh

	install -o root -g root -m 755 -d debian/tmp/var/run/sshd

# Build architecture-independent files here.
binary-indep: build install
	# nothing to do

# Build architecture-dependent files here.
binary-arch: build install
	dh_testdir
	dh_testroot
ifeq ($(PO2DEBCONF),yes)
	po2debconf -e utf8 debian/templates.master > debian/templates
endif
	dh_installdebconf
	dh_installdocs OVERVIEW README
	cat debian/copyright.head LICENCE > debian/tmp/usr/share/doc/ssh/copyright
	nroff RFC.nroff > debian/tmp/usr/share/doc/ssh/RFC
	gzip -9 debian/tmp/usr/share/doc/ssh/RFC
	rm -rf debian/tmp/usr/share/doc/ssh/RFC.nroff.gz
	dh_installpam
	dh_installchangelogs ChangeLog
	dh_strip
	dh_compress
	dh_fixperms
	dh_installdeb
	test ! -e debian/tmp/etc/ssh/ssh_prng_cmds \
	  || echo "/etc/ssh/ssh_prng_cmds" >> debian/tmp/DEBIAN/conffiles
	dh_shlibdeps
	dh_gencontrol -- -V'debconf-depends=debconf (>= $(MINDEBCONFVER))'
	dh_md5sums
	dh_builddeb

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install