Package: debhelper
Version: 10.2.5
Severity: normal

Dear Maintainer,

   * What led up to the situation?

     I've written simple debian/rules and added some conditional CFLAGS+=
     statements. After I ran dpkg-buildpackage I found the flags were not
     in place.

   * What exactly did you do (or not do) that was effective (or
     ineffective)?

     I've written debian/rules file, ran dpkg-buildpackage two times:
     1) dpkg-buildpackage -b
     2) DEB_BUILD_OPTIONS=debug dpkg-buildpackage -b

   * What was the outcome of this action?

     CFLAGS value of Makefile was the same for both cases, so the
     package was built without CFLAGS pointed by debian/rules file.

   * What outcome did you expect instead?

     Makefile's CFLAGS value should honor the value from debian/rules

The contents of debian/rules:
#!/usr/bin/make -f
%:
        dh $@

ifeq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
CFLAGS += -DG_DEBUG_DISABLE
else
CFLAGS += -O0
endif

To resolve the issue, I've written another debian/rules, which works
fine. Its contents:
#!/usr/bin/make -f
%:
        dh $@

override_dh_auto_configure:
        dh_auto_configure

ifeq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
CFLAGS += -DG_DEBUG_DISABLE
else
CFLAGS += -O0
endif

I'm not sure why, but with this override_dh_auto_configure it works.
It's probably needed to document this behaviour or fix it shomehow.

-- System Information:
Debian Release: 9.8
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.9.0-8-amd64 (SMP w/4 CPU cores)
Locale: LANG=ru_RU.utf8, LC_CTYPE=ru_RU.utf8 (charmap=UTF-8), LANGUAGE=ru_RU:ru (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages debhelper depends on:
ii  autotools-dev            20161112.1
ii  binutils                 2.28-5
ii  dh-autoreconf            14
ii  dh-strip-nondeterminism  0.034-1
ii  dpkg                     1.18.25
ii  dpkg-dev                 1.18.25
ii  file                     1:5.30-1+deb9u2
ii  libdpkg-perl             1.18.25
ii  man-db                   2.7.6.1-2
ii  perl                     5.24.1-3+deb9u5
ii  po-debconf               1.0.20

debhelper recommends no packages.

Versions of packages debhelper suggests:
ii  dh-make  2.201608

-- no debconf information

Reply via email to