[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?



I guess Helmut/Josch are the best people to answer your questions, but
I _think_ I could answer some of it.

On Sat, Jan 14, 2023 at 02:10:20PM -0800, Dima Kogan wrote:
> Hi. I'm looking to make some of my packages cross-buildable. Just looked
> at this one:
> 
>   https://salsa.debian.org/science-team/vnlog/
> 
> I'm upstream also. This uses a simple GNU-Make-based build system that
> isn't a common one in the Debian archive. In any case, passing the
> correct $CC, $CXX variables in the environment is enough to get it to do
> the right thing.
>
> 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

That file provides the triplet prefixed CC, CXX et. al. and does
not export them (for a good reason) and so you'd usually expect to pass
these to the buildsystem on your own.
If you want these to be always propagated to your buildsystem you need
to export it explicitly the you did it.

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

IMHO the best way would be to simply let debhelper do its job rather
than having to manually with hardcoded make calls.

For your package you could consider doing something on the lines of:

 override_dh_auto_build:
-       make all doc
+       dh_auto_build -- all doc

and you would no longer need to import the buildtools.mk file nor add an
exports on the buildflags variable.

> - Should the wiki page be updated?

Maybe an extra point could be added to the wiki about the DPKG_EXPORT_BUILDTOOLS
variable

> - Should it ALWAYS export the variables?

No

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

It might not hurt to add that include but it would be un-needed if your
package uses debhelper well.

-- 
Best,
Nilesh

Attachment: signature.asc
Description: PGP signature


Reply to: