From 1339c1502db79412159f607887082f61952d415e Mon Sep 17 00:00:00 2001 From: pmichaud Date: Fri, 27 Jan 2012 13:36:08 -0600 Subject: Updates to enable --gen-parrot and --gen-nqp to accept directory path values. --- skel/tools/lib/NQP/Configure.pm | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/skel/tools/lib/NQP/Configure.pm b/skel/tools/lib/NQP/Configure.pm index 0572a62..e93c366 100644 --- a/skel/tools/lib/NQP/Configure.pm +++ b/skel/tools/lib/NQP/Configure.pm @@ -242,6 +242,7 @@ sub gen_nqp { my $gen_parrot = $options{'gen-parrot'}; my $prefix = $options{'prefix'} || cwd().'/install'; my $startdir = cwd(); + my $nqpdir = "$startdir/nqp"; my $PARROT_REVISION = 'nqp/tools/build/PARROT_REVISION'; @@ -261,7 +262,11 @@ sub gen_nqp { my $nqp_have = $config{'nqp::version'} || ''; my $nqp_ok = $nqp_have && cmp_rev($nqp_have, $nqp_want) >= 0; - if ($gen_nqp) { + if ($gen_nqp && -d $gen_nqp) { + $nqpdir = $gen_nqp; + print "Building NQP from source in $nqpdir\n"; + } + elsif ($gen_nqp) { my $nqp_repo = git_checkout($nqp_git, 'nqp', $gen_nqp); $nqp_ok = $nqp_have eq $nqp_repo; } @@ -270,6 +275,7 @@ sub gen_nqp { } if (defined $gen_parrot) { + $PARROT_REVISION = "$nqpdir/tools/build/PARROT_REVISION"; my ($par_want) = split(' ', slurp($PARROT_REVISION)); $with_parrot = gen_parrot($par_want, %options, prefix => $prefix); %config = read_parrot_config($with_parrot); @@ -287,7 +293,7 @@ sub gen_nqp { my @cmd = ($^X, 'Configure.pl', "--with-parrot=$with_parrot", "--make-install"); print "Building NQP ...\n"; - chdir("$startdir/nqp"); + chdir($nqpdir); print "@cmd\n"; system_or_die(@cmd); chdir($startdir); @@ -304,13 +310,18 @@ sub gen_parrot { my @opts = @{ $options{'parrot-option'} || [] }; push @opts, "--optimize"; my $startdir = cwd(); + my $parrotdir = "$startdir/parrot"; my $par_exe = "$options{'prefix'}/bin/parrot$exe"; my %config = read_parrot_config($par_exe); my $par_have = $config{'parrot::git_describe'} || ''; my $par_ok = $par_have && cmp_rev($par_have, $par_want) >= 0; - if ($gen_parrot) { + if ($gen_parrot && -d $gen_parrot) { + $parrotdir = $gen_parrot; + print "Building Parrot from source in $parrotdir\n"; + } + elsif ($gen_parrot) { my $par_repo = git_checkout($par_git, 'parrot', $gen_parrot); $par_ok = $par_have eq $par_repo; } @@ -322,7 +333,7 @@ sub gen_parrot { print "$par_exe is Parrot $par_have.\n"; return $par_exe; } - chdir("$startdir/parrot") or die $!; + chdir($parrotdir) or die $!; if (-f 'Makefile') { %config = read_parrot_config('config_lib.pir'); my $make = $config{'parrot::make'}; -- cgit v1.1