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

From: Charles Plessy <[email-masked]>
Date: Wed, 1 Feb 2012 09:37:20 +0900

Le Fri, Jan 27, 2012 at 01:28:02PM +0100, Matthijs Kooijman a écrit :

> > +CFLAGS := -Wall $(shell dpkg-buildflags --get CFLAGS)
> >  ifeq (,$(filter nostrip,$(DEB_BUILD_OPTIONS)))
> >      INSTALL_PROGRAM += -s
> >  endif
> 
> Wouldn't it be more appropriate to use
> 
>     DEB_CFLAGS_MAINT_PREPEND := -Wall

Hello everybody,

since §4.9.1's object is to document the DEB_BUILD_OPTIONS, I would find it a
bit dry to only provide an example that works through a tool that is not
mentionned or explained anywhere else in the Policy (see http://bugs.debian.org/578597).
I therfore propose to replace the sentence above it,

  The following makefile snippet is an example of how one may implement the
  build options; you will probably have to massage this example in order to make
  it work for your package.

by:

  In the following example, the build options nocheck, nostrip and parallel are
  implemented directly in make, and noopt is implemented through its support in
  dpkg-buildflags.  You will probably have to massage this example in order to
  make it work for your package.  Note also that other helper tools provide
  support for nocheck, nostrip and parallel.

Alternatively, the example could be repaired as proposed in the original,
message or ‘CFLAGS = -Wall -g’ could be simply removed (it is already
recommended somewhere lese), and a mention of dpkg-buildflag's support for
nooopt could be inserted as part of #578597.  This would be in line with the
other parts of the Policy and of this example, that focus on the action to
take, not on the helper to use.

By the way, I read in the paragraph describing noopt:

  For C programs, it is best to add -O0 to CFLAGS (although this is usually the default).

Isn't that a bit outdated ?  I see -O2 or superior in most of my packages.

Have a nice day, 

-- 
Charles Plessy
Tsurumi, Kanagawa, Japan