Passing INSTALL_SETUP_FLAGS to zuo

In the Debian build I previously relied on PLT_SETUP_OPTIONS to pass
--do-docs to (the equivalent of) raco setup. Is there a suggested new
way? I found that

 bin/zuo . install INSTALL_SETUP_FLAGS="$whatever"

works, but

 env INSTALL_SETUP_FLAGS="$whatever" bin/zuo . install

does not. Is this intentional? If so would it be possible to modify the
generated Makefile to some environment variables to zuo? Presumably I
could patch things, but that is just makework (geddit?).

For context, we build racket on about 10 architectures, several of which
can run simple racket programs, but not build the racket docs.

d

1 Like

This is intentional, but not obviously the right choice.

I avoided making Zuo scripts consult environment variables by default, because that has caused me occasional trouble in the past. That is, sometimes an environment variable happens to be set, and it affects a configuration in a way I didn't expect or intend. But I also see how Zuo configuration via environment variable can be useful.

Maybe usefulness outweighs the danger of unintentional configuration, and so defaulting via environment variables should be added. Another possibility is to have an environment variable that means "please use environment variables", or maybe "please use these specific environment variables".

Would a "please use environment variables" environment variable work for your setting? If so, does it seem like a good approach?

1 Like

Matthew Flatt via Racket Discussions
notifications@racket.discoursemail.com writes:

Maybe usefulness outweighs the danger of unintentional configuration,
and so defaulting via environment variables should be added. Another
possibility is to have an environment variable that means "please use
environment variables", or maybe "please use these specific
environment variables".

Would a "please use environment variables" environment variable work
for your setting? If so, does it seem like a good approach?

That would be fine for us, as would having some fairly baroque
environment variable names unlikely to be set by mistake. The latter
approach has worked ok (prefixing the variables with RACKET_BUILD e.g.)
for me on much smaller projects. I have no preference, I just mention it
in the spirit of brainstorming.

d

Since changing the variable names and using long names is a pain, I've added support for a ZUO_CONFIG_ENV_VARS environment variable. Its value is a space-separated set of environment variable names to pull from the environment for defaults.

I haven't yet added a note about it to the Racket build instructions, but I'll do that.

1 Like

On further investigation, I've concluded that ZUO_CONFIG_ENV_VARS is not worthwhile, so I'm reverting that change. Instead, I made PLT_SETUP_OPTIONS work as it used to, at least in combination with make. So, there's no need to set ZUO_CONFIG_ENV_VARS to get the old support for PLT_SETUP_OPTIONS.

It turns out that environment-variable support in Racket's old makefiles was rare. Almost all variables are explicitly defined, which hides any potential definition as an environment variable. The two main exceptions that I can find are DESTDIR and PLT_SETUP_OPTIONS. There was already support for DESTDIR by explicit propagation in the stub makefile. I made PLT_SETUP_OPTIONS handled in the same way, just like @bremner suggested in the first place, both for backward-compatibility and because it seems useful and has a sufficiently baroque name. Overall, I like how this makes environment-variable support explicit for the handful of names where it's meant to work.

The variables SETUP_MACHINE_FLAGS and PLT_ISO also previously could be set as environment variables. PLT_ISO was used just the same as PLT_SETUP_OPTIONS, and I didn't bother keeping that old name for the new makefiles. SETUP_MACHINE_FLAGS is used at the same time as PLT_SETUP_OPTIONS, but for the racket used to run raco setup; I didn't make that one work as an environment variable, because its name is not specific enough to Racket and it seems unlikely that anyone is using it. I'm open to adding support for a small number of additional environment variables as needed.

Matthew Flatt via Racket Discussions
notifications@racket.discoursemail.com writes:

On further investigation, I've concluded that ZUO_CONFIG_ENV_VARS is
not worthwhile, so I'm reverting that change. Instead, I made
PLT_SETUP_OPTIONS work as it used to, at least in combination with
make. So, there's no need to set ZUO_CONFIG_ENV_VARS to get the
old support for PLT_SETUP_OPTIONS.

I have cherry-picked the second version for the Debian packaging and it
seems to work fine, no other changes needed for the packaging. Thanks
for the quick response,

David