Package: dmidecode
Version: 2.11-4
Severity: important
Tags: patch

Please enabled hardened build flags through dpkg-buildflags.

Patch attached. I needed to make additional changes to the
Makefile, since otherwise the flags configured in debian/rules
are overridden.

(dpkg-buildflags abides "noopt" from DEB_BUILD_OPTIONS)

Cheers,
        Moritz
diff -aur dmidecode-2.11.harden/debian/rules dmidecode-2.11/debian/rules
--- dmidecode-2.11.harden/debian/rules	2011-10-28 21:53:58.000000000 +0200
+++ dmidecode-2.11/debian/rules	2012-01-14 17:04:08.000000000 +0100
@@ -1,6 +1,10 @@
 #!/usr/bin/make -f
 
 # Flags fetched from the upstream Makefile.
+
+CFLAGS = `dpkg-buildflags --get CFLAGS`
+CFLAGS += `dpkg-buildflags --get CPPFLAGS`
+
 CFLAGS +=	-W -Wall -pedantic -Wshadow -Wstrict-prototypes -Wpointer-arith \
 		-Wcast-qual -Wcast-align -Wwrite-strings -Wmissing-prototypes -Winline -Wundef
 
@@ -10,11 +14,13 @@
 # Dropped -ansi as it break building on ia64
 CFLAGS +=	-ansi
 
+LDFLAGS = `dpkg-buildflags --get LDFLAGS`
+
 %:
 	dh ${@}
 
 override_dh_auto_build:
-	dh_auto_build -- CFLAGS="$(CFLAGS)"
+	dh_auto_build -- CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)"
 
 override_dh_auto_install:
 	dh_auto_install -- prefix=/usr
diff -aur dmidecode-2.11.harden/Makefile dmidecode-2.11/Makefile
--- dmidecode-2.11.harden/Makefile	2012-01-14 16:57:02.000000000 +0100
+++ dmidecode-2.11/Makefile	2012-01-14 17:01:46.000000000 +0100
@@ -13,17 +13,17 @@
 #
 
 CC      = gcc
-CFLAGS  = -W -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual \
-          -Wcast-align -Wwrite-strings -Wmissing-prototypes -Winline -Wundef
+#CFLAGS  = -W -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual \
+#          -Wcast-align -Wwrite-strings -Wmissing-prototypes -Winline -Wundef
 #CFLAGS += -DBIGENDIAN
 #CFLAGS += -DALIGNMENT_WORKAROUND
 
 # When debugging, disable -O2 and enable -g.
-CFLAGS += -O2
+#CFLAGS += -O2
 #CFLAGS += -g
 
 # Pass linker flags here
-LDFLAGS =
+#LDFLAGS =
 
 DESTDIR =
 prefix  = /usr/local


Reply via email to