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

Re: What is the proper way to pass $CC and others to the build?



Hi Dima,

On Sat, Jan 14, 2023 at 02:10:20PM -0800, Dima Kogan wrote:
> There's a wiki page:
> 
>   https://wiki.debian.org/CrossBuildPackagingGuidelines
> 
> It says that all I need to do is to
> 
>   include /usr/share/dpkg/buildtools.mk
> 
> at the top of the debian/rules. This turned out to not be enough,

This kinda is the exception to the rule though. In the majority of cases
things "just work", because dh_auto_build does the right thing.

Your first strategy should be using dh_auto_build. In case of vnlog, you
override_dh_auto_build and instead rather than wrapping it, you replace
it. If you were to use "dh_auto_build -- all doc", I suspect things
would just work.

Then yeah, buildtools.mk only sets the make variables. This gives the
developer the flexibility of selectively exporting them or exporting
them under different names (which occasionally is necessary).

> however: I also needed to DPKG_EXPORT_BUILDTOOLS:=1 in order to export
> the build variables in the environment. After doing that, it works.

This actually is a common pattern. While dh_auto_build passes these
variables, dh_auto_install does not and some build systems detect their
features on every make invocation and rebuild if changed. In such cases,
that's the way to go.

> Questions:
> 
> - Is this the right way to do it?

Occasionally yes.

> - Should the wiki page be updated?

Yes, please. Though recommend using dh_auto_build before buildtools.mk.

> - Should it ALWAYS export the variables?

No, because some upstreams use them differently. Note that exporting
breaks laziness. Changing the export would probably break packages.

> - Should debian/rules ALWAYS use that include implicitly?

I think this is uses so rarely, that packages can just do it. Make isn't
one of those build systems where we expect much more adoption either.

Helmut


Reply to: