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

debian/rules and environment variables



It has been suggested in bug #411520 that cdbs should be set up so that 
it preserves CFLAGS set in the environment.  But I haven't found any 
clear specification about how debian/rules, being a makefile, should 
deal with environment variables.

The best I could find is Policy 10.1 which states that "the following 
compilation parameters should be used:

CC = gcc
CFLAGS = -O2 -g -Wall"

(It doesn't say, "these variables should be set this way".)  It appears, 
however, that hardly any package (containing C language code) 
explicitly sets CC, and I think it is certainly useful to be able to 
set a different CC in the environment.  Yet at the same time most 
packages set CFLAGS explicitly, overriding anything that's there 
before.  The language in the policy and various rules templates appear 
to encourage that.  But as the submitter of #411520 stated, it could 
also be useful to be able to build a package with different compiler 
flags.

What this might come down to is that most variable assignments in rules 
files should be changed from = to ?=.

Since debuild and pbuilder and other tools exist that give pretty good 
control over the environment for "final" package builds, I don't think 
there is much of a risk in allowing that, but I think some consistent 
approach ought to be worked out.

Comments?

-- 
please CC me



Reply to: