Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

make it easier to pull in more parrot config info

git-svn-id: http://partcl.googlecode.com/svn/trunk@518 6cb8db7d-f34b-0410-8f57-4f83c6281724
  • Loading branch information...
commit c5d9eb6ec9d3318ad3c15118c4b8550c1bc4b4f6 1 parent 6bdaef1
wcoleda authored
Showing with 26 additions and 30 deletions.
  1. +26 −30 Configure.pl
View
56 Configure.pl
@@ -12,30 +12,26 @@
my $config = $options{'parrot-config'} || "parrot_config";
-my $perlbin = `$config perl`
- or die "Unable to find parrot_config, $config";
-my $libdir = `$config libdir`;
-my $bindir = `$config bindir`;
-my $versiondir = `$config versiondir`;
-my $slash = `$config slash`;
-my $make = `$config make`;
-
-chomp($perlbin);
-chomp($libdir);
-chomp($bindir);
-chomp($versiondir);
-chomp($slash);
-chomp($make);
-
-my $build_tool = $perlbin . " "
- . $libdir
- . $versiondir
- . $slash
- . "tools"
- . $slash
- . "dev"
- . $slash
- . "gen_makefile.pl";
+my %opt;
+
+my @keys = qw(perl libdir bindir versiondir slash make);
+
+foreach my $key (@keys) {
+ my $value = `$config $key`
+ or die "Unable to find parrot_config, $config";
+ chomp $value;
+ $opt{$key} = $value;
+}
+
+my $build_tool = $opt{perl} . ' '
+ . $opt{libdir}
+ . $opt{versiondir}
+ . $opt{slash}
+ . 'tools'
+ . $opt{slash}
+ . 'dev'
+ . $opt{slash}
+ . 'gen_makefile.pl';
my %makefiles = (
"config/makefiles/root.in" => "Makefile",
@@ -47,8 +43,8 @@
my $makefile = $makefiles{$template};
print "Creating $makefile\n";
if (system("$build_tool $template $makefile") != 0) {
- die "Unable to create makefile; You may have forgotten to run 'make install-dev'\n";
- }
+ die "Unable to create makefile; did you run parrot's 'make install-dev' ?\n";
+ }
}
@@ -57,12 +53,12 @@
open my $fh, '>', 'lib/Parrot/Installed.pm';
print {$fh} "package Parrot::Installed;\n";
-print {$fh} "use lib qw(${libdir}${versiondir}/tools/lib);\n";
+print {$fh} "use lib qw($opt{libdir}$opt{versiondir}/tools/lib);\n";
print {$fh} "1;\n";
print "Generating miscellaneous files\n";
-my $parrot = "$bindir/parrot";
+my $parrot = "$opt{bindir}/parrot";
add_shebang($parrot, 't/internals/select_switches.t', 'config/misc/select_switches_t.in');
add_shebang($parrot, 't/internals/select_option.t', 'config/misc/select_option_t.in');
replace_parrot($parrot, 'tools/spectcl', 'config/misc/spectcl.in');
@@ -70,7 +66,7 @@
print <<"END";
-You can now use '$make' to build partcl.
+You can now use '$opt{make}' to build partcl.
END
exit;
@@ -94,7 +90,7 @@ sub add_shebang {
open my $fh, '<', $source;
$contents = <$fh>;
}
-
+
open my $ofh, '>', $target;
print {$ofh} $shebang, "\n";
print {$ofh} $contents;

0 comments on commit c5d9eb6

Please sign in to comment.
Something went wrong with that request. Please try again.