Skip to content

Commit

Permalink
Applying patch submitted in
Browse files Browse the repository at this point in the history
http://rt.perl.org/rt3/Ticket/Display.html?id=44645:  Refactor
configuration options processing.  You should call 'make realclean'
before you call 'svn up' to get this patch.  (Or do a fresh checkout of
trunk.  Or call 'perl tools/dev/reconfigure.pl --step=gen::makefiles
--target=Makefile' afterwards.  TIMTOWTDI.)


git-svn-id: https://svn.parrot.org/parrot/trunk@20832 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
  • Loading branch information
jkeenan committed Aug 25, 2007
1 parent 3076fee commit d79c782
Show file tree
Hide file tree
Showing 42 changed files with 1,303 additions and 584 deletions.
40 changes: 10 additions & 30 deletions Configure.pl
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,9 @@ =head2 Command-line Options
Tells Configure.pl to output information about i<every> setting added or
changed.
=item C<--verbose-step={N|name|regex}>
=item C<--verbose-step={N|regex}>
Run one step with C<--verbose=2>; step indicated by step number C<N>, by step
name (I<e.g.>, C<--verbose-step=inter::make>), or by matching description.
Run C<--verbose=2> for step number C<N> or matching description.
=item C<--nomanicheck>
Expand All @@ -53,10 +52,6 @@ =head2 Command-line Options
Sets the location where parrot will be installed.
=item C<--step=>
Execute a single configure step.
=item C<--languages="list of languages">
Specify a list of languages to process (space separated.)
Expand Down Expand Up @@ -292,7 +287,6 @@ =head1 SEE ALSO
use warnings;
use lib 'lib';

use Parrot::BuildUtil;
use Parrot::Configure;
use Parrot::Configure::Options qw( process_options );
use Parrot::Configure::Options::Test;
Expand All @@ -302,8 +296,6 @@ =head1 SEE ALSO
);
use Parrot::Configure::Step::List qw( get_steps_list );

my $parrot_version = Parrot::BuildUtil::parrot_version();

$| = 1; # $OUTPUT_AUTOFLUSH = 1;

# Install Option text was taken from:
Expand All @@ -317,10 +309,8 @@ =head1 SEE ALSO

# from Parrot::Configure::Options
my $args = process_options( {
argv => [ @ARGV ],
script => $0,
parrot_version => $parrot_version,
svnid => '$Id$',
mode => 'configure',
argv => [ @ARGV ],
} );
exit(1) unless defined $args;

Expand All @@ -329,8 +319,9 @@ =head1 SEE ALSO
# as command-line option
$opttest->run_configure_tests();

my $parrot_version = $Parrot::Configure::Options::Conf::parrot_version;
# from Parrot::Configure::Messages
print_introduction($parrot_version) unless exists $args->{step};
print_introduction($parrot_version);

my $conf = Parrot::Configure->new;

Expand All @@ -340,27 +331,16 @@ =head1 SEE ALSO
# from Parrot::Configure::Data
$conf->options->set(%{$args});

if ( exists $args->{step} ) {
# from Parrot::Configure::Data
$conf->data()->slurp();
$conf->data()->slurp_temp()
if $args->{step} =~ /gen::makefiles/;
# from Parrot::Configure
$conf->run_single_step( $args->{step} );
print "\n";
}
else {
# Run the actual steps
# from Parrot::Configure
$conf->runsteps or exit(1);
}
# Run the actual steps
# from Parrot::Configure
$conf->runsteps or exit(1);

# build tests will only be run if you requested them
# as command-line option
$opttest->run_build_tests();

# from Parrot::Configure::Messages
print_conclusion($conf->data->get('make')) unless exists $args->{step};
print_conclusion($conf->data->get('make'));
exit(0);

################### DOCUMENTATION ###################
Expand Down
11 changes: 10 additions & 1 deletion MANIFEST
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# ex: set ro:
# $Id$
#
# generated by tools/dev/mk_manifest_and_skip.pl Wed Aug 22 18:30:33 2007 UT
# generated by tools/dev/mk_manifest_and_skip.pl Sat Aug 25 01:42:41 2007 UT
#
# See tools/dev/install_files.pl for documentation on the
# format of this file.
Expand Down Expand Up @@ -2300,6 +2300,8 @@ lib/Parrot/Configure.pm [devel]
lib/Parrot/Configure/Data.pm [devel]
lib/Parrot/Configure/Messages.pm [devel]
lib/Parrot/Configure/Options.pm [devel]
lib/Parrot/Configure/Options/Conf.pm [devel]
lib/Parrot/Configure/Options/Reconf.pm [devel]
lib/Parrot/Configure/Options/Test.pm [devel]
lib/Parrot/Configure/Step.pm [devel]
lib/Parrot/Configure/Step/Base.pm [devel]
Expand Down Expand Up @@ -2894,6 +2896,11 @@ t/configure/022-version.t []
t/configure/023-version.t []
t/configure/024-version.t []
t/configure/025-options_test.t []
t/configure/026-options_test.t []
t/configure/027-option_or_data.t []
t/configure/028-option_or_data.t []
t/configure/029-option_or_data.t []
t/configure/030-option_or_data.t []
t/configure/101-init_manifest.01.t []
t/configure/101-init_manifest.02.t []
t/configure/102-init_defaults.01.t []
Expand Down Expand Up @@ -3150,6 +3157,7 @@ t/pmc/undef.t []
t/pmc/unmanagedstruct.t []
t/pmc/version.t []
t/pmc/vtablecache.t []
t/postconfigure/01-options.t []
t/postconfigure/02-data_slurp.t []
t/postconfigure/03-revision_no_DEVELOPING.t []
t/postconfigure/04-revision.t []
Expand Down Expand Up @@ -3252,6 +3260,7 @@ tools/dev/parrot_coverage.pl [devel]
tools/dev/parrotbench.pl [devel]
tools/dev/pbc_header.pl [devel]
tools/dev/rebuild_miniparrot.pl [devel]
tools/dev/reconfigure.pl [devel]
tools/dev/run_indent.pl [devel]
tools/dev/src-t.sh [devel]
tools/dev/symlink.pl [devel]
Expand Down
4 changes: 2 additions & 2 deletions config/gen/makefiles/root.in
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ LINKFLAGS = @linkflags@ @link_debug@ @ld_debug@
LD = @ld@
LDFLAGS = @ldflags@ @ld_debug@

CONFIGURE = $(PERL) Configure.pl
RECONFIGURE = $(PERL) tools/dev/reconfigure.pl

INNO_SETUP = iscc

Expand Down Expand Up @@ -721,7 +721,7 @@ parrot_utils : $(PDUMP) $(DIS) $(PINFO) $(PDB) $(PBCMERGE)
installable: all $(INSTALLABLEPARROT) $(INSTALLABLEPDUMP) $(INSTALLABLEDIS) $(INSTALLABLEPINFO) $(INSTALLABLEPDB) $(INSTALLABLEPBCMERGE)

Makefile : config/gen/makefiles/root.in
$(CONFIGURE) --step=gen::makefiles --target=Makefile
$(RECONFIGURE) --step=gen::makefiles --target=Makefile

flags_dummy :
@echo "Compiling with:"
Expand Down
6 changes: 4 additions & 2 deletions languages/nqp/config/makefiles/root.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ RM_RF = @rm_rf@
PARROT = ../../parrot@exe@
BUILD_DIR= @build_dir@
BUILD = $(PERL) @build_dir@/tools/build/dynpmc.pl
CONFIGURE= $(PERL) @build_dir@/Configure.pl
# CONFIGURE= $(PERL) @build_dir@/Configure.pl
RECONFIGURE= $(PERL) @build_dir@/tools/dev/reconfigure.pl
TOOL_DIR = ../..
TGE_DIR = ../../compilers/tge
CAT = $(PERL) -MExtUtils::Command -e cat
Expand All @@ -32,9 +33,10 @@ nqp.pbc: $(PARROT) $(PGE_LIBRARY)/Perl6Grammar.pir $(SOURCES)
--output=src/Grammar_gen.pir src/Grammar.pg
$(PARROT) -o nqp.pbc nqp.pir

# cd $(BUILD_DIR) && $(CONFIGURE) --step=gen::languages --languages=nqp
# regenerate the Makefile
Makefile: config/makefiles/root.in
cd $(BUILD_DIR) && $(CONFIGURE) --step=gen::languages --languages=nqp
cd $(BUILD_DIR) && $(RECONFIGURE) --step=gen::languages --languages=nqp

# This is a listing of all targets, that are meant to be called by users
help:
Expand Down
7 changes: 5 additions & 2 deletions languages/perl6/config/makefiles/root.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ RM_RF = @rm_rf@
PARROT = ../../parrot@exe@
BUILD_DIR= @build_dir@
BUILD = $(PERL) @build_dir@/tools/build/dynpmc.pl
CONFIGURE= $(PERL) @build_dir@/Configure.pl
# CONFIGURE= $(PERL) @build_dir@/Configure.pl
RECONFIGURE= $(PERL) @build_dir@/tools/dev/reconfigure.pl
TOOL_DIR = ../..
TGE_DIR = ../../compilers/tge
CAT = $(PERL) -MExtUtils::Command -e cat
Expand Down Expand Up @@ -76,9 +77,11 @@ $(PMCDIR)/perl6_group$(LOAD_EXT): $(PARROT) $(PMC_SOURCES)
src/builtins_gen.pir: $(BUILTINS_PIR)
$(CAT) $(BUILTINS_PIR) >src/builtins_gen.pir

# cd $(BUILD_DIR) && $(CONFIGURE) --step=gen::languages --languages=perl6

# regenerate the Makefile
Makefile: config/makefiles/root.in
cd $(BUILD_DIR) && $(CONFIGURE) --step=gen::languages --languages=perl6
cd $(BUILD_DIR) && $(RECONFIGURE) --step=gen::languages --languages=perl6

# This is a listing of all targets, that are meant to be called by users
help:
Expand Down
40 changes: 14 additions & 26 deletions lib/Parrot/Configure.pm
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,8 @@ Accepts a list of new steps and modifies the data structure within the L<Parrot:
sub add_steps {
my ( $conf, @new_steps ) = @_;

$conf->{list_of_steps} = [ @new_steps ];

for (my $i = 0; $i <= $#new_steps; $i++) {
$conf->add_step($new_steps[$i]);
$conf->{hash_of_steps}->{$new_steps[$i]} = $i + 1;
foreach my $step (@new_steps) {
$conf->add_step($step);
}

return 1;
Expand Down Expand Up @@ -263,28 +260,20 @@ sub _run_this_step {

# set per step verbosity
if ( defined $args->{verbose_step} ) {

# by step number
if (
(
# by step number
( $args->{verbose_step} =~ /^\d+$/ )
and
( $args->{n} == $args->{verbose_step} )
)
or
(
# by step name
( ${$conf->{hash_of_steps}}{$args->{verbose_step}} )
and
( $args->{verbose_step} eq $step_name )
)
or
(
# by description
$description =~ /$args->{verbose_step}/
)
$args->{verbose_step} =~ /^\d+$/
&&
$args->{n} == $args->{verbose_step}
) {
$conf->options->set( verbose => 2 );
}

# by description
elsif ( $description =~ /$args->{verbose_step}/ ) {
$conf->options->set( verbose => 2 );
}
}

# RT#43673 cc_build uses this verbose setting, why?
Expand Down Expand Up @@ -323,8 +312,6 @@ sub _run_this_step {
print "..." if $args->{verbose} && $args->{verbose} == 2;
print "." x ( 71 - length($description) - length($result) );
print "$result." unless $step =~ m{^inter/} && $args->{ask};
# reset verbose value for the next step
$conf->options->set( verbose => $args->{verbose} );

if ($conf->options->get(q{configure_trace}) ) {
if (! defined $conftrace->[0]) {
Expand All @@ -338,6 +325,8 @@ sub _run_this_step {
push @{$conftrace}, $evolved_data;
nstore($conftrace, $sto);
}
# reset verbose value for the next step
$conf->options->set( verbose => $args->{verbose} );
}

=item * C<option_or_data($arg)>
Expand Down Expand Up @@ -367,7 +356,6 @@ sub option_or_data {
return defined $opt ? $opt : $conf->data->get( $arg );
}


=back
=head1 CREDITS
Expand Down
Loading

0 comments on commit d79c782

Please sign in to comment.