[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#613046: debian-policy: please update example in 4.9.1 (debian/rules and DEB_BUILD_OPTIONS)

user debian-policy@packages.debian.org
usertags 613046 + informative discussion


Julien Cristau wrote:
> On Sat, Feb 12, 2011 at 14:25:40 +0100, Niels Thykier wrote:

>> CFLAGS  = $(shell dpkg-buildflags --get CFLAGS) -Wall -g
>> While related to #578597, I believe it to be a distinct issue. This was triggered
>> by this email[2] on debian-mentors.
> Seems to be the exact same request to me?

I believe they are different.  This request seems to be about
informative text (an example), while #578597 is about the normative
part of policy (a policy "should").

Here's a rough patch for discussion's sake.  Points that might be nice
to fit in somehow:

 - warning flags come before the flags read from dpkg-buildflags,
   so they can be overridden with
   DEB_CFLAGS_APPEND="-Wno-all -Wno-extra"

 - important optimization flags such as -fno-strict-aliasing
   come after the flags read from dpkg-buildflags, so they cannot
   be overridden

 - using := instead of = saves us from running dpkg-buildflags
   multiple times if $(CFLAGS) is used more than once.

Thoughts?  Improvements?
diff --git a/policy.sgml b/policy.sgml
index 242ac10..5814960 100644
--- a/policy.sgml
+++ b/policy.sgml
@@ -2256,18 +2256,13 @@
 	    massage this example in order to make it work for your
 	    <example compact="compact">
-CFLAGS = -Wall -g
 INSTALL = install
 INSTALL_FILE    = $(INSTALL) -p    -o root -g root  -m  644
 INSTALL_PROGRAM = $(INSTALL) -p    -o root -g root  -m  755
 INSTALL_SCRIPT  = $(INSTALL) -p    -o root -g root  -m  755
 INSTALL_DIR     = $(INSTALL) -p -d -o root -g root  -m  755
-ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
-    CFLAGS += -O0
-    CFLAGS += -O2
+CFLAGS := -Wall $(shell dpkg-buildflags --get CFLAGS)
 ifeq (,$(filter nostrip,$(DEB_BUILD_OPTIONS)))

Reply to: