I've been bashing on dhcp3
just a bit
lately. The current thing I'm working on is bringing the Standards-Version
up to the present day. Using the upgrading checklist that comes with debian-policy (which is mighty handy I might add), I've gotten to the stuff
10.1 first referred to by Policy version 184.108.40.206, namely the stuff about
supporting building packages with the optional use of DEB_BUILD_OPTIONS.
The snippet in 10.1 makes it look a lot easier than it really is.
Certainly, I think the argus-server source package already had a
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 (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
CFLAGS += -O0
CFLAGS += -O2
ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
INSTALL_PROGRAM += -s
type stuff in debian/rules when I inherited it, but I only discovered how
ineffectual this is on its own when I tried to add it to the debian/rules
for dhcp3, and did some closer inspection of what was really going on.
Basically, setting CFLAGS in debian/rules isn't worth a pinch of shit unless
you pass it to the call to ./configure like
even then, all bets are off as to how it's going to work, depending on the
Again, using the Argus source package as my benchmark, I'd always casually
eyeballed the build logs, seen lots of "gcc -O2" going on, and assumed it
was because of my CFLAGS in debian/rules.
As it happened, the upstream Makefile was already using -O2. On closer
inspection, there was no -Wall, so my CFLAGS in debian/rules wasn't being
used at all.
So I fixed (for Argus) by passing CFLAGS to the ./configure invocation.
Next problem is that because the upstream Makefile is using -O2, I'm now
actually passing -O2 twice. The downside of this is that if a user builds
the package with "DEB_BUILD_OPTS=noopt", it's going to pass "CFLAGS=-O0
-Wall" to gcc, along with the -O2 in the upstream Makefile, and $DEITY only
knows what optimisation level it's going to actually use.
I think to do things properly, I'm going to have to patch the -O2 out of the
upstream Makefile (for Argus).
Coming back to the DHCP package, it's weird. The configure script isn't
actually a GNU autoconf configure script, so passing it a CFLAGS argument
does diddley-squat. If I invoke make with a CFLAGS environment variable, it
overrides the options passed to the compiler in the Makefile, which most
importantly includes a whole bunch of -I's, so the build fails completely.
So I'm not quite sure how I'm going to implement DEB_BUILD_OPTS support for
this sucker just yet.