Author: jkeenan
Date: Fri Nov 23 12:13:05 2007
New Revision: 23003

Added:
   branches/nointer/lib/Parrot/Configure/Initialize/Headers.pm   (contents, 
props changed)
Modified:
   branches/nointer/MANIFEST
   branches/nointer/lib/Parrot/Configure/Initialize.pm
   branches/nointer/lib/Parrot/Configure/Initialize/Defaults.pm
   branches/nointer/lib/Parrot/Configure/Initialize/Hints.pm
   branches/nointer/lib/Parrot/Configure/Initialize/Hints/linux.pm
   branches/nointer/lib/Parrot/Configure/Initialize/Install.pm
   branches/nointer/lib/Parrot/Configure/Initialize/Miniparrot.pm
   branches/nointer/t/configure/065-init_hints-04.t

Log:
Add Parrot::Configure::Initialize::Headers.  Add
Parrot::Configure::Initialize::get_options() and options_or_data() and use
them in the Parrot::Configure::Initialize packages.


Modified: branches/nointer/MANIFEST
==============================================================================
--- branches/nointer/MANIFEST   (original)
+++ branches/nointer/MANIFEST   Fri Nov 23 12:13:05 2007
@@ -1,7 +1,7 @@
 # ex: set ro:
 # $Id$
 #
-# generated by tools/dev/mk_manifest_and_skip.pl Fri Nov 23 13:17:06 2007 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Fri Nov 23 20:08:50 2007 UT
 #
 # See tools/dev/install_files.pl for documentation on the
 # format of this file.
@@ -2363,6 +2363,7 @@
 lib/Parrot/Configure/Data.pm                                [devel]
 lib/Parrot/Configure/Initialize.pm                          [devel]
 lib/Parrot/Configure/Initialize/Defaults.pm                 [devel]
+lib/Parrot/Configure/Initialize/Headers.pm                  [devel]
 lib/Parrot/Configure/Initialize/Hints.pm                    [devel]
 lib/Parrot/Configure/Initialize/Hints/aix.pm                [devel]
 lib/Parrot/Configure/Initialize/Hints/cygwin.pm             [devel]

Modified: branches/nointer/lib/Parrot/Configure/Initialize.pm
==============================================================================
--- branches/nointer/lib/Parrot/Configure/Initialize.pm (original)
+++ branches/nointer/lib/Parrot/Configure/Initialize.pm Fri Nov 23 12:13:05 2007
@@ -62,6 +62,20 @@
     return @[EMAIL PROTECTED];
 }
 
+sub get_options {
+    my $self = shift;
+    my $data = $self->{options};
+    return @[EMAIL PROTECTED];
+}
+
+sub option_or_data {
+    my $self = shift;
+    my $arg  = shift;
+
+    my $opt = $self->options->get($arg);
+    return defined $opt ? $opt : $self->get($arg);
+}
+
 1;
 
 #################### DOCUMENTATION ####################

Modified: branches/nointer/lib/Parrot/Configure/Initialize/Defaults.pm
==============================================================================
--- branches/nointer/lib/Parrot/Configure/Initialize/Defaults.pm        
(original)
+++ branches/nointer/lib/Parrot/Configure/Initialize/Defaults.pm        Fri Nov 
23 12:13:05 2007
@@ -27,8 +27,10 @@
 sub _init_from_options {
     my $self = shift;
     $self->set(
-        debugging => $self->{options}->{debugging} ? 1 : 0,
-        verbose   => $self->{options}->{verbose},
+#        debugging => $self->{options}->{debugging} ? 1 : 0,
+#        verbose   => $self->{options}->{verbose},
+        debugging => $self->get_options('debugging') ? 1 : 0,
+        verbose   => $self->get_options('verbose'),
     );
 }
 
@@ -212,7 +214,8 @@
     # RT#41497 gcc syntax
     # we should have this in the hints files e.g. cc_profile
     # RT#41496 move profiling to it's own step
-    if ( $self->{options}->{profile} ) {
+#    if ( $self->{options}->{profile} ) {
+    if ( $self->get_options('profile') ) {
         $self->set(
             cc_debug => " -pg ",
             ld_debug => " -pg ",
@@ -224,7 +227,8 @@
     my $self = shift;
     # adjust archname, cc and libs for e.g. --m=32
     # RT#41499 this is maybe gcc only
-    my $m        = $self->{options}->{m};
+#    my $m        = $self->{options}->{m};
+    my $m        = $self->get_options('m');
     my $archname = $Config{archname};
     if ($m) {
         if ( $archname =~ /x86_64/ && $m eq '32' ) {

Added: branches/nointer/lib/Parrot/Configure/Initialize/Headers.pm
==============================================================================
--- (empty file)
+++ branches/nointer/lib/Parrot/Configure/Initialize/Headers.pm Fri Nov 23 
12:13:05 2007
@@ -0,0 +1,70 @@
+# Copyright (C) 2001-2006, The Perl Foundation.
+# $Id$
+package Parrot::Configure::Initialize::Headers;
+use strict;
+use warnings;
+use ExtUtils::Manifest qw(maniread);
+use lib ( "./lib" );
+
+################### SUBROUTINES ###################
+
+sub init_headers {
+    my $self = shift;
+    my $inc = 'include/parrot';
+
+    my @headers = (
+        sort
+            map { m{^$inc/(.*\.h)\z} }
+            keys %{ maniread() }
+    );
+
+    $_ = "\$(INC_DIR)/$_" for @headers;
+    my $TEMP_nongen_headers = join( "\\\n        ", @headers );
+
+    $self->set(
+        inc                 => $inc,
+        TEMP_nongen_headers => $TEMP_nongen_headers,
+    );
+    return 1;
+}
+
+1;
+
+#################### DOCUMENTATION ####################
+
+=head1 NAME
+
+Parrot::Configure::Initialize::Headers - Headers configuration
+
+=head1 SYNOPSIS
+
+    use Parrot::Configure::Initialize::Headers;
+
+=head1 DESCRIPTION
+
+Modifies settings to match headers (ANSI C Parrot)'s needs.  This step
+primarily overwrites a lot of settings in the Configure database to disable
+JIT and match ANSI characteristics.
+
+Centralizing these settings will (hopefully) allow for an eventual move away
+from using Configure at all for headers builds.
+
+=head1 SUBROUTINES
+
+=head1 NOTES
+
+The functionality in this package was transferred from the former
+C<init::headers> configuration steps by Jim Keenan.
+
+=head1 SEE ALSO
+
+F<Configure.pl>.  Parrot::Configure.  Parrot::Configure::Initialize.
+
+=cut
+
+# Local Variables:
+#   mode: cperl
+#   cperl-indent-level: 4
+#   fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:

Modified: branches/nointer/lib/Parrot/Configure/Initialize/Hints.pm
==============================================================================
--- branches/nointer/lib/Parrot/Configure/Initialize/Hints.pm   (original)
+++ branches/nointer/lib/Parrot/Configure/Initialize/Hints.pm   Fri Nov 23 
12:13:05 2007
@@ -9,7 +9,7 @@
 
 sub init_hints {
     my $self = shift;
-    my $verbose = $self->get('verbose');
+    my $verbose = $self->get_options('verbose');
 
     my $hints_used = 0;
 

Modified: branches/nointer/lib/Parrot/Configure/Initialize/Hints/linux.pm
==============================================================================
--- branches/nointer/lib/Parrot/Configure/Initialize/Hints/linux.pm     
(original)
+++ branches/nointer/lib/Parrot/Configure/Initialize/Hints/linux.pm     Fri Nov 
23 12:13:05 2007
@@ -11,24 +11,24 @@
 our $verbose;
 
 sub runstep {
-    my ( $self, $conf ) = @_;
+    my ($step, $init) = @_;
 
-    my $libs      = $conf->option_or_data('libs');
-    my $ccflags   = $conf->option_or_data('ccflags');
-    my $cc        = $conf->option_or_data('cc');
-    my $linkflags = $conf->option_or_data('linkflags');
+    my $libs      = $init->option_or_data('libs');
+    my $ccflags   = $init->option_or_data('ccflags');
+    my $cc        = $init->option_or_data('cc');
+    my $linkflags = $init->option_or_data('linkflags');
 
-    $verbose = $conf->options->get('verbose');
+    $verbose = $init->get_options('verbose');
     print $/ if $verbose;
 
     # should find g++ in most cases
-    my $link = $conf->data->get('link') || 'c++';
+    my $link = $init->get('link') || 'c++';
 
     if ( $libs !~ /-lpthread/ ) {
         $libs .= ' -lpthread';
     }
-    my $ld_share_flags = $conf->data->get('ld_share_flags');
-    my $cc_shared      = $conf->data->get('cc_shared');
+    my $ld_share_flags = $init->get('ld_share_flags');
+    my $cc_shared      = $init->get('cc_shared');
 
     if ( $cc =~ /icc/ ) {
 
@@ -129,7 +129,7 @@
         $ccflags .= ' -D_GNU_SOURCE';
     }
 
-    $conf->data->set(
+    $init->set(
         ccflags        => $ccflags,
         libs           => $libs,
         ld_share_flags => $ld_share_flags,
@@ -148,7 +148,7 @@
     );
 
     if ( ( split( '-', $Config{archname} ) )[0] eq 'ia64' ) {
-        $conf->data->set( platform_asm => 1 );
+        $init->set( platform_asm => 1 );
     }
     return;
 }

Modified: branches/nointer/lib/Parrot/Configure/Initialize/Install.pm
==============================================================================
--- branches/nointer/lib/Parrot/Configure/Initialize/Install.pm (original)
+++ branches/nointer/lib/Parrot/Configure/Initialize/Install.pm Fri Nov 23 
12:13:05 2007
@@ -9,9 +9,9 @@
 
 sub init_install {
     my $self = shift;
-    my $prefix = $self->{options}->{prefix} || "/usr/local";
+    my $prefix = $self->get_options('prefix') || "/usr/local";
     $prefix =~ s{/\z}{};
-    my $ep = $self->{options}->{'exec-prefix'};
+    my $ep = $self->get_options('exec-prefix');
     $ep =~ s{/\z}{} if defined $ep;
     my $eprefix = $ep ? $ep : $prefix;
 
@@ -72,7 +72,7 @@
 sub _assign_dir {
     my $self = shift;
     my ( $dir_str, $fix, $ext ) = @_;
-    my $d = $self->{options}->{$dir_str};
+    my $d = $self->get_options($dir_str);
     return $d ? $d : $fix . $ext;
 }
 

Modified: branches/nointer/lib/Parrot/Configure/Initialize/Miniparrot.pm
==============================================================================
--- branches/nointer/lib/Parrot/Configure/Initialize/Miniparrot.pm      
(original)
+++ branches/nointer/lib/Parrot/Configure/Initialize/Miniparrot.pm      Fri Nov 
23 12:13:05 2007
@@ -9,7 +9,7 @@
 
 sub init_miniparrot {
     my $self = shift;
-    unless ( $self->{options}->{miniparrot} ) {
+    unless ( $self->get_options('miniparrot') ) {
         return 1;
     }
 

Modified: branches/nointer/t/configure/065-init_hints-04.t
==============================================================================
--- branches/nointer/t/configure/065-init_hints-04.t    (original)
+++ branches/nointer/t/configure/065-init_hints-04.t    Fri Nov 23 12:13:05 2007
@@ -8,6 +8,7 @@
 
 use Test::More tests =>  6;
 use Carp;
+use Cwd;
 use lib qw( lib t/configure/testlib );
 use Parrot::Configure::Options qw( process_options );
 use Parrot::Configure::Initialize;

Reply via email to