Currently, configureFlags can be passed as a string or a list.
Passing a string works OK for small cases but it becomes hard to manage
interspersing spaces between the flags with many options, and doesn't
match the semantics of each flag being a separate item.
Passing a list (of strings) is a better fit for the type of data, but
it currently relies on Nix's regular conversion to an environment
variable, which simply concatenates the contents with spaces.
This breaks if any of the configure flags themselves contain spaces.
configureFlagsArray was added as a way to get around this limitation,
but is unsatisfactory to use because items must be appended via bash
in a preConfigure hook.
So, update configureFlags to be more ergonomic:
- Deprecate passing a string for configureFlags (require a list),
and include helpful trace/abort messages.
- Pass the list to the builder in a smarter way: instead of relying
on Nix's conversion to a string, perform our own conversion by
interspersing tabs. Tabs should be fairly rare in configureFlags;
in case a literal tab needs to be passed, it must be given extra
escapes:
configureFlags = [ "--with-some-arg-with-a-\\\t-character" ]
(The only alternative would require usage of eval.)
This also fixes passing flags that contain spaces.
- Make the list available during preConfigure as a bash array, so any
dynamic modifications to the configure flags can be done there.
There are roughly 1500 uses of configureFlags at present, which is too
many to change all at one time, and it is a commonly used flag (e.g.
in packages outside of nixpkgs). So, use a generous deprecation
timetable: start warning in the next release (16.09), and convert to a
hard error in the release after that (17.03). Since we are mid-way
between releases, this gives 9 months and 1.5 releases for users to
upgrade; switching from strings to lists is not too hard.
These changes make also configureFlagsArray redundant. There are roughly
70 uses of configureFlagsArray at present, which is enough to remove all
at once (in a future patchset).
This is a WIP that I'm posting as an RFC; I've updated enough files
to be able to build bash successfully. More to come if this is
welcomed, but I'd like to get help with converting all the uses.
I'd also like to know which docs need to be updated.