configure: Rewrite implementation of --update.

Previously --update was kind of a hack, as it just dumped all
the variables from BuildConfig back into ./configure and attempted
to rerun from there.

Instead, now we store all of the variables and environs configure
was invoked with in the top of BuildConfig and re-call it using them.
This is much more robust, as configure will actually recompute
all of the values from the BuildConfig.

As a side effect, if configure was originally invoked to build crosstools,
it would have done so again, so instead add a check to see if they
exist, and skip them if they do. It's easy enough to delete the
directory if you want to force a crosstools rebuild.

Briefly discussed with mmlr on IRC.
This commit is contained in:
Augustin Cavalier
2017-12-04 20:14:18 -05:00
parent bf1a86c199
commit 825700d34a
2 changed files with 47 additions and 48 deletions
@@ -1,23 +0,0 @@
#!/usr/bin/perl
use warnings;
use strict;
=head1 convert_build_config_to_shell_format
This simple script converts its standard input from the jam-specific format
that is being used in BuildSetup into a format that's understood by sh.
=cut
my $data;
while (my $line = <>) {
$data .= $line;
if ($data =~ m{\s*([+\w]+)\s*\?=\s*\"?([^;]*?)\"?\s*;}gms) {
my ($variable, $value) = ($1, $2);
$variable =~ tr{+}{X}; # '+' is illegal as part of shell variable
print "$variable='$value'\n";
$data = '';
}
}