Преглед изворни кода

debian: Only use stackprotectorstrong when building with gcc >= 4.9

This allows to build the package on old systems, such as Debian wheezy.
Guillem Jover пре 11 година
родитељ
комит
0cf46b6e67
2 измењених фајлова са 7 додато и 0 уклоњено
  1. 1 0
      debian/changelog
  2. 6 0
      debian/rules

+ 1 - 0
debian/changelog

@@ -78,6 +78,7 @@ dpkg (1.18.0) UNRELEASED; urgency=low
   * Add ‘.mailmap’ to the default dpkg-source ignore lists.
   * Remove old trigger related Breaks and Conflicts from dpkg.
   * Set the SE Linux context on «dpkg-statoverride --update». Closes: #690361
+  * Only use stackprotectorstrong when building dpkg with gcc >= 4.9.
 
   [ Raphaël Hertzog ]
   * Drop myself from Uploaders.

+ 6 - 0
debian/rules

@@ -5,8 +5,14 @@
 
 WFLAGS := -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers
 
+# XXX: Stack Protector Strong is only available in gcc >= 4.9
+cc_version = $(shell $(CC) -dumpversion 2>/dev/null)
+cc_version_lt = $(shell dpkg --compare-versions "$(cc_version)" lt-nl "$(1)" && echo yes)
+hardening_old = DEB_BUILD_MAINT_OPTIONS="hardening=-stackprotectorstrong"
+
 # Use the in-tree dpkg-buildflags
 dpkg_buildflags = \
+	$(if $(call cc_version_lt,4.9),$(hardening_old)) \
 	DEB_CFLAGS_MAINT_APPEND="$(WFLAGS)" \
 	DEB_CXXFLAGS_MAINT_APPEND="$(WFLAGS)" \
 	$(CURDIR)/run-script perl $(CURDIR)/scripts/dpkg-buildflags.pl