Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Applying patch submitted in

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...
commit d79c7826becc6b4f89fb7f15f8353023f98e4317 1 parent 3076fee
@jkeenan jkeenan authored
Showing with 1,303 additions and 584 deletions.
  1. +10 −30 Configure.pl
  2. +10 −1 MANIFEST
  3. +2 −2 config/gen/makefiles/root.in
  4. +4 −2 languages/nqp/config/makefiles/root.in
  5. +5 −2 languages/perl6/config/makefiles/root.in
  6. +14 −26 lib/Parrot/Configure.pm
  7. +43 −245 lib/Parrot/Configure/Options.pm
  8. +241 −0 lib/Parrot/Configure/Options/Conf.pm
  9. +69 −0 lib/Parrot/Configure/Options/Reconf.pm
  10. +1 −3 lib/Parrot/Configure/Options/Test.pm
  11. +82 −81 t/configure/001-options.t
  12. +2 −3 t/configure/002-messages.t
  13. +2 −10 t/configure/004-configure.t
  14. +2 −9 t/configure/005-run_one_step.t
  15. +2 −8 t/configure/006-bad_step.t
  16. +2 −9 t/configure/007-verbose_two.t
  17. +2 −9 t/configure/008-verbose_step_number.t
  18. +2 −9 t/configure/009-verbose_step_regex.t
  19. +2 −9 t/configure/010-verbose_step_number_not_called.t
  20. +2 −9 t/configure/011-no_description.t
  21. +2 −9 t/configure/012-verbose.t
  22. +2 −9 t/configure/013-die.t
  23. +2 −9 t/configure/014-params.t
  24. +2 −9 t/configure/015-no_return.t
  25. +2 −9 t/configure/016-no_return_but_result.t
  26. +3 −6 t/configure/025-options_test.t
  27. +127 −0 t/configure/026-options_test.t
  28. +78 −0 t/configure/027-option_or_data.t
  29. +94 −0 t/configure/028-option_or_data.t
  30. +95 −0 t/configure/029-option_or_data.t
  31. +87 −0 t/configure/030-option_or_data.t
  32. +1 −5 t/configure/101-init_manifest.01.t
  33. +1 −5 t/configure/101-init_manifest.02.t
  34. +1 −5 t/configure/102-init_defaults.01.t
  35. +1 −5 t/configure/102-init_defaults.02.t
  36. +2 −6 t/configure/103-init_install.t
  37. +1 −5 t/configure/104-init_miniparrot.t
  38. +9 −2 t/configure/106-init_headers.t
  39. +228 −0 t/postconfigure/01-options.t
  40. +21 −23 t/postconfigure/02-data_slurp.t
  41. +3 −10 t/postconfigure/06-data_slurp_temp.t
  42. +42 −0 tools/dev/reconfigure.pl
View
40 Configure.pl
@@ -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>
@@ -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.)
@@ -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;
@@ -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:
@@ -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;
@@ -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;
@@ -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 ###################
View
11 MANIFEST
@@ -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.
@@ -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]
@@ -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 []
@@ -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 []
@@ -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]
View
4 config/gen/makefiles/root.in
@@ -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
@@ -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:"
View
6 languages/nqp/config/makefiles/root.in
@@ -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
@@ -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:
View
7 languages/perl6/config/makefiles/root.in
@@ -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
@@ -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:
View
40 lib/Parrot/Configure.pm
@@ -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;
@@ -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?
@@ -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]) {
@@ -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)>
@@ -367,7 +356,6 @@ sub option_or_data {
return defined $opt ? $opt : $conf->data->get( $arg );
}
-
=back
=head1 CREDITS
View
288 lib/Parrot/Configure/Options.pm
@@ -6,255 +6,59 @@ use warnings;
use base qw( Exporter );
our @EXPORT_OK = qw(
process_options
- get_valid_options
);
-
-sub get_valid_options {
- return qw(
- ask
- bindir
- cage
- cc
- ccflags
- ccwarn
- cgoto
- configure_trace
- cxx
- datadir
- debugging
- define
- exec-prefix
- execcapable
- floatval
- gc
- help
- icu-config
- icudatadir
- icuheaders
- icushared
- includedir
- infodir
- inline
- intval
- jitcapable
- languages
- ld
- ldflags
- lex
- libdir
- libexecdir
- libs
- link
- linkflags
- localstatedir
- m
- maintainer
- mandir
- miniparrot
- nomanicheck
- oldincludedir
- opcode
- ops
- optimize
- parrot_is_shared
- pmc
- prefix
- profile
- sbindir
- sharedstatedir
- step
- sysconfdir
- target
- test
- verbose
- verbose-step
- version
- without-gdbm
- without-gmp
- without-icu
- yacc
- );
-}
+use Carp;
+use lib qw( lib );
+use Parrot::Configure::Options::Conf ();
+use Parrot::Configure::Options::Reconf ();
sub process_options {
- my $optionsref = shift;
- $optionsref->{argv} = []
- unless defined $optionsref->{argv};
- $optionsref->{script} = q{Configure.pl}
- unless defined $optionsref->{script};
- die "Must provide argument 'parrot_version'"
- unless $optionsref->{parrot_version};
- die "Must provide argument 'svnid'"
- unless $optionsref->{svnid};
- my @valid_opts = get_valid_options();
- my %args;
- for ( @{ $optionsref->{argv} } ) {
+ my $argsref = shift;
+ my %options_components;
+ croak "'mode' argument not provided to process_options()"
+ unless defined $argsref->{mode};
+ if ($argsref->{mode} =~ /^reconfigure$/i) {
+ %options_components =
+ %Parrot::Configure::Options::Reconf::options_components;
+ } elsif ($argsref->{mode} =~ /^configure$/i) {
+ %options_components =
+ %Parrot::Configure::Options::Conf::options_components;
+ } else {
+ croak "Invalid value for 'mode' argument to process_options()";
+ }
+ $argsref->{argv} = [] unless defined $argsref->{argv};
+
+ my $script = $options_components{script}
+ ? $options_components{script}
+ : croak "Must provide value for 'script'";
+
+ my %valid_opts = map {$_, 1} @{ $options_components{valid_options} };
+ my $data = {};
+ my @short_circuits_seen = ();
+ for ( @{ $argsref->{argv} } ) {
my ( $key, $value ) = m/--([-\w]+)(?:=(.*))?/;
$key = 'help' unless defined $key;
$value = 1 unless defined $value;
- unless ( grep $key eq $_, @valid_opts ) {
- die qq/Invalid option "$key". See "perl Configure.pl --help" for valid options\n/;
+ unless ( $valid_opts{$key} ) {
+ die qq/Invalid option "$key". See "perl $script --help" for valid options\n/;
}
-
- for ($key) {
- if ( $key =~ m/version/ ) {
- print_version_info($optionsref);
- return;
- }
-
- if ( $key =~ m/help/ ) {
- print_help($optionsref);
- return;
- }
- $args{$key} = $value;
+ if ($options_components{short_circuits}{$key}) {
+ push @short_circuits_seen, $key;
}
+ $data->{$key} = $value;
+ }
+ if (@short_circuits_seen) {
+ # run all the short circuits
+ foreach my $sc (@short_circuits_seen) {
+ &{$options_components{short_circuits}{$sc}};
+ }
+ return;
+ } else {
+ $data = &{$options_components{conditionals}}($data);
+ return $data;
}
-
- $args{debugging} = 1
- unless ( ( exists $args{debugging} ) && !$args{debugging} );
- $args{maintainer} = 1 if defined $args{lex} or defined $args{yacc};
- return \%args;
-}
-
-################### SUBROUTINES ###################
-
-sub print_version_info {
- my $argsref = shift;
- print "Parrot Version $argsref->{parrot_version} Configure 2.0\n";
- print "$argsref->{svnid}\n";
- return 1;
-}
-
-sub print_help {
- my $argsref = shift;
- print <<"EOT";
-$argsref->{script} - Parrot Configure 2.0
-
-General Options:
-
- --help Show this text
- --version Show version information
- --verbose Output extra information
- --verbose=2 Output every setting change
- --verbose-step=N Set verbose for step N only
- --verbose-step=name Set verbose for step some::step only
- --verbose-step=regex Set verbose for step matching description
- --nomanicheck Don't check the MANIFEST
- --step=(gen::languages)
- Execute a single configure step
- --languages="list of languages"
- Specify a list of languages to process
-
- --ask Have Configure ask for commonly-changed info
- --test=configure Run tests of configuration tools before configuring
- --test=build Run tests of build tools after configuring but before
- calling 'make'
- --test Run configuration tools tests, configure, then run
- build tools tests
-
-Compile Options:
-
- --debugging=0 Disable debugging, default = 1
- --inline Compiler supports inline
- --optimize Optimized compile
- --optimize=flags Add given optimizer flags
- --parrot_is_shared Link parrot dynamically
- --m=32 Build 32bit executable on 64-bit architecture.
- --profile Turn on profiled compile (gcc only for now)
- --cage [CAGE] compile includes many additional warnings
-
- --cc=(compiler) Use the given compiler
- --ccflags=(flags) Use the given compiler flags
- --ccwarn=(flags) Use the given compiler warning flags
- --cxx=(compiler) Use the given C++ compiler
- --libs=(libs) Use the given libraries
- --link=(linker) Use the given linker
- --linkflags=(flags) Use the given linker flags
- --ld=(linker) Use the given loader for shared libraries
- --ldflags=(flags) Use the given loader flags for shared libraries
- --lex=(lexer) Use the given lexical analyzer generator
- --yacc=(parser) Use the given parser generator
-
- --define=inet_aton Quick hack to use inet_aton instead of inet_pton
-
-Parrot Options:
-
- --intval=(type) Use the given type for INTVAL
- --floatval=(type) Use the given type for FLOATVAL
- --opcode=(type) Use the given type for opcodes
- --ops=(files) Use the given ops files
- --pmc=(files) Use the given PMC files
-
- --cgoto=0 Don't build cgoto core - recommended when short of mem
- --jitcapable Use JIT
- --execcapable Use JIT to emit a native executable
- --gc=(type) Determine the type of garbage collection
- type=(gc|libc|malloc|malloc-trace) default is gc
-
-External Library Options:
-
- --without-gmp Build parrot without GMP support
- --without-gdbm Build parrot without GDBM support
-
-ICU Options:
-
- For using a system ICU, these options can be used:
-
- --icu-config=/path/to/icu-config
- Location of the script used for ICU autodetection.
- You just need to specify this option if icu-config
- is not in your PATH.
-
- --icu-config=none Can be used to disable the autodetection feature.
- It will also be disabled if you specify any other
- of the following ICU options.
-
- If you do not have a full ICU installation:
-
- --without-icu Build parrot without ICU support
- --icuheaders=(path) Location of ICU headers without /unicode
- --icushared=(flags) Full linker command to create shared libraries
- --icudatadir=(path) Directory to locate ICU's data file(s)
-
-Other Options (may not be implemented):
-
- --maintainer Create imcc's parser and lexer files. Needs a working
- parser and lexer.
- --miniparrot Build parrot assuming only pure ANSI C is available
-
-Install Options:
-
- --prefix=PREFIX Install architecture-independent files in PREFIX
- [/usr/local]
- --exec-prefix=EPREFIX Install architecture-dependent files in EPREFIX
- [PREFIX]
-
- By default, `make install' will install all the files in
- `/usr/local/bin', `/usr/local/lib' etc. You can specify
- an installation prefix other than `/usr/local' using `--prefix',
- for instance `--prefix=\$HOME'.
-
- For better control, use the options below.
-
- Fine tuning of the installation directories:
- --bindir=DIR user executables [EPREFIX/bin]
- --sbindir=DIR system admin executables [EPREFIX/sbin]
- --libexecdir=DIR program executables [EPREFIX/libexec]
- --datadir=DIR read-only architecture-independent data [PREFIX/share]
- --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
- --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
- --localstatedir=DIR modifiable single-machine data [PREFIX/var]
- --libdir=DIR object code libraries [EPREFIX/lib]
- --includedir=DIR C header files [PREFIX/include]
- --oldincludedir=DIR C header files for non-gcc [/usr/include]
- --infodir=DIR info documentation [PREFIX/info]
- --mandir=DIR man documentation [PREFIX/man]
-
-EOT
- return 1;
}
-
1;
#################### DOCUMENTATION ####################
@@ -268,15 +72,9 @@ Parrot::Configure::Options - Process command-line options to F<Configure.pl>
use Parrot::Configure::Options qw( process_options );
$args = process_options( {
- argv => [ @ARGV ],
- script => $0,
- parrot_version => $parrot_version,
- svnid =>
- '$Id$',
+ mode => q{configure},
} );
- @valid_options = get_valid_options();
-
=head1 DESCRIPTION
Parrot::Configure::Options exports on demand two subroutines:
View
241 lib/Parrot/Configure/Options/Conf.pm
@@ -0,0 +1,241 @@
+# Copyright (C) 2001-2006, The Perl Foundation.
+# $Id$
+package Parrot::Configure::Options::Conf;
+use strict;
+use warnings;
+use base qw( Exporter );
+our @EXPORT_OK = qw(
+ @valid_options
+ $script
+ %options_components
+ $parrot_version
+ $svnid
+);
+use lib qw( lib );
+use Parrot::BuildUtil;
+
+our @valid_options = qw{
+ ask
+ bindir
+ cage
+ cc
+ ccflags
+ ccwarn
+ cgoto
+ configure_trace
+ cxx
+ datadir
+ debugging
+ define
+ exec-prefix
+ execcapable
+ floatval
+ gc
+ help
+ icu-config
+ icudatadir
+ icuheaders
+ icushared
+ includedir
+ infodir
+ inline
+ intval
+ jitcapable
+ languages
+ ld
+ ldflags
+ lex
+ libdir
+ libexecdir
+ libs
+ link
+ linkflags
+ localstatedir
+ m
+ make
+ maintainer
+ mandir
+ miniparrot
+ nomanicheck
+ oldincludedir
+ opcode
+ ops
+ optimize
+ parrot_is_shared
+ pmc
+ prefix
+ profile
+ sbindir
+ sharedstatedir
+ sysconfdir
+ test
+ verbose
+ verbose-step
+ version
+ without-gdbm
+ without-gmp
+ without-icu
+ yacc
+};
+
+our $script = q{Configure.pl};
+our $parrot_version = Parrot::BuildUtil::parrot_version();
+our $svnid = '$Id$',
+
+my %short_circuits = (
+ help => \&print_help,
+ version => \&print_version,
+);
+
+our %options_components = (
+ 'valid_options' => \@valid_options,
+ 'script' => $script,
+ 'short_circuits' => \%short_circuits,
+ 'conditionals' => \&conditional_assignments,
+);
+
+sub conditional_assignments {
+ my $argsref = shift;
+ $argsref->{debugging} = 1
+ unless ( ( exists $argsref->{debugging} ) && !$argsref->{debugging} );
+ $argsref->{maintainer} = 1
+ if defined $argsref->{lex} or defined $argsref->{yacc};
+ return $argsref;
+}
+
+sub print_version {
+ print "Parrot Version $parrot_version Configure 2.0\n";
+ print "$svnid\n";
+ return 1;
+}
+
+sub print_help {
+ print <<"EOT";
+$script - Parrot Configure 2.0
+
+General Options:
+
+ --help Show this text
+ --version Show version information
+ --verbose Output extra information
+ --verbose=2 Output every setting change
+ --verbose-step=N Set verbose for step N only
+ --verbose-step=regex Set verbose for step matching description
+ --nomanicheck Don't check the MANIFEST
+ --step=(gen::languages)
+ Execute a single configure step
+ --languages="list of languages"
+ Specify a list of languages to process
+
+ --ask Have Configure ask for commonly-changed info
+ --test=configure Run tests of configuration tools before configuring
+ --test=build Run tests of build tools after configuring but before
+ calling 'make'
+ --test Run configuration tools tests, configure, then run
+ build tools tests
+
+
+Compile Options:
+
+ --debugging=0 Disable debugging, default = 1
+ --inline Compiler supports inline
+ --optimize Optimized compile
+ --optimize=flags Add given optimizer flags
+ --parrot_is_shared Link parrot dynamically
+ --m=32 Build 32bit executable on 64-bit architecture.
+ --profile Turn on profiled compile (gcc only for now)
+ --cage [CAGE] compile includes many additional warnings
+
+ --cc=(compiler) Use the given compiler
+ --ccflags=(flags) Use the given compiler flags
+ --ccwarn=(flags) Use the given compiler warning flags
+ --cxx=(compiler) Use the given C++ compiler
+ --libs=(libs) Use the given libraries
+ --link=(linker) Use the given linker
+ --linkflags=(flags) Use the given linker flags
+ --ld=(linker) Use the given loader for shared libraries
+ --ldflags=(flags) Use the given loader flags for shared libraries
+ --lex=(lexer) Use the given lexical analyzer generator
+ --make=(make tool) Use the given make utility
+ --yacc=(parser) Use the given parser generator
+
+ --define=inet_aton Quick hack to use inet_aton instead of inet_pton
+
+Parrot Options:
+
+ --intval=(type) Use the given type for INTVAL
+ --floatval=(type) Use the given type for FLOATVAL
+ --opcode=(type) Use the given type for opcodes
+ --ops=(files) Use the given ops files
+ --pmc=(files) Use the given PMC files
+
+ --cgoto=0 Don't build cgoto core - recommended when short of mem
+ --jitcapable Use JIT
+ --execcapable Use JIT to emit a native executable
+ --gc=(type) Determine the type of garbage collection
+ type=(gc|libc|malloc|malloc-trace) default is gc
+
+External Library Options:
+
+ --without-gmp Build parrot without GMP support
+ --without-gdbm Build parrot without GDBM support
+
+ICU Options:
+
+ For using a system ICU, these options can be used:
+
+ --icu-config=/path/to/icu-config
+ Location of the script used for ICU autodetection.
+ You just need to specify this option if icu-config
+ is not in your PATH.
+
+ --icu-config=none Can be used to disable the autodetection feature.
+ It will also be disabled if you specify any other
+ of the following ICU options.
+
+ If you do not have a full ICU installation:
+
+ --without-icu Build parrot without ICU support
+ --icuheaders=(path) Location of ICU headers without /unicode
+ --icushared=(flags) Full linker command to create shared libraries
+ --icudatadir=(path) Directory to locate ICU's data file(s)
+
+Other Options (may not be implemented):
+
+ --maintainer Create imcc's parser and lexer files. Needs a working
+ parser and lexer.
+ --miniparrot Build parrot assuming only pure ANSI C is available
+
+Install Options:
+
+ --prefix=PREFIX Install architecture-independent files in PREFIX
+ [/usr/local]
+ --exec-prefix=EPREFIX Install architecture-dependent files in EPREFIX
+ [PREFIX]
+
+ By default, `make install' will install all the files in
+ `/usr/local/bin', `/usr/local/lib' etc. You can specify
+ an installation prefix other than `/usr/local' using `--prefix',
+ for instance `--prefix=\$HOME'.
+
+ For better control, use the options below.
+
+ Fine tuning of the installation directories:
+ --bindir=DIR user executables [EPREFIX/bin]
+ --sbindir=DIR system admin executables [EPREFIX/sbin]
+ --libexecdir=DIR program executables [EPREFIX/libexec]
+ --datadir=DIR read-only architecture-independent data [PREFIX/share]
+ --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
+ --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
+ --localstatedir=DIR modifiable single-machine data [PREFIX/var]
+ --libdir=DIR object code libraries [EPREFIX/lib]
+ --includedir=DIR C header files [PREFIX/include]
+ --oldincludedir=DIR C header files for non-gcc [/usr/include]
+ --infodir=DIR info documentation [PREFIX/info]
+ --mandir=DIR man documentation [PREFIX/man]
+
+EOT
+ return 1;
+}
+
+1;
View
69 lib/Parrot/Configure/Options/Reconf.pm
@@ -0,0 +1,69 @@
+# Copyright (C) 2001-2006, The Perl Foundation.
+# $Id$
+package Parrot::Configure::Options::Reconf;
+use strict;
+use warnings;
+use base qw( Exporter );
+our @EXPORT_OK = qw( @valid_options $script %options_components );
+
+our @valid_options = qw{
+ ask
+ debugging
+ help
+ languages
+ lex
+ maintainer
+ step
+ target
+ verbose
+ yacc
+};
+
+our $script = q{tools/dev/reconfigure.pl};
+
+my %short_circuits = (
+ help => \&print_help,
+);
+
+our %options_components = (
+ 'valid_options' => \@valid_options,
+ 'script' => $script,
+ 'short_circuits' => \%short_circuits,
+ 'conditionals' => \&conditional_assignments,
+);
+
+sub conditional_assignments {
+ my $argsref = shift;
+ $argsref->{debugging} = 1
+ unless ( ( exists $argsref->{debugging} ) && !$argsref->{debugging} );
+ $argsref->{maintainer} = 1
+ if defined $argsref->{lex} or defined $argsref->{yacc};
+ return $argsref;
+}
+
+sub print_help {
+ print <<"EOT";
+$script
+
+General Options:
+
+ --help Show this text
+ --verbose Output extra information
+ --step=(gen::languages)
+ Execute a single configure step
+ --target=(Makefile) Needed if --step=gen::makefiles
+ --languages="list of languages"
+ Specify a list of languages to process
+
+ --ask Have Configure ask for commonly-changed info
+
+Compile Options:
+
+ --debugging=0 Disable debugging, default = 1
+ --lex=(lexer) Use the given lexical analyzer generator
+ --yacc=(parser) Use the given parser generator
+EOT
+ return 1;
+}
+
+1;
View
4 lib/Parrot/Configure/Options/Test.pm
@@ -78,9 +78,7 @@ In F<Configure.pl>:
$args = process_options( {
argv => [ @ARGV ],
- script => $0,
- parrot_version => $parrot_version,
- svnid => '$Id$',
+ mode => q{configure},
} );
$opttest = Parrot::Configure::Options::Test->new($args);
View
163 t/configure/001-options.t
@@ -12,12 +12,15 @@ BEGIN {
our $topdir = realpath($Bin) . "/../..";
unshift @INC, qq{$topdir/lib};
}
-use Test::More tests => 33;
+use Test::More tests => 37;
use Carp;
use_ok(
'Parrot::Configure::Options', qw|
process_options
- get_valid_options
+ |
+);
+use_ok("Parrot::Configure::Options::Conf", qw|
+ @valid_options
|
);
use_ok("Parrot::IO::Capture::Mini");
@@ -25,7 +28,9 @@ use_ok("Parrot::IO::Capture::Mini");
my %valid;
my $badoption = q{samsonanddelilah};
-%valid = map { $_, 1 } get_valid_options();
+no warnings 'once';
+%valid = map { $_, 1 } @Parrot::Configure::Options::Conf::valid_options;
+use warnings;
ok( scalar keys %valid, "non-zero quantity of valid options found" );
ok( defined $valid{debugging}, "debugging option found" );
ok( defined $valid{maintainer}, "maintainer option found" );
@@ -33,6 +38,8 @@ ok( defined $valid{help}, "help option found" );
ok( defined $valid{version}, "version option found" );
ok( defined $valid{verbose}, "verbose option found" );
ok( !defined $valid{$badoption}, "invalid option not found" );
+ok( !defined $valid{step}, "invalid 'step' option not found" );
+ok( !defined $valid{target}, "invalid 'target' option not found" );
open my $FH, '<', "$main::topdir/Configure.pl"
or croak "Unable to open handle to $main::topdir/Configure.pl: $!";
@@ -63,62 +70,38 @@ foreach my $m (@possible_methods) {
}
ok( !$invalid, "No invalid methods described in POD" );
-my $parrot_version = '0.4.10';
-my $svnid = '$Id$';
-my ($args);
+my $args;
$args = process_options(
{
argv => [],
- script => $0,
- parrot_version => $parrot_version,
- svnid => $svnid,
+ mode => q{configure},
}
);
ok( defined $args, "process_options() returned successfully" );
ok( $args->{debugging}, "debugging turned on by default" );
-eval { $args = process_options( { argv => [], script => $0, svnid => $svnid, } ); };
+eval { $args = process_options( { argv => [] } ); };
like(
$@,
- qr/Must provide argument 'parrot_version'/,
- "process_options() failed due to lack of argument 'parrot_version'"
+ qr/'mode' argument not provided to process_options\(\)/,
+ "process_options() failed due to lack of argument 'mode'"
);
-eval {
- $args = process_options(
- {
- argv => [],
- script => $0,
- parrot_version => $parrot_version,
- }
- );
-};
+eval { $args = process_options( { argv => [], mode => 'foobar' } ); };
like(
$@,
- qr/Must provide argument 'svnid'/,
- "process_options() failed due to lack of argument 'svnid'"
+ qr/Invalid value for 'mode' argument to process_options\(\)/,
+ "process_options() failed due to invalid 'mode' argument"
);
$args = process_options(
{
- script => $0,
- parrot_version => $parrot_version,
- svnid => $svnid,
+ mode => q{configure},,
}
);
ok( defined $args,
"process_options() returned successfully even though no explicit 'argv' key was provided" );
-$args = process_options(
- {
- argv => [],
- parrot_version => $parrot_version,
- svnid => $svnid,
- }
-);
-ok( defined $args,
- "process_options() returned successfully even though no explicit 'scripts' key was provided" );
-
my $CC = "/usr/bin/gcc-3.3";
my $CX = "/usr/bin/g++-3.3";
$args = process_options(
@@ -127,9 +110,7 @@ $args = process_options(
q{--cc=$CC}, q{--cxx=$CX}, q{--link=$CX}, q{--ld=$CX},
q{--without-icu}, q{--without-gmp},
],
- script => $0,
- parrot_version => $parrot_version,
- svnid => $svnid,
+ mode => q{configure},
}
);
ok( defined $args, "process_options() returned successfully when options were specified" );
@@ -137,10 +118,38 @@ ok( defined $args, "process_options() returned successfully when options were sp
eval {
$args = process_options(
{
- argv => [qq<--${badoption}=72>],
- script => $0,
- parrot_version => $parrot_version,
- svnid => $svnid,
+ argv => [qq<--${badoption}=72>],
+ mode => q{configure},
+ }
+ );
+};
+like(
+ $@,
+ qr/^Invalid option.*$badoption/,
+ "process_options() failed due to bad option '$badoption'"
+);
+
+$badoption = q{step};
+eval {
+ $args = process_options(
+ {
+ argv => [qq<--${badoption}>],
+ mode => q{configure},
+ }
+ );
+};
+like(
+ $@,
+ qr/^Invalid option.*$badoption/,
+ "process_options() failed due to bad option '$badoption'"
+);
+
+$badoption = q{target};
+eval {
+ $args = process_options(
+ {
+ argv => [qq<--${badoption}>],
+ mode => q{configure},
}
);
};
@@ -156,15 +165,14 @@ like(
or croak "Unable to tie";
$args = process_options(
{
- argv => [q{--help}],
- script => $0,
- parrot_version => $parrot_version,
- svnid => $svnid,
+ argv => [q{--help}],
+ mode => q{configure},
}
);
- ok( !defined $args, "process_options() returned undef after 'help' option" );
+ ok( !defined $args,
+ "process_options() returned undef after 'help' option" );
$msg = $tie->READLINE;
- like( $msg, qr/--help/i, "got correct message after 'version' option" );
+ like( $msg, qr/--help/i, "got correct message after 'help' option" );
}
{
@@ -173,15 +181,14 @@ like(
or croak "Unable to tie";
$args = process_options(
{
- argv => [q{--}],
- script => $0,
- parrot_version => $parrot_version,
- svnid => $svnid,
+ argv => [q{--}],
+ mode => q{configure},
}
);
- ok( !defined $args, "process_options() returned undef after 'help' option: case '--'" );
+ ok( !defined $args,
+ "process_options() returned undef after '--' option triggered help message" );
$msg = $tie->READLINE;
- like( $msg, qr/--help/i, "got correct message after 'version' option" );
+ like( $msg, qr/--help/i, "got help message as expected");
}
{
@@ -190,45 +197,40 @@ like(
or croak "Unable to tie";
$args = process_options(
{
- argv => [q{--version}],
- script => $0,
- parrot_version => $parrot_version,
- svnid => $svnid,
+ argv => [q{--version}],
+ mode => q{configure},
}
);
- ok( !defined $args, "process_options() returned undef after 'version' option" );
+ ok( !defined $args,
+ "process_options() returned undef after 'version' option" );
$msg = $tie->READLINE;
like( $msg, qr/Parrot Version/i, "got correct message after 'version' option" );
}
$args = process_options(
{
- argv => [ q{--lex}, ],
- script => $0,
- parrot_version => $parrot_version,
- svnid => $svnid,
+ argv => [ q{--lex}, ],
+ mode => q{configure},
}
);
-ok( defined $args, "process_options() returned successfully after 'lex' option" );
+ok( defined $args,
+ "process_options() returned successfully after 'lex' option" );
ok( $args->{maintainer}, "'maintainer' attribute is true after 'lex' option" );
$args = process_options(
{
- argv => [ q{--yacc}, ],
- script => $0,
- parrot_version => $parrot_version,
- svnid => $svnid,
+ argv => [ q{--yacc}, ],
+ mode => q{configure},
}
);
-ok( defined $args, "process_options() returned successfully after 'yacc' option" );
+ok( defined $args,
+ "process_options() returned successfully after 'yacc' option" );
ok( $args->{maintainer}, "'maintainer' attribute is true after 'yacc' option" );
$args = process_options(
{
- argv => [q{--debugging=1}],
- script => $0,
- parrot_version => $parrot_version,
- svnid => $svnid,
+ argv => [q{--debugging=1}],
+ mode => q{configure},
}
);
ok( defined $args, "process_options() returned successfully" );
@@ -236,10 +238,8 @@ ok( $args->{debugging}, "debugging turned on explicitly" );
$args = process_options(
{
- argv => [q{--debugging=0}],
- script => $0,
- parrot_version => $parrot_version,
- svnid => $svnid,
+ argv => [q{--debugging=0}],
+ mode => q{configure},
}
);
ok( defined $args, "process_options() returned successfully" );
@@ -251,7 +251,7 @@ pass("Completed all tests in $0");
=head1 NAME
-001-options.t - test Parrot::Configure::Options
+001-options.t - test Parrot::Configure::Options as used in Configure.pl
=head1 SYNOPSIS
@@ -262,7 +262,8 @@ pass("Completed all tests in $0");
The files in this directory test functionality used by F<Configure.pl>.
The tests in this file test subroutines exported by
-Parrot::Configure::Options.
+Parrot::Configure::Options as it is used in F<Configure.pl>, I<i.e.>, with
+C<mode => configure>..
=head1 AUTHOR
@@ -270,7 +271,7 @@ James E Keenan
=head1 SEE ALSO
-Parrot::Configure::Options, F<Configure.pl>.
+Parrot::Configure::Options, Parrot::Configure::Options::Conf, F<Configure.pl>.
=cut
View
5 t/configure/002-messages.t
@@ -48,13 +48,12 @@ my $make_version = 'gnu make';
$msg = $tie->READLINE;
# Following test is definitive.
- like( $msg, qr/$make_version/, "Message included make version supplied as argument" );
+ like( $msg, qr/$make_version/,
+ "Message included make version supplied as argument" );
undef $tie;
}
-# print_conclusion($make_version);
-
pass("Completed all tests in $0");
################### DOCUMENTATION ###################
View
12 t/configure/004-configure.t
@@ -6,33 +6,25 @@
use strict;
use warnings;
-use Test::More tests => 31;
+use Test::More tests => 30;
use Carp;
use lib qw( . lib ../lib ../../lib );
-use Parrot::BuildUtil;
use Parrot::Configure;
use Parrot::Configure::Options qw( process_options );
use_ok('Parrot::Configure::Step::List', qw|
get_steps_list
| );
-my $parrot_version = Parrot::BuildUtil::parrot_version();
-like($parrot_version, qr/\d+\.\d+\.\d+/,
- "Parrot version is in 3-part format");
-
$| = 1;
is($|, 1, "output autoflush is set");
my $CC = "/usr/bin/gcc-3.3";
my $localargv = [
qq{--cc=$CC},
- qq{--step=init::manifest},
];
my $args = process_options( {
+ mode => q{configure},
argv => $localargv,
- script => $0,
- parrot_version => $parrot_version,
- svnid => '$Id$',
} );
ok(defined $args, "process_options returned successfully");
my %args = %$args;
View
11 t/configure/005-run_one_step.t
@@ -6,26 +6,19 @@
use strict;
use warnings;
-use Test::More tests => 23;
+use Test::More tests => 22;
use Carp;
use lib qw( . lib ../lib ../../lib t/configure/testlib );
-use Parrot::BuildUtil;
use Parrot::Configure;
use Parrot::Configure::Options qw( process_options );
use Parrot::IO::Capture::Mini;
-my $parrot_version = Parrot::BuildUtil::parrot_version();
-like($parrot_version, qr/\d+\.\d+\.\d+/,
- "Parrot version is in 3-part format");
-
$| = 1;
is($|, 1, "output autoflush is set");
my $args = process_options( {
argv => [],
- script => $0,
- parrot_version => $parrot_version,
- svnid => '$Id$',
+ mode => q{configure},
} );
ok(defined $args, "process_options returned successfully");
my %args = %$args;
View
10 t/configure/006-bad_step.t
@@ -6,26 +6,20 @@
use strict;
use warnings;
-use Test::More tests => 13;
+use Test::More tests => 12;
use Carp;
use lib qw( . lib ../lib ../../lib );
-use Parrot::BuildUtil;
use Parrot::Configure;
use Parrot::Configure::Options qw( process_options );
use Parrot::IO::Capture::Mini;
-my $parrot_version = Parrot::BuildUtil::parrot_version();
-like($parrot_version, qr/\d+\.\d+\.\d+/,
- "Parrot version is in 3-part format");
$| = 1;
is($|, 1, "output autoflush is set");
my $args = process_options( {
argv => [],
- script => $0,
- parrot_version => $parrot_version,
- svnid => '$Id$',
+ mode => q{configure},
} );
ok(defined $args, "process_options returned successfully");
my %args = %$args;
View
11 t/configure/007-verbose_two.t
@@ -6,26 +6,19 @@
use strict;
use warnings;
-use Test::More tests => 14;
+use Test::More tests => 13;
use Carp;
use lib qw( . lib ../lib ../../lib t/configure/testlib );
-use Parrot::BuildUtil;
use Parrot::Configure;
use Parrot::Configure::Options qw( process_options );
use Parrot::IO::Capture::Mini;
-my $parrot_version = Parrot::BuildUtil::parrot_version();
-like($parrot_version, qr/\d+\.\d+\.\d+/,
- "Parrot version is in 3-part format");
-
$| = 1;
is($|, 1, "output autoflush is set");
my $args = process_options( {
argv => [ q{--verbose=2} ],
- script => $0,
- parrot_version => $parrot_version,
- svnid => '$Id$',
+ mode => q{configure},
} );
ok(defined $args, "process_options returned successfully");
my %args = %$args;
View
11 t/configure/008-verbose_step_number.t
@@ -6,26 +6,19 @@
use strict;
use warnings;
-use Test::More tests => 14;
+use Test::More tests => 13;
use Carp;
use lib qw( . lib ../lib ../../lib t/configure/testlib );
-use Parrot::BuildUtil;
use Parrot::Configure;
use Parrot::Configure::Options qw( process_options );
use Parrot::IO::Capture::Mini;
-my $parrot_version = Parrot::BuildUtil::parrot_version();
-like($parrot_version, qr/\d+\.\d+\.\d+/,
- "Parrot version is in 3-part format");
-
$| = 1;
is($|, 1, "output autoflush is set");
my $args = process_options( {
argv => [ q{--verbose-step=1} ],
- script => $0,
- parrot_version => $parrot_version,
- svnid => '$Id$',
+ mode => q{configure},
} );
ok(defined $args, "process_options returned successfully");
my %args = %$args;
View
11 t/configure/009-verbose_step_regex.t
@@ -6,26 +6,19 @@
use strict;
use warnings;
-use Test::More tests => 14;
+use Test::More tests => 13;
use Carp;
use lib qw( . lib ../lib ../../lib t/configure/testlib );
-use Parrot::BuildUtil;
use Parrot::Configure;
use Parrot::Configure::Options qw( process_options );
use Parrot::IO::Capture::Mini;
-my $parrot_version = Parrot::BuildUtil::parrot_version();
-like($parrot_version, qr/\d+\.\d+\.\d+/,
- "Parrot version is in 3-part format");
-
$| = 1;
is($|, 1, "output autoflush is set");
my $args = process_options( {
argv => [ q{--verbose-step=foobar} ],
- script => $0,
- parrot_version => $parrot_version,
- svnid => '$Id$',
+ mode => q{configure},
} );
ok(defined $args, "process_options returned successfully");
my %args = %$args;
View
11 t/configure/010-verbose_step_number_not_called.t
@@ -6,26 +6,19 @@
use strict;
use warnings;
-use Test::More tests => 14;
+use Test::More tests => 13;
use Carp;
use lib qw( . lib ../lib ../../lib t/configure/testlib );
-use Parrot::BuildUtil;
use Parrot::Configure;
use Parrot::Configure::Options qw( process_options );
use Parrot::IO::Capture::Mini;
-my $parrot_version = Parrot::BuildUtil::parrot_version();
-like($parrot_version, qr/\d+\.\d+\.\d+/,
- "Parrot version is in 3-part format");
-
$| = 1;
is($|, 1, "output autoflush is set");
my $args = process_options( {
argv => [ q{--verbose-step=2} ],
- script => $0,
- parrot_version => $parrot_version,
- svnid => '$Id$',
+ mode => q{configure},
} );
ok(defined $args, "process_options returned successfully");
my %args = %$args;
View
11 t/configure/011-no_description.t
@@ -6,26 +6,19 @@
use strict;
use warnings;
-use Test::More tests => 14;
+use Test::More tests => 13;
use Carp;
use lib qw( . lib ../lib ../../lib t/configure/testlib );
-use Parrot::BuildUtil;
use Parrot::Configure;
use Parrot::Configure::Options qw( process_options );
use Parrot::IO::Capture::Mini;
-my $parrot_version = Parrot::BuildUtil::parrot_version();
-like($parrot_version, qr/\d+\.\d+\.\d+/,
- "Parrot version is in 3-part format");
-
$| = 1;
is($|, 1, "output autoflush is set");
my $args = process_options( {
argv => [ ],
- script => $0,
- parrot_version => $parrot_version,
- svnid => '$Id$',
+ mode => q{configure},
} );
ok(defined $args, "process_options returned successfully");
my %args = %$args;
View
11 t/configure/012-verbose.t
@@ -6,26 +6,19 @@
use strict;
use warnings;
-use Test::More tests => 14;
+use Test::More tests => 13;
use Carp;
use lib qw( . lib ../lib ../../lib t/configure/testlib );
-use Parrot::BuildUtil;
use Parrot::Configure;
use Parrot::Configure::Options qw( process_options );
use Parrot::IO::Capture::Mini;
-my $parrot_version = Parrot::BuildUtil::parrot_version();
-like($parrot_version, qr/\d+\.\d+\.\d+/,
- "Parrot version is in 3-part format");
-
$| = 1;
is($|, 1, "output autoflush is set");
my $args = process_options( {
argv => [ q{--verbose} ],
- script => $0,
- parrot_version => $parrot_version,
- svnid => '$Id$',
+ mode => q{configure},
} );
ok(defined $args, "process_options returned successfully");
my %args = %$args;
View
11 t/configure/013-die.t
@@ -6,26 +6,19 @@
use strict;
use warnings;
-use Test::More qw(no_plan); # tests => 14;
+use Test::More tests => 13;
use Carp;
use lib qw( . lib ../lib ../../lib t/configure/testlib );
-use Parrot::BuildUtil;
use Parrot::Configure;
use Parrot::Configure::Options qw( process_options );
use Parrot::IO::Capture::Mini;
-my $parrot_version = Parrot::BuildUtil::parrot_version();
-like($parrot_version, qr/\d+\.\d+\.\d+/,
- "Parrot version is in 3-part format");
-
$| = 1;
is($|, 1, "output autoflush is set");
my $args = process_options( {
argv => [ ],
- script => $0,
- parrot_version => $parrot_version,
- svnid => '$Id$',
+ mode => q{configure},
} );
ok(defined $args, "process_options returned successfully");
my %args = %$args;
View
11 t/configure/014-params.t
@@ -6,26 +6,19 @@
use strict;
use warnings;
-use Test::More tests => 14;
+use Test::More tests => 13;
use Carp;
use lib qw( . lib ../lib ../../lib t/configure/testlib );
-use Parrot::BuildUtil;
use Parrot::Configure;
use Parrot::Configure::Options qw( process_options );
use Parrot::IO::Capture::Mini;
-my $parrot_version = Parrot::BuildUtil::parrot_version();
-like($parrot_version, qr/\d+\.\d+\.\d+/,
- "Parrot version is in 3-part format");
-
$| = 1;
is($|, 1, "output autoflush is set");
my $args = process_options( {
argv => [ ],
- script => $0,
- parrot_version => $parrot_version,
- svnid => '$Id$',
+ mode => q{configure},
} );
ok(defined $args, "process_options returned successfully");
my %args = %$args;
View
11 t/configure/015-no_return.t
@@ -6,26 +6,19 @@
use strict;
use warnings;
-use Test::More tests => 15;
+use Test::More tests => 14;
use Carp;
use lib qw( . lib ../lib ../../lib t/configure/testlib );
-use Parrot::BuildUtil;
use Parrot::Configure;
use Parrot::Configure::Options qw( process_options );
use Parrot::IO::Capture::Mini;
-my $parrot_version = Parrot::BuildUtil::parrot_version();
-like($parrot_version, qr/\d+\.\d+\.\d+/,
- "Parrot version is in 3-part format");
-
$| = 1;
is($|, 1, "output autoflush is set");
my $args = process_options( {
argv => [ ],
- script => $0,
- parrot_version => $parrot_version,
- svnid => '$Id$',
+ mode => q{configure},
} );
ok(defined $args, "process_options returned successfully");
my %args = %$args;
View
11 t/configure/016-no_return_but_result.t
@@ -6,26 +6,19 @@
use strict;
use warnings;
-use Test::More qw(no_plan); # tests => 15;
+use Test::More tests => 11;
use Carp;
use lib qw( . lib ../lib ../../lib t/configure/testlib );
-use Parrot::BuildUtil;
use Parrot::Configure;
use Parrot::Configure::Options qw( process_options );
use Parrot::IO::Capture::Mini;
-my $parrot_version = Parrot::BuildUtil::parrot_version();
-like($parrot_version, qr/\d+\.\d+\.\d+/,
- "Parrot version is in 3-part format");
-
$| = 1;
is($|, 1, "output autoflush is set");
my $args = process_options( {
argv => [ ],
- script => $0,
- parrot_version => $parrot_version,
- svnid => '$Id$',
+ mode => q{configure},
} );
ok(defined $args, "process_options returned successfully");
my %args = %$args;
View
9 t/configure/025-options_test.t
@@ -21,17 +21,14 @@ use_ok("Parrot::Configure::Options::Test");
my ($args, $opttest);
-my $parrot_version = '0.4.10';
-my $svnid = '$Id$';
$args = process_options(
{
argv => [ q{--test} ],
- script => $0,
- parrot_version => $parrot_version,
- svnid => $svnid,
+ mode => q{configure},
}
);
-ok( defined $args, "process_options() returned successfully when options were specified" );
+ok( defined $args,
+ "process_options() returned successfully when options were specified" );
$opttest = Parrot::Configure::Options::Test->new($args);
ok(defined $opttest, "Constructor returned successfully");
View
127 t/configure/026-options_test.t
@@ -0,0 +1,127 @@
+#! perl
+# Copyright (C) 2007, The Perl Foundation.
+# $Id$
+# 026-options_test.t
+
+use strict;
+use warnings;
+use Carp;
+use Cwd;
+use Data::Dumper;
+use File::Temp qw( tempdir );
+use Test::More tests => 14;
+use lib qw( . lib ../lib ../../lib );
+use_ok('Parrot::IO::Capture::Mini');
+use_ok(
+ 'Parrot::Configure::Options', qw|
+ process_options
+ |
+);
+use_ok("Parrot::Configure::Options::Test");
+
+my ($args, $opttest);
+
+$args = process_options(
+ {
+ argv => [ ],
+ mode => q{configure},
+ }
+);
+ok( defined $args,
+ "process_options() returned successfully when no options were specified" );
+
+$opttest = Parrot::Configure::Options::Test->new($args);
+ok(defined $opttest, "Constructor returned successfully");
+
+my ($tie, @lines);
+{
+ $tie = tie *STDOUT, "Parrot::IO::Capture::Mini"
+ or croak "Unable to tie";
+ $opttest->run_configure_tests();
+ @lines = $tie->READLINE;
+}
+ok(! scalar(@lines),
+ "Nothing captured because no pre-configuration tests were run.");
+
+@lines = ();
+{
+ $tie = tie *STDOUT, "Parrot::IO::Capture::Mini"
+ or croak "Unable to tie";
+ $opttest->run_build_tests();
+ @lines = $tie->READLINE;
+}
+ok(! scalar(@lines),
+ "Nothing captured because no pre-build tests were run.");
+
+$args = process_options(
+ {
+ argv => [ q{--test=configure} ],
+ mode => q{configure},
+ }
+);
+ok( defined $args,
+ "process_options() returned successfully when '--test=configure' was specified" );
+
+$opttest = Parrot::Configure::Options::Test->new($args);
+ok(defined $opttest, "Constructor returned successfully");
+
+$args = process_options(
+ {
+ argv => [ q{--test=build} ],
+ mode => q{configure},
+ }
+);
+ok( defined $args,
+ "process_options() returned successfully when '--test=build' was specified" );
+
+$opttest = Parrot::Configure::Options::Test->new($args);
+ok(defined $opttest, "Constructor returned successfully");
+
+my $badoption = q{foobar};
+$args = process_options(
+ {
+ argv => [ qq{--test=$badoption} ],
+ mode => q{configure},
+ }
+);
+ok( defined $args,
+ "process_options() returned successfully when '--test=$badoption' was specified" );
+
+eval { $opttest = Parrot::Configure::Options::Test->new($args); };
+like($@, qr/'$badoption' is a bad value/,
+ "Bad option to '--test' correctly detected");
+
+pass("Completed all tests in $0");
+
+################### DOCUMENTATION ###################
+
+=head1 NAME
+
+026-options_test.t - test Parrot::Configure::Options::Test
+
+=head1 SYNOPSIS
+
+ % prove t/configure/026-options_test.t
+
+=head1 DESCRIPTION
+
+The files in this directory test functionality used by F<Configure.pl>.
+
+The tests in this file test Parrot::Configure::Options::Test methods.
+
+=head1 AUTHOR
+
+James E Keenan
+
+=head1 SEE ALSO
+
+Parrot::Configure::Options, F<Configure.pl>.
+
+=cut
+
+# Local Variables:
+# mode: cperl
+# cperl-indent-level: 4
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:
View
78 t/configure/027-option_or_data.t
@@ -0,0 +1,78 @@
+#! perl
+# Copyright (C) 2007, The Perl Foundation.
+# $Id$
+# 027-option_or_data.t
+
+use strict;
+use warnings;
+
+use Test::More tests => 8;
+use Carp;
+use lib qw( . lib ../lib ../../lib );
+use Parrot::Configure;
+use Parrot::Configure::Options qw( process_options );
+use_ok('Parrot::Configure::Step::List', qw|
+ get_steps_list
+| );
+
+$| = 1;
+is($|, 1, "output autoflush is set");
+
+my $CC = "/usr/bin/gcc-3.3";
+my $localargv = [
+ qq{--cc=$CC},
+];
+my $args = process_options( {
+ mode => q{configure},
+ argv => $localargv,
+} );
+ok(defined $args, "process_options returned successfully");
+my %args = %$args;
+
+my $conf = Parrot::Configure->new;
+ok(defined $conf, "Parrot::Configure->new() returned okay");
+isa_ok($conf, "Parrot::Configure");
+
+$conf->add_steps(get_steps_list());
+
+$conf->options->set(%args);
+is($conf->options->{c}->{cc}, $CC,
+ "command-line option '--cc' has been stored in object");
+
+my $val = $conf->option_or_data('cc');
+is($val, $CC, 'option_or_data() returned expected value');
+
+pass("Completed all tests in $0");
+
+################### DOCUMENTATION ###################
+
+=head1 NAME
+
+027-option_or_data.t - test C<Parrot::Configure::option_or_data()>
+
+=head1 SYNOPSIS
+
+ % prove t/configure/027-option_or_data.t
+
+=head1 DESCRIPTION
+
+The files in this directory test functionality used by F<Configure.pl>.
+
+This file tests C<Parrot::Configure::option_or_data()>.
+
+=head1 AUTHOR
+
+James E Keenan
+
+=head1 SEE ALSO
+
+Parrot::Configure, F<Configure.pl>.
+
+=cut
+
+# Local Variables:
+# mode: cperl
+# cperl-indent-level: 4
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:
View
94 t/configure/028-option_or_data.t
@@ -0,0 +1,94 @@
+#! perl
+# Copyright (C) 2007, The Perl Foundation.
+# $Id$
+# 028-option_or_data.t
+
+use strict;
+use warnings;
+
+use Test::More tests => 25;
+use Carp;
+use lib qw( . lib ../lib ../../lib );
+use_ok('config::init::defaults');
+use_ok('config::init::install');
+use_ok('config::init::hints');
+use_ok('config::inter::progs');
+use Parrot::Configure;
+use Parrot::Configure::Options qw( process_options );
+use Parrot::Configure::Test qw( test_step_thru_runstep);
+use_ok('Parrot::Configure::Step::List', qw|
+ get_steps_list
+| );
+
+$| = 1;
+is($|, 1, "output autoflush is set");
+
+#my $CC = "/usr/bin/gcc-3.3";
+my $localargv = [
+];
+my $args = process_options( {
+ mode => q{configure},
+ argv => $localargv,
+} );
+ok(defined $args, "process_options returned successfully");
+
+my $conf = Parrot::Configure->new;
+
+test_step_thru_runstep($conf, q{init::defaults}, $args);
+test_step_thru_runstep($conf, q{init::install}, $args);
+test_step_thru_runstep($conf, q{init::hints}, $args);
+
+my ($task, $step_name, @step_params, $step, $ret);
+my $pkg = q{inter::progs};
+
+$conf->add_steps($pkg);
+$conf->options->set(%{$args});
+
+$task = $conf->steps->[3];
+$step_name = $task->step;
+@step_params = @{ $task->params };
+
+$step = $step_name->new();
+ok(defined $step, "$step_name constructor returned defined value");
+isa_ok($step, $step_name);
+ok($step->description(), "$step_name has description");
+$ret = $step->runstep($conf);
+ok(defined $ret, "$step_name runstep() returned defined value");
+
+my $val = $conf->option_or_data('cc');
+is($val, q{cc}, 'option_or_data() returned expected value');
+
+pass("Completed all tests in $0");
+
+################### DOCUMENTATION ###################
+
+=head1 NAME
+
+028-option_or_data.t - test C<Parrot::Configure::option_or_data()>
+
+=head1 SYNOPSIS
+
+ % prove t/configure/028-option_or_data.t
+
+=head1 DESCRIPTION
+
+The files in this directory test functionality used by F<Configure.pl>.
+
+This file tests C<Parrot::Configure::option_or_data()>.
+
+=head1 AUTHOR
+
+James E Keenan
+
+=head1 SEE ALSO
+
+Parrot::Configure, F<Configure.pl>.
+
+=cut
+
+# Local Variables:
+# mode: cperl
+# cperl-indent-level: 4
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:
View
95 t/configure/029-option_or_data.t
@@ -0,0 +1,95 @@
+#! perl
+# Copyright (C) 2007, The Perl Foundation.
+# $Id$
+# 029-option_or_data.t
+
+use strict;
+use warnings;
+
+use Test::More tests => 25;
+use Carp;
+use lib qw( . lib ../lib ../../lib );
+use_ok('config::init::defaults');
+use_ok('config::init::install');
+use_ok('config::init::hints');
+use_ok('config::inter::progs');
+use Parrot::Configure;
+use Parrot::Configure::Options qw( process_options );
+use Parrot::Configure::Test qw( test_step_thru_runstep);
+use_ok('Parrot::Configure::Step::List', qw|
+ get_steps_list
+| );
+
+$| = 1;
+is($|, 1, "output autoflush is set");
+
+my $CC = "/usr/bin/gcc-3.3";
+my $localargv = [
+ qq{--cc=$CC},
+];
+my $args = process_options( {
+ mode => q{configure},
+ argv => $localargv,
+} );
+ok(defined $args, "process_options returned successfully");
+
+my $conf = Parrot::Configure->new;
+
+test_step_thru_runstep($conf, q{init::defaults}, $args);
+test_step_thru_runstep($conf, q{init::install}, $args);
+test_step_thru_runstep($conf, q{init::hints}, $args);
+
+my ($task, $step_name, @step_params, $step, $ret);
+my $pkg = q{inter::progs};
+
+$conf->add_steps($pkg);
+$conf->options->set(%{$args});
+
+$task = $conf->steps->[3];
+$step_name = $task->step;
+@step_params = @{ $task->params };
+
+$step = $step_name->new();
+ok(defined $step, "$step_name constructor returned defined value");
+isa_ok($step, $step_name);
+ok($step->description(), "$step_name has description");
+$ret = $step->runstep($conf);
+ok(defined $ret, "$step_name runstep() returned defined value");
+
+my $val = $conf->option_or_data('cc');
+is($val, $CC, 'option_or_data() returned expected value');
+
+pass("Completed all tests in $0");
+
+################### DOCUMENTATION ###################
+
+=head1 NAME
+
+029-option_or_data.t - test C<Parrot::Configure::option_or_data()>
+
+=head1 SYNOPSIS
+
+ % prove t/configure/029-option_or_data.t
+
+=head1 DESCRIPTION
+
+The files in this directory test functionality used by F<Configure.pl>.
+
+This file tests C<Parrot::Configure::option_or_data()>.
+
+=head1 AUTHOR
+
+James E Keenan
+
+=head1 SEE ALSO
+
+Parrot::Configure, F<Configure.pl>.
+
+=cut
+
+# Local Variables:
+# mode: cperl
+# cperl-indent-level: 4
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:
View
87 t/configure/030-option_or_data.t
@@ -0,0 +1,87 @@
+#! perl
+# Copyright (C) 2007, The Perl Foundation.
+# $Id$
+# 030-option_or_data.t
+
+use strict;
+use warnings;
+
+use Test::More tests => 7;
+use Carp;
+use lib qw( . lib ../lib ../../lib t/configure/testlib );
+use Parrot::Configure;
+use Parrot::Configure::Options qw( process_options );
+use Parrot::Configure::Test qw( test_step_thru_runstep);
+use Parrot::IO::Capture::Mini;
+use_ok('Parrot::Configure::Step::List', qw|
+ get_steps_list
+| );
+
+$| = 1;
+is($|, 1, "output autoflush is set");
+
+my $localargv = [ ];
+my $args = process_options( {
+ mode => q{configure},
+ argv => $localargv,
+} );
+ok(defined $args, "process_options returned successfully");
+
+my $conf = Parrot::Configure->new;
+ok(defined $conf, "Parrot::Configure->new() returned okay");
+
+my $step = q{init::foobar};
+my $description = 'Determining if your computer does foobar';
+
+$conf->add_steps( $step );
+$conf->options->set(%{$args});
+
+my $rv;
+my ($tie, @lines);
+{
+ $tie = tie *STDOUT, "Parrot::IO::Capture::Mini"
+ or croak "Unable to tie";
+ $rv = $conf->runsteps;
+ @lines = $tie->READLINE;
+}
+my $bigmsg = join q{}, @lines;
+like($bigmsg,
+ qr/$description/s,
+ "Got message expected upon running $step");
+ok(! defined ($conf->option_or_data('cc') ),
+ "option_or_data returned undef; neither option nor data had been defined");
+
+pass("Completed all tests in $0");
+
+################### DOCUMENTATION ###################
+
+=head1 NAME
+
+030-option_or_data.t - test C<Parrot::Configure::option_or_data()>
+
+=head1 SYNOPSIS
+
+ % prove t/configure/030-option_or_data.t
+
+=head1 DESCRIPTION
+
+The files in this directory test functionality used by F<Configure.pl>.
+
+This file tests C<Parrot::Configure::option_or_data()>.
+
+=head1 AUTHOR
+
+James E Keenan
+
+=head1 SEE ALSO
+
+Parrot::Configure, F<Configure.pl>.
+
+=cut
+
+# Local Variables:
+# mode: cperl
+# cperl-indent-level: 4
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:
View
6 t/configure/101-init_manifest.01.t
@@ -10,7 +10,6 @@ use Carp;
use Data::Dumper;
use lib qw( . lib ../lib ../../lib );
use_ok('config::init::manifest');
-use Parrot::BuildUtil;
use Parrot::Configure;
use Parrot::Configure::Options qw( process_options );
@@ -20,12 +19,9 @@ thinks there are files missing from those listed in the MANIFEST.
=cut
my $pkg = q{init::manifest};
-my $parrot_version = Parrot::BuildUtil::parrot_version();
my $args = process_options( {
argv => [ q{--nomanicheck} ],
- script => $0,
- parrot_version => $parrot_version,
- svnid => '$Id$',
+ mode => q{configure},
} );
my $conf = Parrot::Configure->new;
View
6 t/configure/101-init_manifest.02.t
@@ -13,7 +13,6 @@ use File::Copy;
use File::Temp qw(tempdir);
use lib qw( . lib ../lib ../../lib );
use_ok('config::init::manifest');
-use Parrot::BuildUtil;
use Parrot::Configure;
use Parrot::Configure::Options qw( process_options );
use Parrot::IO::Capture::Mini;
@@ -24,12 +23,9 @@ thinks there are files missing from those listed in the MANIFEST.
=cut
my $pkg = q{init::manifest};
-my $parrot_version = Parrot::BuildUtil::parrot_version();
my $args = process_options( {
argv => [ ],
- script => $0,
- parrot_version => $parrot_version,
- svnid => '$Id$',
+ mode => q{configure},
} );
my $conf = Parrot::Configure->new;
View
6 t/configure/102-init_defaults.01.t
@@ -10,12 +10,10 @@ use Carp;
use Data::Dumper;
use lib qw( . lib ../lib ../../lib );
use_ok('config::init::defaults');
-use Parrot::BuildUtil;
use Parrot::Configure;
use Parrot::Configure::Options qw( process_options );
my $pkg = q{init::defaults};
-my $parrot_version = Parrot::BuildUtil::parrot_version();
my $args = process_options( {
argv => [q{--debugging=0}, q{--profile}, q{--m=32}],
# These 3 options are non-default and inside
@@ -25,9 +23,7 @@ my $args = process_options( {
# coverage analysis will cover the default
# branches/conditions. Hence, we supply the
# non-default options here to increase coverage.
- script => $0,
- parrot_version => $parrot_version,
- svnid => '$Id$',
+ mode => q{configure},
} );
my $conf = Parrot::Configure->new;
View
6 t/configure/102-init_defaults.02.t
@@ -12,7 +12,6 @@ use_ok( 'File::Copy' );
use_ok( 'File::Temp', qw| tempdir | );
use lib qw( . lib ../lib ../../lib );
use_ok('config::init::defaults');
-use Parrot::BuildUtil;
use Parrot::Configure;