Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a new, modernized, Configure.pl and adjust the Makefile template …
…to build against an installed parrot. Some targets still need work, but matrixy now builds and can run the interactive REPL.
- Loading branch information
Showing
2 changed files
with
99 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
=head1 NAME | ||
Configure.pl - a configure script for a high level language running on Parrot | ||
=head1 SYNOPSIS | ||
perl Configure.pl --help | ||
perl Configure.pl | ||
perl Configure.pl --parrot_config=<path_to_parrot> | ||
=cut | ||
|
||
use strict; | ||
use warnings; | ||
use 5.008; | ||
|
||
use Getopt::Long qw(:config auto_help); | ||
|
||
our ( $opt_parrot_config ); | ||
GetOptions( 'parrot_config=s' ); | ||
|
||
# Get a list of parrot-configs to invoke. | ||
my @parrot_config_exe = $opt_parrot_config | ||
? ( $opt_parrot_config ) | ||
: ( | ||
'parrot/parrot_config', | ||
'parrot_config', | ||
); | ||
|
||
# Get configuration information from parrot_config | ||
my %config = read_parrot_config(@parrot_config_exe); | ||
unless (%config) { | ||
die "Unable to locate parrot_config."; | ||
} | ||
|
||
# Create the Makefile using the information we just got | ||
create_makefiles(%config); | ||
|
||
sub read_parrot_config { | ||
my @parrot_config_exe = @_; | ||
my %config = (); | ||
for my $exe (@parrot_config_exe) { | ||
no warnings; | ||
if (open my $PARROT_CONFIG, '-|', "$exe --dump") { | ||
print "Reading configuration information from $exe\n"; | ||
while (<$PARROT_CONFIG>) { | ||
$config{$1} = $2 if (/(\w+) => '(.*)'/); | ||
} | ||
close $PARROT_CONFIG; | ||
last if %config; | ||
} | ||
} | ||
%config; | ||
} | ||
|
||
|
||
# Generate Makefiles from a configuration | ||
sub create_makefiles { | ||
my %config = @_; | ||
my %makefiles = ( | ||
'config/makefiles/root.in' => 'Makefile', | ||
); | ||
my $build_tool = $config{libdir} . $config{versiondir} | ||
. '/tools/dev/gen_makefile.pl'; | ||
|
||
foreach my $template (keys %makefiles) { | ||
my $makefile = $makefiles{$template}; | ||
print "Creating $makefile\n"; | ||
system($config{perl}, $build_tool, $template, $makefile); | ||
} | ||
} | ||
|
||
# Local Variables: | ||
# mode: cperl | ||
# cperl-indent-level: 4 | ||
# fill-column: 100 | ||
# End: | ||
# vim: expandtab shiftwidth=4: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters