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

dpkg-buildpackage now sets DEB_BUILD_HOST etc for you?

I recently noticed that when building with dpkg-buildpackage there is
no need for the 

DEB_BUILD_GNU_TYPE     := $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
DEB_HOST_GNU_TYPE      := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)

boilerplate in debian/rules 

You can just do the test:

and it works, so it looks like dpkg-buildpackage is now setting those
vars for us. This is good and sensible, it's just that it's news to me.

Anyone know when this happened and what if any, the limitations are?
It's certainly true in wheezy, squeeze, precise and oineiric. 

Should a package depending on this behaviour build-dep on a particular
dpkg version? As it already works in build-essential in stable do the
same rules apply as essential packages in stable (i.e no explicit
dependency required)? That would be consistent. Maybe it's been doing
it since forever?

Now, you can build packages without using dpkg-buildpackage by calling
rules directly, and in that case the rules file would need to call
dpkg-architecture, but someone would have to convince me that that was
an interface worth supporting for non-native builds, because I
have certainly always considered the minimal interface for cross
package-building to be dpkg-buildpackage -a<arch>, and in practice
there are other things you need to do for non-trivial packages (set
CONFIG_SITE, set DEB_BUILD_OPTS=nocheck). (and ensure various things
like toolchain and dpkg-cross are installed). And I don't think we want
that stuff in every single rules file.

This actually leads to a wider discussion about which tools should be
responsible for setting which things in order to get a consistent
build-environment for crossing. I don't think we've ever really
thought about it very hard - conventional practices have just sort of

Should dpkg-buildpackage set everything needed, or can we require a
higher-level cross-aware too for that? I have thus far taken the view
that dpkg-buildpackage does no more than set the architecture. A
calling tool (sbuild for multiarch building or xdeb for dpkg-cross
building) is responsible for setting up anything else in the
environment. But I reserve the right to modify this view over time. 

I've started a wiki page to collect good-practice guidelines.
contributions welcome.


Principal hats:  Linaro, Emdebian, Wookware, Balloonboard, ARM

Reply to: