Package: debhelper
Version: 9.20120523
Severity: wishlist

The attached test project demonstrates a lack in dh_auto_build for Makefile
projects: the Debian-specified build flags are not necessarily communicated to
the compiler.  Debhelper should override CPPFLAGS and CFLAGS on the make
command line.

It is, I think, quite common for Makefile projects to define defaults for
CFLAGS and sometimes even CPPFLAGS in their Makefiles.  However, this means
that the corresponding environment variables (which debhelper sets) are
ignored.  The correct way to override Makefile-specified defaults is to
pass the variables on the make command line.  Compare:

$ make CFLAGS="`dpkg-buildflags --get CFLAGS`"
gcc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat 
-Werror=format-security   -c -o testhello.o testhello.c
gcc   testhello.o   -o testhello

to

$ make 
gcc -g   -c -o testhello.o testhello.c
gcc   testhello.o   -o testhello

(Both in the test project's toplevel directory.)

The current debhelper manner of passing CFLAGS is ignored by such projects:

$ DH_VERBOSE=1 debian/rules build
dh build
   dh_testdir
   dh_auto_configure
   dh_auto_build
        make -j1
make[1]: Siirrytään hakemistoon "/home/ajk/scratch/testhello-0.1"
gcc -g -D_FORTIFY_SOURCE=2  -c -o testhello.o testhello.c
gcc -Wl,-z,relro  testhello.o   -o testhello
make[1]: Poistutaan hakemistosta "/home/ajk/scratch/testhello-0.1"
   dh_auto_test

Notice how CPPFLAGS and LDFLAGS are honored but CFLAGS is ignored.

This currently affects dctrl-tools, but I'm going to work around the problem
in my next upload.

-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable'), (1, 
'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 3.4.0-ibid-1 (SMP w/2 CPU cores; PREEMPT)
Locale: LANG=fi_FI.UTF-8, LC_CTYPE=fi_FI.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages debhelper depends on:
ii  binutils    2.22-6.1
ii  dpkg        1.16.3
ii  dpkg-dev    1.16.3
ii  file        5.11-1
ii  html2text   1.3.2a-15
ii  man-db      2.6.1-2
ii  perl        5.14.2-11
ii  po-debconf  1.0.16+nmu2

debhelper recommends no packages.

Versions of packages debhelper suggests:
pn  dh-make  <none>

-- no debconf information

Attachment: testhello_0.1.tar.gz
Description: GNU Zip compressed data

Format: 3.0 (native)
Source: testhello
Binary: testhello
Architecture: any
Version: 0.1
Maintainer: Antti-Juhani Kaijanaho <a...@debian.org>
Standards-Version: 3.9.3
Build-Depends: debhelper (>= 9)
Package-List: 
 testhello deb utils optional
Checksums-Sha1: 
 b9420cb51ab314040717612097281b2a37b94ad4 1203 testhello_0.1.tar.gz
Checksums-Sha256: 
 51ba8af423824afdcb73f48eb52903459720f513ef28e67d115f4772471016f6 1203 
testhello_0.1.tar.gz
Files: 
 e265f010979c7b0acabd767eb10adb58 1203 testhello_0.1.tar.gz

Reply via email to