cvs commit: ponie Configure.pl
[email protected] (Nicholas Clark) 8 May 2004 09:36:28 -0000
| Newsgroups | perl.ponie.changes |
|---|---|
| Message-ID | <[email protected]> |
cvsuser 04/05/08 02:36:27
Modified: . Configure.pl
Log:
Configuring should happen at configure time, and making can wait until
make time
Revision Changes Path
1.27 +83 -84 ponie/Configure.pl
Index: Configure.pl
===================================================================
RCS file: /cvs/public/ponie/Configure.pl,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -w -r1.26 -r1.27
--- Configure.pl 7 May 2004 13:37:14 -0000 1.26
+++ Configure.pl 8 May 2004 09:36:27 -0000 1.27
@@ -1,4 +1,5 @@
#!/usr/bin/perl -w
+# $Id: Configure.pl,v 1.27 2004/05/08 09:36:27 nicholas Exp $
use strict;
use Config;
@@ -6,15 +7,15 @@
use FindBin;
-chdir($FindBin::Bin);
-print "Working in $FindBin::Bin\n";
+my $dir = $FindBin::Bin;
+chdir($dir) or die "chdir $dir: $!";
+print "Working in $dir\n";
+
+# Firstly, base our config on the perl that is invoking us
my @config_args;
my $configs = $Config{config_argc};
my $old_link;
-use Cwd;
-my $dir = cwd;
-
foreach my $i (1..$configs) {
my $config_value = $Config{"config_arg$i"};
next if($config_value =~/thread/i);
@@ -38,11 +39,9 @@
push @config_args,'-Uuse5005threads';
push @config_args,"-Doptimize='-g'";
-
-
delete($ENV{'PERL5LIB'});
-unless(-e 'parrot/parrot') {
+# Copy some things
open F, "src/pmc/perl5cargo_cult.pmc" or die $!;
my $template = do {local $/; <F>};
close F or die $!;
@@ -51,10 +50,20 @@
pvio)) {
my $leaf = "perl5$_.pmc";
my $file = File::Spec->catfile('classes', $leaf);
+ my $real = File::Spec->catfile ($dir, 'src', 'pmc', $leaf);
if (-e $file) {
+ # So the target exists.
+ if (-l $file && !-e $real) {
+ # It's a symlink, and the real thing does not exist - no need
+ next;
+ }
+ if (-e $real && -M $file >= -M $real) {
+ # It's a real file, but it's newer
+ next;
+ }
unlink $file or die "unlink '$file' failed: $!";
}
- my $real = File::Spec->catfile ($dir, 'src', 'pmc', $leaf);
+
if (-f $real) {
symlink $real, $file or die "symlink $real, $file failed: $!";
} else {
@@ -72,7 +81,8 @@
"--ccflags= :add{ -I$dir/perl}",
"--icudatadir=$FindBin::Bin/parrot/blib/lib/icu/2.6.1")
&& die "error";
- chdir($dir) || die;
+chdir($dir) || die "chdir $dir: $!";
+
push @INC, "parrot/lib";
require Parrot::Config;
if (defined $Parrot::Config::PConfig{link}) {
@@ -82,18 +92,23 @@
} elsif ($old_link) {
push @config_args, $old_link;
}
- do_perl_configure() unless(-e 'perl/config.h');
- chdir('parrot') || die "You need to checkout parrot inside ponie";
- system('make') && die "error";
- chdir($dir) || die;
-}
-# redo config.sh
+chdir('perl') || die "chdir perl: $!";
+
+unless (-e 'config.sh' && -e 'config.h' && -e 'Makefile') {
+ my $cmd = 'sh Configure ';
+ $cmd .= join(' ',@config_args);
+ print "Executing '$cmd'\n";
-my $inc_path = "$FindBin::Bin/parrot/include";
-my $lib_path = "$FindBin::Bin/parrot/blib/lib";
+ foreach my $file (qw(Policy.sh Policy.h config.sh config.h)) {
+ if (-f $file) {
+ unlink $file or die "unlink '$file' failed: $!";
+ }
+ }
+ system('sh','Configure',@config_args) && die "error";;
-chdir('perl') || die $!;
+ my $inc_path = "$dir/parrot/include";
+ my $lib_path = "$dir/parrot/blib/lib";
open (FH, "config.sh") or die $!;
undef $/; $_ = <FH>;
@@ -106,7 +121,8 @@
$munge{libpth} = $lib_path;
while (my ($key, $value) = each %munge) {
- s/(^$key='[^']*)'$/$1 $value'/m or die "Can't find config.sh line for $key";
+ s/(^$key='[^']*)'$/$1 $value'/m
+ or die "Can't find config.sh line for $key";
}
rename "config.sh", "config.sh.before";
@@ -116,22 +132,5 @@
close FH or die $!;
system ('sh','Configure','-S') && die "error";
-
-sub do_perl_configure {
-
- chdir('perl') || die;
- my $cmd = 'sh Configure ';
- $cmd .= join(' ',@config_args);
- print "Executing '$cmd'\n";
-
- foreach my $file (qw(Policy.sh Policy.h config.sh config.h)) {
- if (-f $file) {
- unlink $file or die "unlink '$file' failed: $!";
- }
- }
- system('sh','Configure',@config_args) && die "error";;
- # Manually extract config.h
- system('sh','config_h.SH') && die "error";;
- chdir('..');
}