Package: acpica-unix
Version: 20130927-1
Followup-For: Bug #696211
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu  ubuntu-patch

Hi Mattia, hi Al,

I've forward-ported this patch to the current version of acpica-unix in
unstable.  Could you please consider applying it?  Although the update to
debhelper 9 improved the hardening flags handling, there are still a few
gotchas that are addressed by this patch - in particular, the current
package gets built with the dpkg-buildflags CFLAGS, but not with CPPFLAGS
(so -D_FORTIFY_SOURCE=2 is missing), and the CFLAGS that are defined /in
debian/rules itself/ are missing because they're never handed off to the
upstream build system in the needed way.

Please note that this changes the handling of the -fno-strict-aliasing flag;
previously the package would apply this flag only if DEB_BUILD_OPTIONS=noopt
was not set.  That doesn't make sense to me, so I just changed it so the
flag was always on; but if there's a reason to continue disabling this flag
for noopt builds, I'm happy to rework the patch to reflect this.

Updated patch is attached - thanks for considering!

-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                    http://www.debian.org/
slanga...@ubuntu.com                                     vor...@debian.org
=== modified file 'debian/rules'
--- debian/rules	2013-10-08 17:01:36 +0000
+++ debian/rules	2013-10-20 20:56:03 +0000
@@ -9,15 +9,19 @@
 # Uncomment this to turn on verbose mode.
 export DH_VERBOSE=1
 
-CFLAGS = -Wall -g
+CFLAGS = $(shell dpkg-buildflags --get CFLAGS) $(shell dpkg-buildflags --get CPPFLAGS) -Wall -fno-strict-aliasing
+
 DESTDIR ?= debian/acpica-tools
 
 VERSION = 20130927
 
-ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
-	CFLAGS += -O0
+DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+
+ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
+	CC = $(DEB_HOST_GNU_TYPE)-gcc
 else
-	CFLAGS += -O2 -fno-strict-aliasing
+	CC = gcc
 endif
 
 
@@ -64,4 +68,9 @@
 	                $(DESTDIR)/usr/share/man/man1/acpixtract-acpica.1
 
 override_dh_auto_test:
-	$(MAKE) -C $(CURDIR) check
+ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
+	$(MAKE) -C $(CURDIR) check CC=$(CC) OPT_CFLAGS="$(CFLAGS)"
+endif
+
+override_dh_auto_build:
+	dh_auto_build -- OPT_CFLAGS="$(CFLAGS)" CC=$(CC)

Reply via email to