[Dnsmasq-discuss] Fwd: [PATCH] Makefile: make variables overridable

Simon Kelley simon at thekelleys.org.uk
Sun Jul 12 23:21:02 BST 2020


On 12/07/2020 18:53, John Ericson wrote:
> Hi, I am another NixOS maintainer.
> 
> Yes, it is true that ?= in makefiles is somewhat rare, and that we can work around this other ways. But it was I who proposed the ?= change on our side[1], so let say why I think it's the right choice:
> 
> Most C packages don't use "?=" and do
>  FOO ?= foo
> but instead do have a configure script, so they do
>  FOO = @FOO@
> with regular "=". However that configure script *does* silently consume environment variables, so the effect is the same.
> 
> I wouldn't request upstream add a configure script is nothing is needed, and I don't even like the implicitness of environment variables myself. But the fact is it is the standard for distros to communicate information to all the myriad build systems[2], so I advocate this change so distros can remove extra packaging hacks.
> 
> The variable we need to override is PKG_CONFIG. One may right point out that other distros don't rename pkg-config, but that's because most derivations don't support cross compilation. NixOS does, but NixOS is not the only one: See also Exerho and their dnsmasq packaging[3] which has the same workarounds. We hope that cross compilation becomes less niche, but that means more people and projects will be affected by these sorts of things.

I don't like taking random stuff from an uncontrolled namespace which is
what the Unix environment is. I'd argue that Exerho's approach is the
right one: there's a list of exactly what is being used from the
environment, right there, and an adaptation layer if the same thing has
different names in the build system and the makefile.

I would note, however, that the dnsmasq makefile doesn't set the value
of CC at all, and uses it direct from the environment, if set. I guess
that one, at least is universal.

Looking at some random source trees floating in my home directory,
neither libnettle nor BIND seem to import stuff will-nilly from the
environment.


Cheers,

Simon.






More information about the Dnsmasq-discuss mailing list