summaryrefslogtreecommitdiff
path: root/debian/rules
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2012-04-01 00:49:25 +0100
committerColin Watson <cjwatson@debian.org>2012-04-01 00:49:25 +0100
commitb4fcc0dd1f8ca61369332f4b9e8f1a718ea3e277 (patch)
treebe37497ce8f9964027b3622ddcf1f4fbb4368cf6 /debian/rules
parent067fd0ecd61293e0bbf7596d1a3ed0aa91528c8f (diff)
Use dpkg-buildflags, including for hardening support; drop use of
hardening-includes.
Diffstat (limited to 'debian/rules')
-rwxr-xr-xdebian/rules31
1 files changed, 5 insertions, 26 deletions
diff --git a/debian/rules b/debian/rules
index ce56fdea4..0200d48d7 100755
--- a/debian/rules
+++ b/debian/rules
@@ -3,17 +3,9 @@
3# Uncomment this to turn on verbose mode. 3# Uncomment this to turn on verbose mode.
4# export DH_VERBOSE=1 4# export DH_VERBOSE=1
5 5
6include /usr/share/hardening-includes/hardening.make
7
8# This has to be exported to make some magic below work. 6# This has to be exported to make some magic below work.
9export DH_OPTIONS 7export DH_OPTIONS
10 8
11ifeq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
12OPTFLAGS := -O2
13else
14OPTFLAGS := -O0
15endif
16
17ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) 9ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
18 RUN_TESTS := yes 10 RUN_TESTS := yes
19else 11else
@@ -31,7 +23,6 @@ else
31endif 23endif
32 24
33DEB_HOST_ARCH_OS := $(shell dpkg-architecture -qDEB_HOST_ARCH_OS 2>/dev/null) 25DEB_HOST_ARCH_OS := $(shell dpkg-architecture -qDEB_HOST_ARCH_OS 2>/dev/null)
34DEB_HOST_ARCH_CPU := $(shell dpkg-architecture -qDEB_HOST_ARCH_CPU 2>/dev/null)
35 26
36# Take account of old dpkg-architecture output. 27# Take account of old dpkg-architecture output.
37ifeq ($(DEB_HOST_ARCH_OS),) 28ifeq ($(DEB_HOST_ARCH_OS),)
@@ -40,20 +31,6 @@ ifeq ($(DEB_HOST_ARCH_OS),)
40 DEB_HOST_ARCH_OS := hurd 31 DEB_HOST_ARCH_OS := hurd
41 endif 32 endif
42endif 33endif
43ifeq ($(DEB_HOST_ARCH_CPU),)
44 DEB_HOST_ARCH_CPU := $(shell dpkg-architecture -qDEB_HOST_GNU_CPU)
45 ifeq ($(DEB_HOST_ARCH_CPU),x86_64)
46 DEB_HOST_ARCH_CPU := amd64
47 endif
48endif
49
50ifneq (,$(findstring :$(DEB_HOST_ARCH_OS):,:linux:knetbsd:))
51 ifneq (,$(findstring :$(DEB_HOST_ARCH_CPU):,:mips:mipsel:))
52 # Apparently this is not implied by -fPIE, at least on the mipsen.
53 PIC_CFLAGS := -fPIC
54 PIC_LDFLAGS := -fPIC
55 endif
56endif
57 34
58# Change the version string to include the Debian version 35# Change the version string to include the Debian version
59SSH_EXTRAVERSION := Debian-$(shell dpkg-parsechangelog | sed -n -e '/^Version:/s/Version: //p' | sed -e 's/[^-]*-//') 36SSH_EXTRAVERSION := Debian-$(shell dpkg-parsechangelog | sed -n -e '/^Version:/s/Version: //p' | sed -e 's/[^-]*-//')
@@ -108,7 +85,9 @@ confflags += --with-default-path=$(DEFAULT_PATH) --with-superuser-path=$(SUPERUS
108confflags_udeb += --with-default-path=/usr/local/bin:/usr/bin:/bin --with-superuser-path=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin 85confflags_udeb += --with-default-path=/usr/local/bin:/usr/bin:/bin --with-superuser-path=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
109 86
110# Compiler flags. 87# Compiler flags.
111cflags := $(OPTFLAGS) $(PIC_CFLAGS) $(HARDENING_CFLAGS) 88export DEB_BUILD_MAINT_OPTIONS := hardening=+all
89default_cflags := $(shell dpkg-buildflags --get CPPFLAGS) $(shell dpkg-buildflags --get CFLAGS)
90cflags := $(default_cflags)
112cflags += -DLOGIN_PROGRAM=\"/bin/login\" -DLOGIN_NO_ENDOPT 91cflags += -DLOGIN_PROGRAM=\"/bin/login\" -DLOGIN_NO_ENDOPT
113cflags += -DSSH_EXTRAVERSION=\"$(SSH_EXTRAVERSION)\" 92cflags += -DSSH_EXTRAVERSION=\"$(SSH_EXTRAVERSION)\"
114cflags_udeb := -Os 93cflags_udeb := -Os
@@ -117,7 +96,7 @@ confflags += --with-cflags='$(cflags)'
117confflags_udeb += --with-cflags='$(cflags_udeb)' 96confflags_udeb += --with-cflags='$(cflags_udeb)'
118 97
119# Linker flags. 98# Linker flags.
120confflags += --with-ldflags='$(strip -Wl,--as-needed $(PIC_LDFLAGS) $(HARDENING_LDFLAGS))' 99confflags += --with-ldflags='$(strip -Wl,--as-needed $(shell dpkg-buildflags --get LDFLAGS))'
121confflags_udeb += --with-ldflags='-Wl,--as-needed' 100confflags_udeb += --with-ldflags='-Wl,--as-needed'
122 101
123%: 102%:
@@ -139,7 +118,7 @@ override_dh_auto_build:
139 $(MAKE) -C build-deb -j 2 ASKPASS_PROGRAM='/usr/bin/ssh-askpass' 118 $(MAKE) -C build-deb -j 2 ASKPASS_PROGRAM='/usr/bin/ssh-askpass'
140 $(MAKE) -C build-udeb -j 2 ASKPASS_PROGRAM='/usr/bin/ssh-askpass' ssh scp sftp sshd ssh-keygen 119 $(MAKE) -C build-udeb -j 2 ASKPASS_PROGRAM='/usr/bin/ssh-askpass' ssh scp sftp sshd ssh-keygen
141 120
142 $(MAKE) -C contrib gnome-ssh-askpass2 CC='$(CC) $(OPTFLAGS) -g -Wall -Wl,--as-needed' 121 $(MAKE) -C contrib gnome-ssh-askpass2 CC='$(CC) $(default_cflags) -Wall -Wl,--as-needed'
143 122
144override_dh_auto_test: 123override_dh_auto_test:
145ifeq ($(RUN_TESTS),yes) 124ifeq ($(RUN_TESTS),yes)