[svn:parrot] r40003 - in branches/darwin2hints: . config/auto config/init/hints lib/Parrot/Configure/Options/Conf lib/Parrot/Configure/Step t/steps/auto

jkeenan at svn.parrot.org jkeenan at svn.parrot.org
Sat Jul 11 16:41:10 UTC 2009


Author: jkeenan
Date: Sat Jul 11 16:41:08 2009
New Revision: 40003
URL: https://trac.parrot.org/parrot/changeset/40003

Log:
Move detection of Fink and Macports libraries from config steps to Darwin
hints files.  Modify t/steps/ test files appropriately.  Modify config steps
that formerly used _handle_darwin_for_fink() or _handle_darwin_for_macports.
Add two configuration options:  darwin_no_fink, darwin_no_macports.

Deleted:
   branches/darwin2hints/config/auto/fink.pm
   branches/darwin2hints/config/auto/macports.pm
   branches/darwin2hints/t/steps/auto/fink-01.t
   branches/darwin2hints/t/steps/auto/macports-01.t
   branches/darwin2hints/t/steps/auto/macports-02.t
Modified:
   branches/darwin2hints/Configure.pl
   branches/darwin2hints/MANIFEST
   branches/darwin2hints/config/auto/gdbm.pm
   branches/darwin2hints/config/auto/gettext.pm
   branches/darwin2hints/config/auto/gmp.pm
   branches/darwin2hints/config/auto/opengl.pm
   branches/darwin2hints/config/auto/pcre.pm
   branches/darwin2hints/config/auto/readline.pm
   branches/darwin2hints/config/init/hints/darwin.pm
   branches/darwin2hints/lib/Parrot/Configure/Options/Conf/Shared.pm
   branches/darwin2hints/lib/Parrot/Configure/Step/List.pm
   branches/darwin2hints/lib/Parrot/Configure/Step/Methods.pm
   branches/darwin2hints/t/steps/auto/gdbm-01.t
   branches/darwin2hints/t/steps/auto/gmp-01.t
   branches/darwin2hints/t/steps/auto/readline-01.t

Modified: branches/darwin2hints/Configure.pl
==============================================================================
--- branches/darwin2hints/Configure.pl	Sat Jul 11 12:41:09 2009	(r40002)
+++ branches/darwin2hints/Configure.pl	Sat Jul 11 16:41:08 2009	(r40003)
@@ -196,6 +196,25 @@
 
 =back
 
+=item C<--configure_trace>
+
+Store the results of each configuration step in a Storable F<.sto> file on
+disk, for later analysis by F<Parrot::Configure::Trace> methods.
+
+=item Operating system-specific configuration options
+
+=over 4
+
+=item C<--darwin_no_fink>
+
+On Darwin, do not probe for Fink libraries.
+
+=item C<--darwin_no_macports>
+
+On Darwin, do not probe for Macports libraries.
+
+=back
+
 =back
 
 =head2 Compile Options

Modified: branches/darwin2hints/MANIFEST
==============================================================================
--- branches/darwin2hints/MANIFEST	Sat Jul 11 12:41:09 2009	(r40002)
+++ branches/darwin2hints/MANIFEST	Sat Jul 11 16:41:08 2009	(r40003)
@@ -1,7 +1,7 @@
 # ex: set ro:
 # $Id$
 #
-# generated by tools/dev/mk_manifest_and_skip.pl Thu Jul  9 23:58:32 2009 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Sat Jul 11 16:40:06 2009 UT
 #
 # See below for documentation on the format of this file.
 #
@@ -228,7 +228,6 @@
 config/auto/env.pm                                          []
 config/auto/env/test_setenv_c.in                            []
 config/auto/env/test_unsetenv_c.in                          []
-config/auto/fink.pm                                         []
 config/auto/format.pm                                       []
 config/auto/funcptr.pm                                      []
 config/auto/funcptr/test_c.in                               []
@@ -257,7 +256,6 @@
 config/auto/jit/test_exec_cygwin_c.in                       []
 config/auto/jit/test_exec_linux_c.in                        []
 config/auto/jit/test_exec_openbsd_c.in                      []
-config/auto/macports.pm                                     []
 config/auto/memalign.pm                                     []
 config/auto/memalign/test2_c.in                             []
 config/auto/memalign/test_c.in                              []
@@ -1947,7 +1945,6 @@
 t/steps/auto/crypto-01.t                                    [test]
 t/steps/auto/ctags-01.t                                     [test]
 t/steps/auto/env-01.t                                       [test]
-t/steps/auto/fink-01.t                                      [test]
 t/steps/auto/format-01.t                                    [test]
 t/steps/auto/funcptr-01.t                                   [test]
 t/steps/auto/gc-01.t                                        [test]
@@ -1961,8 +1958,6 @@
 t/steps/auto/inline-01.t                                    [test]
 t/steps/auto/isreg-01.t                                     [test]
 t/steps/auto/jit-01.t                                       [test]
-t/steps/auto/macports-01.t                                  [test]
-t/steps/auto/macports-02.t                                  [test]
 t/steps/auto/memalign-01.t                                  [test]
 t/steps/auto/msvc-01.t                                      [test]
 t/steps/auto/neg_0-01.t                                     [test]

Deleted: branches/darwin2hints/config/auto/fink.pm
==============================================================================
--- branches/darwin2hints/config/auto/fink.pm	Sat Jul 11 16:41:08 2009	(r40002)
+++ /dev/null	00:00:00 1970	(deleted)
@@ -1,107 +0,0 @@
-# Copyright (C) 2005-2007, Parrot Foundation.
-# $Id$
-
-=head1 NAME
-
-config/auto/fink.pm - Determine Fink location on Darwin
-
-=head1 DESCRIPTION
-
-If the operating system is Darwin, this class determines whether and where
-Fink is installed.
-
-=cut
-
-package auto::fink;
-
-use strict;
-use warnings;
-
-use base qw(Parrot::Configure::Step);
-
-use Parrot::Configure::Utils ':auto';
-use Parrot::BuildUtil;
-
-
-sub _init {
-    my $self = shift;
-    my %data;
-    $data{description} = q{Determine Fink location on Darwin};
-    $data{result}      = q{};
-    # Per fink(8), this is location for Fink configuration file, presumably
-    # regardless of where Fink itself is installed.
-    $data{fink_conf}    = q{/sw/etc/fink.conf};
-    return \%data;
-}
-
-sub runstep {
-    my ( $self, $conf ) = ( shift, shift );
-    my $osname = $conf->data->get_p5( 'OSNAME' );
-    my $verbose = $conf->options->get( 'verbose' );
-    unless ($osname =~ /darwin/) {
-        print "Operating system is $osname; Fink is Darwin only\n"
-            if $verbose;
-        $self->set_result('skipped');
-        return 1;
-    }
-    # Per fink(8), this is location for Fink configuration file, presumably
-    # regardless of where Fink itself is installed.
-    my $fink_conf = $self->{fink_conf};
-    unless (-f $fink_conf) {
-        print "Fink configuration file not located\n"
-            if $verbose;
-        $self->set_result('Fink not installed');
-        return 1;
-    }
-    my $fink_conf_str = Parrot::BuildUtil::slurp_file($fink_conf);
-    my @lines = split /\n/, $fink_conf_str;
-    my $fink_base_dir;
-    while (defined (my $l = shift @lines) ) {
-        chomp $l;
-        next unless $l =~ /^Basepath:\s(.*)/;
-        $fink_base_dir = $1;
-        last;
-    }
-    unless (defined $fink_base_dir) {
-        print "Fink configuration file defective:  no 'Basepath'\n"
-            if $verbose;
-        $self->set_result('failed');
-        return;
-    }
-    my $fink_lib_dir = qq{$fink_base_dir/lib};
-    my $fink_include_dir = qq{$fink_base_dir/include};
-    my @unlocateables;
-    foreach my $dir ($fink_base_dir, $fink_lib_dir, $fink_include_dir) {
-        push @unlocateables, $dir unless (-d $dir);
-    }
-    if (@unlocateables) {
-        print "Could not locate Fink directories:  @unlocateables\n"
-            if $verbose;
-        $self->set_result('failed');
-        return;
-    }
-    else {
-        $conf->data->set(
-            fink_base_dir       => $fink_base_dir,
-            fink_lib_dir        => $fink_lib_dir,
-            fink_include_dir    => $fink_include_dir,
-        );
-        $self->set_result('Fink located');
-        return 1;
-    }
-}
-
-1;
-
-=head1 AUTHOR
-
-James E Keenan
-
-=cut
-
-# Local Variables:
-#   mode: cperl
-#   cperl-indent-level: 4
-#   fill-column: 100
-# End:
-# vim: expandtab shiftwidth=4:

Modified: branches/darwin2hints/config/auto/gdbm.pm
==============================================================================
--- branches/darwin2hints/config/auto/gdbm.pm	Sat Jul 11 12:41:09 2009	(r40002)
+++ branches/darwin2hints/config/auto/gdbm.pm	Sat Jul 11 16:41:08 2009	(r40003)
@@ -61,10 +61,6 @@
         default         => '-lgdbm',
     } );
 
-    # On OS X check the presence of the gdbm header in the standard
-    # Fink location.
-    $self->_handle_darwin_for_fink($conf, $osname, 'gdbm.h');
-
     $conf->cc_gen('config/auto/gdbm/gdbm_c.in');
     eval { $conf->cc_build( q{}, $extra_libs ); };
     my $has_gdbm = 0;

Modified: branches/darwin2hints/config/auto/gettext.pm
==============================================================================
--- branches/darwin2hints/config/auto/gettext.pm	Sat Jul 11 12:41:09 2009	(r40002)
+++ branches/darwin2hints/config/auto/gettext.pm	Sat Jul 11 16:41:08 2009	(r40003)
@@ -61,11 +61,6 @@
         default         => defined $conf->data->get('glibc') ? '' : '-lintl',
     } );
 
-    # On OS X check the presence of the gettext header in the standard
-    # Fink and MacPorts locations.
-    $self->_handle_darwin_for_fink($conf, $osname, 'libintl.h');
-    $self->_handle_darwin_for_macports($conf, $osname, 'libintl.h');
-
     $conf->cc_gen('config/auto/gettext/gettext_c.in');
     eval { $conf->cc_build( q{}, $extra_libs ); };
     my $has_gettext = 0;

Modified: branches/darwin2hints/config/auto/gmp.pm
==============================================================================
--- branches/darwin2hints/config/auto/gmp.pm	Sat Jul 11 12:41:09 2009	(r40002)
+++ branches/darwin2hints/config/auto/gmp.pm	Sat Jul 11 16:41:08 2009	(r40003)
@@ -66,11 +66,6 @@
         default         => '-lgmp',
     } );
 
-    # On OS X check the presence of the gmp header in the standard
-    # Fink location.
-    $self->_handle_darwin_for_fink($conf, $osname, 'gmp.h');
-    $self->_handle_darwin_for_macports($conf, $osname, 'gmp.h');
-
     $conf->cc_gen('config/auto/gmp/gmp_c.in');
     eval { $conf->cc_build( q{}, $extra_libs); };
     my $has_gmp = 0;

Deleted: branches/darwin2hints/config/auto/macports.pm
==============================================================================
--- branches/darwin2hints/config/auto/macports.pm	Sat Jul 11 16:41:08 2009	(r40002)
+++ /dev/null	00:00:00 1970	(deleted)
@@ -1,104 +0,0 @@
-# Copyright (C) 2005-2007, Parrot Foundation.
-# $Id$
-
-=head1 NAME
-
-config/auto/macports.pm - Determine Macports location on Darwin
-
-=head1 DESCRIPTION
-
-If the operating system is Darwin, this class determines whether or not
-Macports is installed in the default location.
-
-B<Note:>  No provision is yet made for Macports installation in non-default
-locations.
-
-B<Note:>  This step is currently Darwin/Macports-specific because it
-consolidates code previously found in multiple configuration step classes.
-With some modification it may be suitable for application to BSD F<ports>
-programs in general, but as there was no BSD-specific code in the
-configuration step classes, that modification has not yet been made.
-
-=cut
-
-package auto::macports;
-
-use strict;
-use warnings;
-
-use File::Spec;
-use base qw(Parrot::Configure::Step);
-
-use Parrot::Configure::Utils ':auto';
-use Parrot::BuildUtil;
-
-sub _init {
-    my $self = shift;
-    my %data;
-    $data{description} = q{Determine Macports location on Darwin};
-    $data{result}      = q{};
-    my $optlocal = File::Spec->catdir( '/', 'opt', 'local' );
-    $data{ports_root} = (defined $ENV{TEST_MACPORTS})
-        ? $ENV{TEST_MACPORTS}
-        : (-d $optlocal)
-            ? $optlocal
-            : undef;
-    return \%data;
-}
-
-sub runstep {
-    my ( $self, $conf ) = ( shift, shift );
-    my $osname = $conf->data->get_p5( 'OSNAME' );
-    my $verbose = $conf->options->get( 'verbose' );
-    unless ($osname =~ /darwin/) {
-        print "Operating system is $osname; Macports is Darwin only\n"
-            if $verbose;
-        $self->set_result('skipped');
-        return 1;
-    }
-    if (! defined $self->{ports_root}) {
-        print "Could not locate Macports root directory\n"
-            if $verbose;
-        $self->set_result('no');
-        return 1;
-    }
-
-    my $ports_base_dir = $self->{ports_root};
-    my $ports_lib_dir = qq{$ports_base_dir/lib};
-    my $ports_include_dir = qq{$ports_base_dir/include};
-    my @unlocateables;
-    foreach my $dir ($ports_base_dir, $ports_lib_dir, $ports_include_dir) {
-        push @unlocateables, $dir unless (-d $dir);
-    }
-    if (@unlocateables) {
-        print "Could not locate Macports directories:  @unlocateables\n"
-            if $verbose;
-        $self->set_result('no');
-        return 1;
-    }
-    else {
-        $conf->data->set(
-            ports_base_dir       => $ports_base_dir,
-            ports_lib_dir        => $ports_lib_dir,
-            ports_include_dir    => $ports_include_dir,
-        );
-        $self->set_result('yes');
-        return 1;
-    }
-}
-
-1;
-
-=head1 AUTHOR
-
-James E Keenan, consolidating code written by Alberto SimÃes, Leopold Toetsch
-and others.
-
-=cut
-
-# Local Variables:
-#   mode: cperl
-#   cperl-indent-level: 4
-#   fill-column: 100
-# End:
-# vim: expandtab shiftwidth=4:

Modified: branches/darwin2hints/config/auto/opengl.pm
==============================================================================
--- branches/darwin2hints/config/auto/opengl.pm	Sat Jul 11 12:41:09 2009	(r40002)
+++ branches/darwin2hints/config/auto/opengl.pm	Sat Jul 11 16:41:08 2009	(r40003)
@@ -179,12 +179,6 @@
             default         => '-lglut -lGLU -lGL',
     } );
 
-    # On OS X check the presence of the OpenGL headers in the standard
-    # Fink/macports locations.
-    # Mindlessly morphed from readline ... may need to be fixed
-    $self->_handle_darwin_for_fink    ($conf, $osname, 'GL/glut.h');
-    $self->_handle_darwin_for_macports($conf, $osname, 'GL/glut.h');
-
     $conf->cc_gen('config/auto/opengl/opengl_c.in');
     my $has_glut = 0;
     eval { $conf->cc_build( q{}, $extra_libs ) };

Modified: branches/darwin2hints/config/auto/pcre.pm
==============================================================================
--- branches/darwin2hints/config/auto/pcre.pm	Sat Jul 11 12:41:09 2009	(r40002)
+++ branches/darwin2hints/config/auto/pcre.pm	Sat Jul 11 16:41:08 2009	(r40003)
@@ -56,11 +56,6 @@
         default         => '-lpcre',
     } );
 
-    # On OS X check the presence of the pcre headers in the standard
-    # Fink/macports locations.
-    $self->_handle_darwin_for_fink    ($conf, $osname, 'pcre.h');
-    $self->_handle_darwin_for_macports($conf, $osname, 'pcre.h');
-
     $conf->cc_gen('config/auto/pcre/pcre_c.in');
     eval { $conf->cc_build( q{}, $extra_libs ) };
     my $has_pcre = 0;

Modified: branches/darwin2hints/config/auto/readline.pm
==============================================================================
--- branches/darwin2hints/config/auto/readline.pm	Sat Jul 11 12:41:09 2009	(r40002)
+++ branches/darwin2hints/config/auto/readline.pm	Sat Jul 11 16:41:08 2009	(r40003)
@@ -49,11 +49,6 @@
         default         => '-lreadline',
     } );
 
-    # On OS X check the presence of the readline header in the standard
-    # Fink/macports locations.
-    $self->_handle_darwin_for_fink($conf, $osname, 'readline/readline.h');
-    $self->_handle_darwin_for_macports($conf, $osname, q{readline/readline.h});
-
     $conf->cc_gen('config/auto/readline/readline_c.in');
     my $has_readline = 0;
     eval { $conf->cc_build( q{}, $extra_libs ) };

Modified: branches/darwin2hints/config/init/hints/darwin.pm
==============================================================================
--- branches/darwin2hints/config/init/hints/darwin.pm	Sat Jul 11 12:41:09 2009	(r40002)
+++ branches/darwin2hints/config/init/hints/darwin.pm	Sat Jul 11 16:41:08 2009	(r40003)
@@ -6,6 +6,11 @@
 use strict;
 use warnings;
 
+use lib qw( lib );
+use File::Spec ();
+use base qw(Parrot::Configure::Step);
+use Parrot::BuildUtil;
+
 our %defaults = (
     uname           => `uname -r`,
     sw_vers         => `sw_vers -productVersion`,
@@ -40,16 +45,14 @@
     my $lib_dir = $conf->data->get('build_dir') . "/blib/lib";
     $flagsref->{ldflags} .= " -L$lib_dir";
     $flagsref->{ccflags} .= " -pipe -fno-common -Wno-long-double ";
+    $flagsref->{linkflags} .= " -undefined dynamic_lookup";
+
+    _probe_for_libraries($conf, $flagsref, 'fink');
+    _probe_for_libraries($conf, $flagsref, 'macports');
 
-    # Here is the place where we will have to incorporate functionality
-    # currently found in auto::fink and auto::macports.
-    # For example, in the case of Fink, we'll have to determine whether Fink
-    # is found on the box, set fink_base_dir, fink_lib_dir and
-    # fink_include_dir. Then we'll have to add them to linkflags, ldflags and
-    # ccflags as is currently done by
-    # Parrot::Configure::Step:::Methods::_handle_darwin_for_fink().
-    # For macports, we only have to handle ports_lib_dir and
-    # ports_include_dir.
+    for my $flag ( keys %$flagsref ) {
+        $flagsref->{$flag} =~ s/^\s+//;
+    }
 
     $conf->data->set(
         darwin              => 1,
@@ -61,7 +64,7 @@
         share_ext           => '.dylib',
         load_ext            => '.bundle',
         link                => 'c++',
-        linkflags           => '-undefined dynamic_lookup',
+        linkflags           => $flagsref->{linkflags},
         ld                  => 'c++',
         ld_share_flags      => '-dynamiclib -undefined dynamic_lookup',
         ld_load_flags       => '-undefined dynamic_lookup -bundle',
@@ -96,7 +99,7 @@
 
 sub _strip_arch_flags_engine {
     my ($arches, $stored, $flagsref, $flag) = @_;
-    for my $arch ( @{ $defaults{architectures} } ) {
+    for my $arch ( @{ $arches } ) {
         $stored =~ s/-arch\s+$arch//g;
         $stored =~ s/\s+/ /g;
         $flagsref->{$flag} = $stored;
@@ -154,6 +157,107 @@
     }
 }
 
+sub _probe_for_fink {
+    my $conf = shift;
+    my $verbose = $conf->options->get( 'verbose' );
+    # Per fink(8), this is location for Fink configuration file, presumably
+    # regardless of where Fink itself is installed.
+    my $fink_conf    = q{/sw/etc/fink.conf};
+    unless (-f $fink_conf) {
+        print "Fink configuration file not located\n" if $verbose;
+        return;
+    }
+    my $fink_conf_str = Parrot::BuildUtil::slurp_file($fink_conf);
+    my @lines = split /\n/, $fink_conf_str;
+    my $fink_base_dir;
+    while (defined (my $l = shift @lines) ) {
+        chomp $l;
+        next unless $l =~ /^Basepath:\s(.*)/;
+        $fink_base_dir = $1;
+        last;
+    }
+    unless (defined $fink_base_dir) {
+        print "Fink configuration file defective:  no 'Basepath'\n"
+            if $verbose;
+        return;
+    }
+    my $fink_lib_dir = qq{$fink_base_dir/lib};
+    my $fink_include_dir = qq{$fink_base_dir/include};
+    my @unlocateables;
+    foreach my $dir ($fink_base_dir, $fink_lib_dir, $fink_include_dir) {
+        push @unlocateables, $dir unless (-d $dir);
+    }
+    if (@unlocateables) {
+        print "Could not locate Fink directories:  @unlocateables\n"
+            if $verbose;
+        return;
+    }
+    else {
+        my %addl_flags = (
+            linkflags => "-L$fink_lib_dir",
+            ldflags   => "-L$fink_lib_dir",
+            ccflags   => "-I$fink_include_dir",
+        );
+        return \%addl_flags;
+    }
+}
+
+sub _probe_for_macports {
+    my $conf = shift;
+    my $verbose = $conf->options->get( 'verbose' );
+    my $ports_base_dir = File::Spec->catdir( '/', 'opt', 'local' );
+    my $ports_lib_dir = qq{$ports_base_dir/lib};
+    my $ports_include_dir = qq{$ports_base_dir/include};
+    my @unlocateables;
+    foreach my $dir ($ports_base_dir, $ports_lib_dir, $ports_include_dir) {
+        push @unlocateables, $dir unless (-d $dir);
+    }
+    if (@unlocateables) {
+        print "Could not locate Macports directories:  @unlocateables\n"
+            if $verbose;
+        return;
+    }
+    else {
+        my %addl_flags = (
+            linkflags => "-L$ports_lib_dir",
+            ldflags   => "-L$ports_lib_dir",
+            ccflags   => "-I$ports_include_dir",
+        );
+        return \%addl_flags;
+    }
+    return 1;
+}
+
+sub _probe_for_libraries {
+    my ($conf, $flagsref, $library) = @_;
+    my $no_library_option = "darwin_no_$library";
+    my $title = ucfirst(lc($library));
+    my $verbose = $conf->options->get( 'verbose' );
+    unless ($conf->options->get( $no_library_option ) ) {
+        my $addl_flags_ref;
+        if ($library eq 'fink') {
+            $addl_flags_ref = _probe_for_fink($conf);
+        }
+        if ($library eq 'macports') {
+            $addl_flags_ref = _probe_for_macports($conf);
+        }
+        if (defined $addl_flags_ref) {
+            foreach my $addl (keys %{ $addl_flags_ref } ) {
+                if (defined $flagsref->{$addl}) {
+                    my @elements = split /\s+/, $flagsref->{$addl};
+                    my %seen = map {$_, 1} @elements;
+                    $flagsref->{$addl} .= " $addl_flags_ref->{$addl}"
+                        unless $seen{$addl_flags_ref->{$addl}};
+                }
+            }
+            print "Probe for $title successful\n" if $verbose;
+        }
+        else {
+            print "Probe for $title unsuccessful\n" if $verbose;
+        }
+    }
+}
+
 1;
 
 # Local Variables:

Modified: branches/darwin2hints/lib/Parrot/Configure/Options/Conf/Shared.pm
==============================================================================
--- branches/darwin2hints/lib/Parrot/Configure/Options/Conf/Shared.pm	Sat Jul 11 12:41:09 2009	(r40002)
+++ branches/darwin2hints/lib/Parrot/Configure/Options/Conf/Shared.pm	Sat Jul 11 16:41:08 2009	(r40003)
@@ -18,6 +18,8 @@
     cgoto
     configure_trace
     cxx
+    darwin_no_fink
+    darwin_no_macports
     datadir
     debugging
     define

Modified: branches/darwin2hints/lib/Parrot/Configure/Step/List.pm
==============================================================================
--- branches/darwin2hints/lib/Parrot/Configure/Step/List.pm	Sat Jul 11 12:41:09 2009	(r40002)
+++ branches/darwin2hints/lib/Parrot/Configure/Step/List.pm	Sat Jul 11 16:41:08 2009	(r40003)
@@ -20,8 +20,6 @@
     auto::gcc
     auto::glibc
     auto::backtrace
-    auto::fink
-    auto::macports
     auto::msvc
     auto::attributes
     auto::warnings

Modified: branches/darwin2hints/lib/Parrot/Configure/Step/Methods.pm
==============================================================================
--- branches/darwin2hints/lib/Parrot/Configure/Step/Methods.pm	Sat Jul 11 12:41:09 2009	(r40002)
+++ branches/darwin2hints/lib/Parrot/Configure/Step/Methods.pm	Sat Jul 11 16:41:08 2009	(r40003)
@@ -27,72 +27,6 @@
 
 =head1 METHODS
 
-=head2 C<_handle_darwin_for_fink()>
-
-    $self->_handle_darwin_for_fink($conf, $libs, $osname, $file);
-
-Currently used in configuration step classes auto::gmp, auto::readline and
-auto::gdbm.
-
-Modifies settings for C<linkflags>, C<ldflags> and C<ccflags> in the
-Parrot::Configure object's data structure.
-
-=cut
-
-sub _handle_darwin_for_fink {
-    my ($self, $conf, $osname, $file) = @_;
-    if ( $osname =~ /darwin/ ) {
-        my $fink_lib_dir        = $conf->data->get('fink_lib_dir');
-        my $fink_include_dir    = $conf->data->get('fink_include_dir');
-        if ( (defined $fink_lib_dir) && (defined $fink_include_dir) ) {
-            if ( -f "$fink_include_dir/$file" ) {
-                my %intended = (
-                    linkflags => "-L$fink_lib_dir",
-                    ldflags   => "-L$fink_lib_dir",
-                    ccflags   => "-I$fink_include_dir",
-                );
-                _add_flags_not_yet_seen($conf, \%intended);
-            }
-        }
-    }
-    return 1;
-}
-
-=head2 C<_handle_darwin_for_macports()>
-
-    $self->_handle_darwin_for_macports($conf, $libs, $osname, $file);
-
-Currently used in configuration step classes auto::gmp, auto::readline and
-auto::opengl.
-
-Modifies settings for C<linkflags>, C<ldflags> and C<ccflags> in the
-Parrot::Configure object's data structure.
-
-Potentially expandable to cover all BSD-ports systems -- but as yet there has
-been no demand.
-
-=cut
-
-sub _handle_darwin_for_macports {
-    my ($self, $conf, $osname, $file) = @_;
-    if ( $osname =~ /darwin/ ) {
-#        my $ports_root          = $conf->data->get( 'ports_base_dir' );
-        my $ports_lib_dir       = $conf->data->get( 'ports_lib_dir' );
-        my $ports_include_dir   = $conf->data->get( 'ports_include_dir' );
-        if ( defined $ports_lib_dir && defined $ports_include_dir ) {
-            if ( -f qq{$ports_include_dir/$file} ) {
-                my %intended = (
-                    linkflags => "-L$ports_lib_dir",
-                    ldflags   => "-L$ports_lib_dir",
-                    ccflags   => "-I$ports_include_dir",
-                );
-                _add_flags_not_yet_seen($conf, \%intended);
-            }
-        }
-    }
-    return 1;
-}
-
 =head2 C<_select_lib()>
 
     $self->_select_lib( {

Deleted: branches/darwin2hints/t/steps/auto/fink-01.t
==============================================================================
--- branches/darwin2hints/t/steps/auto/fink-01.t	Sat Jul 11 16:41:08 2009	(r40002)
+++ /dev/null	00:00:00 1970	(deleted)
@@ -1,289 +0,0 @@
-#! perl
-# Copyright (C) 2007-2009, Parrot Foundation.
-# $Id$
-# auto/fink-01.t
-
-use strict;
-use warnings;
-use Test::More;
-use Carp;
-use File::Temp;
-use lib qw( lib t/configure/testlib );
-
-plan( skip_all => 'fink is Darwin only' ) unless $^O =~ /darwin/i;
-plan( tests => 55 );
-
-use_ok('config::init::defaults');
-use_ok('config::auto::fink');
-
-use Parrot::Configure;
-use Parrot::Configure::Options qw( process_options );
-use Parrot::Configure::Test qw(
-    test_step_thru_runstep
-    rerun_defaults_for_testing
-    test_step_constructor_and_description
-);
-use IO::CaptureOutput qw( capture );
-
-########## Darwin but no good Fink  ##########
-
-my ($args, $step_list_ref) = process_options( {
-    argv            => [],
-    mode            => q{configure},
-} );
-
-my $conf = Parrot::Configure->new();
-
-test_step_thru_runstep($conf, q{init::defaults}, $args);
-
-my $pkg = q{auto::fink};
-
-$conf->add_steps($pkg);
-
-my $serialized = $conf->pcfreeze();
-
-$conf->options->set(%{$args});
-my $step = test_step_constructor_and_description($conf);
-
-# Success in the following test means:
-# (a) OS is Darwin.
-# (b) Either Fink is not installed or it is installed correctly, i.e., we can
-# locate the Fink subdirectories we need for later Parrot configuration steps.
-ok($step->runstep($conf), "runstep() returned true value");
-
-$conf->replenish($serialized);
-
-########## not Darwin ##########
-
-($args, $step_list_ref) = process_options( {
-    argv            => [],
-    mode            => q{configure},
-} );
-# mock not Darwin
-$conf->options->set(%{$args});
-$step = test_step_constructor_and_description($conf);
-$conf->data->set_p5( 'OSNAME' => 'foobar' );
-ok($step->runstep($conf), "runstep() returned true value");
-is($step->result(), q{skipped}, "Got expected result for non-Darwin OS");
-
-$conf->replenish($serialized);
-
-########## no Fink ##########
-
-($args, $step_list_ref) = process_options( {
-    argv            => [],
-    mode            => q{configure},
-} );
-# mock no Fink
-$conf->options->set(%{$args});
-$step = test_step_constructor_and_description($conf);
-$step->{fink_conf} = q{my_ridiculous_foobar};
-my $msg = q{Fink not installed};
-
-{
-    ok($step->runstep($conf), "runstep() returned true value");
-    is($step->result(), $msg, "Got expected result for $msg");
-}
-
-$conf->replenish($serialized);
-
-########## Darwin but defective Fink ##########
-
-($args, $step_list_ref) = process_options( {
-    argv            => [],
-    mode            => q{configure},
-} );
-$conf->options->set(%{$args});
-$step = test_step_constructor_and_description($conf);
-{
-    # mock Fink config file with no Basepath
-    my $tfile = File::Temp->new();
-    open my $fh, ">", $tfile
-        or croak "Unable to open temporary file for writing";
-    print $fh "Message: Hello world\n";
-    close $fh or croak "Unable to close temporary file after writing";
-    $step->{fink_conf} = $tfile;
-    ok(! defined $step->runstep($conf),
-        "runstep() returned undef due to defective Fink config file");
-    is($step->result(), q{failed},
-        "Got expected result for defective Fink Config file");
-}
-
-$conf->replenish($serialized);
-
-########## Darwin but defective Fink ##########
-
-($args, $step_list_ref) = process_options( {
-    argv            => [],
-    mode            => q{configure},
-} );
-$conf->options->set(%{$args});
-$step = test_step_constructor_and_description($conf);
-{
-    # mock Fink config file with non-existent Basepath
-    my $tfile = File::Temp->new();
-    open my $fh, ">", $tfile
-        or croak "Unable to open temporary file for writing";
-    print $fh "Basepath: /my/phony/directory\n";
-    close $fh or croak "Unable to close temporary file after writing";
-    $step->{fink_conf} = $tfile;
-    ok(! defined $step->runstep($conf),
-        "runstep() returned undef due to unlocateable Fink directories");
-    is($step->result(), q{failed},
-        "Got expected result for unlocateable Fink directories");
-}
-
-$conf->replenish($serialized);
-
-########## not Darwin; --verbose ##########
-
-($args, $step_list_ref) = process_options( {
-    argv            => [ q{--verbose} ],
-    mode            => q{configure},
-} );
-$conf->options->set(%{$args});
-$step = test_step_constructor_and_description($conf);
-{
-    # mock not Darwin
-    my $phony_OS = q{foobar};
-    $conf->data->set_p5( 'OSNAME' => $phony_OS );
-    my ($rv, $stdout);
-    capture(
-        sub { $rv = $step->runstep($conf); },
-        \$stdout,
-    );
-    ok($rv, "runstep() returned true value");
-    is($step->result(), q{skipped}, "Got expected result for non-Darwin OS");
-    like($stdout,
-        qr/Operating system is $phony_OS; Fink is Darwin only/,
-        "Got expected verbose output when OS is not Darwin");
-}
-
-$conf->replenish($serialized);
-
-########## Darwin; --verbose; no Fink ##########
-
-($args, $step_list_ref) = process_options( {
-    argv            => [ q{--verbose} ],
-    mode            => q{configure},
-} );
-$conf->options->set(%{$args});
-$step = test_step_constructor_and_description($conf);
-{
-    # mock no Fink
-    $step->{fink_conf} = q{my_ridiculous_foobar};
-    my $msg = q{Fink not installed};
-    my ($rv, $stdout);
-    capture(
-        sub { $rv = $step->runstep($conf); },
-        \$stdout,
-    );
-    ok($rv, "runstep() returned true value");
-    is($step->result(), $msg,
-        "Got expected result for $msg");
-    like($stdout,
-        qr/Fink configuration file not located/,
-        "Got expected verbose output when OS is not Darwin");
-}
-
-$conf->replenish($serialized);
-
-########## Darwin; --verbose; defective Fink ##########
-
-($args, $step_list_ref) = process_options( {
-    argv            => [ q{--verbose} ],
-    mode            => q{configure},
-} );
-$conf->options->set(%{$args});
-$step = test_step_constructor_and_description($conf);
-{
-    # mock Fink config file with no Basepath
-    my $tfile = File::Temp->new();
-    open my $fh, ">", $tfile
-        or croak "Unable to open temporary file for writing";
-    print $fh "Message: Hello world\n";
-    close $fh or croak "Unable to close temporary file after writing";
-    $step->{fink_conf} = $tfile;
-
-    my ($rv, $stdout);
-    capture(
-        sub { $rv = $step->runstep($conf); },
-        \$stdout,
-    );
-    ok(! defined $rv,
-        "runstep() returned undef due to defective Fink config file");
-    is($step->result(), q{failed},
-        "Got expected result for defective Fink Config file");
-    like($stdout,
-        qr/Fink configuration file defective:  no 'Basepath'/,
-        "Got expected verbose output when Fink config file lacked 'Basepath'");
-}
-
-$conf->replenish($serialized);
-
-########## Darwin; --verbose; defective Fink ##########
-
-($args, $step_list_ref) = process_options( {
-    argv            => [ q{--verbose} ],
-    mode            => q{configure},
-} );
-$conf->options->set(%{$args});
-$step = test_step_constructor_and_description($conf);
-{
-    # mock Fink config file with non-existent Basepath
-    my $tfile = File::Temp->new();
-    open my $fh, ">", $tfile
-        or croak "Unable to open temporary file for writing";
-    print $fh "Basepath: /my/phony/directory\n";
-    close $fh or croak "Unable to close temporary file after writing";
-    $step->{fink_conf} = $tfile;
-
-    my ($rv, $stdout);
-    capture(
-        sub { $rv = $step->runstep($conf); },
-        \$stdout,
-    );
-    ok(! defined $rv,
-        "runstep() returned undef due to unlocateable Fink directories");
-    is($step->result(), q{failed},
-        "Got expected result for unlocateable Fink directories");
-    like($stdout,
-        qr/Could not locate Fink directories/,
-        "Got expected verbose output for unlocateable Fink directories");
-}
-
-pass("Completed all tests in $0");
-
-################### DOCUMENTATION ###################
-
-=head1 NAME
-
-auto/fink-01.t - test auto::fink
-
-=head1 SYNOPSIS
-
-    % prove t/steps/auto/fink-01.t
-
-=head1 DESCRIPTION
-
-The files in this directory test functionality used by F<Configure.pl>.
-
-The tests in this file test auto::fink.  Some tests will run only on Darwin.
-Others simulate how auto::fink runs on operating systems other than Darwin.
-
-=head1 AUTHOR
-
-James E Keenan
-
-=head1 SEE ALSO
-
-config::auto::fink, F<Configure.pl>.
-
-=cut
-
-# Local Variables:
-#   mode: cperl
-#   cperl-indent-level: 4
-#   fill-column: 100
-# End:
-# vim: expandtab shiftwidth=4:

Modified: branches/darwin2hints/t/steps/auto/gdbm-01.t
==============================================================================
--- branches/darwin2hints/t/steps/auto/gdbm-01.t	Sat Jul 11 12:41:09 2009	(r40002)
+++ branches/darwin2hints/t/steps/auto/gdbm-01.t	Sat Jul 11 16:41:08 2009	(r40003)
@@ -5,7 +5,7 @@
 
 use strict;
 use warnings;
-use Test::More tests =>  47;
+use Test::More tests =>  40;
 use Carp;
 use Cwd;
 use File::Spec;
@@ -56,7 +56,7 @@
 
 $conf->replenish($serialized);
 
-########## --without-gdbm; _handle_darwin_for_fink() ##########
+########## --without-gdbm ##########
 
 ($args, $step_list_ref) = process_options( {
     argv => [ q{--without-gdbm} ],
@@ -69,11 +69,6 @@
 my $osname;
 my ($flagsbefore, $flagsafter);
 $osname = 'foobar';
-$flagsbefore = $conf->data->get( 'linkflags' );
-ok($step->_handle_darwin_for_fink($conf, $osname, 'gdbm.h'),
-    "handle_darwin_for_fink() returned true value");
-$flagsafter = $conf->data->get( 'linkflags' );
-is($flagsbefore, $flagsafter, "No change in linkflags, as expected");
 my $cwd = cwd();
 {
     my $tdir = tempdir( CLEANUP => 1 );
@@ -84,12 +79,6 @@
     my $includedir = File::Spec->catdir( $tdir, 'include' );
     $conf->data->set('fink_lib_dir' => $libdir);
     $conf->data->set('fink_include_dir' => $includedir);
-    $osname = 'darwin';
-    $flagsbefore = $conf->data->get( 'linkflags' );
-    ok($step->_handle_darwin_for_fink($conf, $osname, 'gdbm.h'),
-        "handle_darwin_for_fink() returned true value");
-    $flagsafter = $conf->data->get( 'linkflags' );
-    is($flagsbefore, $flagsafter, "No change in linkflags, as expected");
 
     ok(chdir $cwd, "Able to change back to original directory after testing");
 }
@@ -107,15 +96,6 @@
     print $FH "Hello world\n";
     close $FH or croak "Could not close after writing";
 
-    $osname = 'darwin';
-    $flagsbefore = $conf->data->get( 'linkflags' );
-    ok($step->_handle_darwin_for_fink($conf, $osname, 'gdbm.h'),
-        "handle_darwin_for_fink() returned true value");
-    $flagsafter = $conf->data->get( 'linkflags' );
-    isnt($flagsbefore, $flagsafter, "Change in linkflags, as expected");
-    like($conf->data->get( 'linkflags' ), qr/-L\Q$libdir\E/,
-        "'linkflags' modified as expected");
-
     ok(chdir $cwd, "Able to change back to original directory after testing");
 }
 

Modified: branches/darwin2hints/t/steps/auto/gmp-01.t
==============================================================================
--- branches/darwin2hints/t/steps/auto/gmp-01.t	Sat Jul 11 12:41:09 2009	(r40002)
+++ branches/darwin2hints/t/steps/auto/gmp-01.t	Sat Jul 11 16:41:08 2009	(r40003)
@@ -5,7 +5,7 @@
 
 use strict;
 use warnings;
-use Test::More tests =>  61;
+use Test::More tests =>  31;
 use Carp;
 use Cwd;
 use File::Spec;
@@ -102,63 +102,8 @@
    '-lgmp',
    "_select_lib() returned expected value");
 
-########### _handle_darwin_for_fink() ###########
-
 my ($flagsbefore, $flagsafter);
-$osname = 'foobar';
-$flagsbefore = $conf->data->get( 'linkflags' );
-ok($step->_handle_darwin_for_fink($conf, $osname, 'gmp.h'),
-    "handle_darwin_for_fink() returned true value");
-$flagsafter = $conf->data->get( 'linkflags' );
-is($flagsbefore, $flagsafter, "No change in linkflags, as expected");
-
 my $cwd = cwd();
-{
-    my $tdir = tempdir( CLEANUP => 1 );
-    ok(chdir $tdir, "Able to change to temporary directory");
-    ok( (mkdir 'lib'), "Able to make lib directory");
-    ok( (mkdir 'include'), "Able to make include directory");
-    my $libdir = File::Spec->catdir( $tdir, 'lib' );
-    my $includedir = File::Spec->catdir( $tdir, 'include' );
-    $conf->data->set('fink_lib_dir' => $libdir);
-    $conf->data->set('fink_include_dir' => $includedir);
-    $osname = 'darwin';
-    $flagsbefore = $conf->data->get( 'linkflags' );
-    ok($step->_handle_darwin_for_fink($conf, $osname, 'gmp.h'),
-        "handle_darwin_for_fink() returned true value");
-    $flagsafter = $conf->data->get( 'linkflags' );
-    is($flagsbefore, $flagsafter, "No change in linkflags, as expected");
-
-    ok(chdir $cwd, "Able to change back to original directory after testing");
-}
-
-{
-    my $tdir2 = tempdir( CLEANUP => 1 );
-    ok(chdir $tdir2, "Able to change to temporary directory");
-    ok( (mkdir 'lib'), "Able to make lib directory");
-    ok( (mkdir 'include'), "Able to make include directory");
-    my $libdir = File::Spec->catdir( $tdir2, 'lib' );
-    my $includedir = File::Spec->catdir( $tdir2, 'include' );
-    $conf->data->set('fink_lib_dir' => $libdir);
-    $conf->data->set('fink_include_dir' => $includedir);
-    my $foo = File::Spec->catfile( $includedir, 'gmp.h' );
-    open my $FH, ">", $foo or croak "Could not open for writing";
-    print $FH "Hello world\n";
-    close $FH or croak "Could not close after writing";
-
-    $osname = 'darwin';
-    $flagsbefore = $conf->data->get( 'linkflags' );
-    ok($step->_handle_darwin_for_fink($conf, $osname, 'gmp.h'),
-        "handle_darwin_for_fink() returned true value");
-    $flagsafter = $conf->data->get( 'linkflags' );
-    isnt($flagsbefore, $flagsafter, "Change in linkflags, as expected");
-    like($conf->data->get( 'linkflags' ), qr/-L\Q$libdir\E/,
-        "'linkflags' modified as expected");
-
-    ok(chdir $cwd, "Able to change back to original directory after testing");
-}
-
-$conf->replenish($serialized);
 
 ########### _evaluate_cc_run() ###########
 
@@ -210,66 +155,6 @@
     $step->set_result(undef);
 }
 
-########### _handle_darwin_for_fink() ###########
-
-($args, $step_list_ref) = process_options( {
-    argv => [ ],
-    mode => q{configure},
-} );
-$conf->options->set( %{$args} );
-$step = test_step_constructor_and_description($conf);
-# Mock values for OS
-$osname = 'darwin';
-$conf->data->set( 'linkflags'  => 'foobar' );
-$flagsbefore = $conf->data->get( 'linkflags' );
-$conf->data->set( fink_lib_dir  => undef );
-$conf->data->set( fink_include_dir  => undef );
-ok($step->_handle_darwin_for_fink($conf, $osname, 'gmp.h'),
-    "handle_darwin_for_fink() returned true value");
-$flagsafter = $conf->data->get( 'linkflags' );
-is($flagsbefore, $flagsafter, "No change in linkflags, as expected");
-
-$cwd = cwd();
-{
-    my $tdir = tempdir( CLEANUP => 1 );
-    ok(chdir $tdir, "Able to change to temporary directory");
-    ok( (mkdir 'lib'), "Able to make lib directory");
-#    ok( (mkdir 'include'), "Able to make include directory");
-    my $libdir = File::Spec->catdir( $tdir, 'lib' );
-    my $includedir = File::Spec->catdir( $tdir, 'include' );
-    $conf->data->set('fink_lib_dir' => $libdir);
-    $conf->data->set('fink_include_dir' => $includedir);
-    $osname = 'darwin';
-    $conf->data->set( 'linkflags'  => 'foobar' );
-    $flagsbefore = $conf->data->get( 'linkflags' );
-    ok($step->_handle_darwin_for_fink($conf, $osname, 'gmp.h'),
-        "handle_darwin_for_fink() returned true value");
-    $flagsafter = $conf->data->get( 'linkflags' );
-    is($flagsbefore, $flagsafter, "No change in linkflags, as expected");
-
-    ok(chdir $cwd, "Able to change back to original directory after testing");
-}
-
-{
-    my $tdir1 = tempdir( CLEANUP => 1 );
-    ok(chdir $tdir1, "Able to change to temporary directory");
-#    ok( (mkdir 'lib'), "Able to make lib directory");
-    ok( (mkdir 'include'), "Able to make include directory");
-    my $libdir = File::Spec->catdir( $tdir1, 'lib' );
-    my $includedir = File::Spec->catdir( $tdir1, 'include' );
-    $conf->data->set('fink_lib_dir' => $libdir);
-    $conf->data->set('fink_include_dir' => $includedir);
-    $osname = 'darwin';
-    $conf->data->set( 'linkflags'  => 'foobar' );
-    $flagsbefore = $conf->data->get( 'linkflags' );
-    ok($step->_handle_darwin_for_fink($conf, $osname, 'gmp.h'),
-        "handle_darwin_for_fink() returned true value");
-    $flagsafter = $conf->data->get( 'linkflags' );
-    is($flagsbefore, $flagsafter, "No change in linkflags, as expected");
-
-    ok(chdir $cwd, "Able to change back to original directory after testing");
-}
-
 pass("Completed all tests in $0");
 
 ################### DOCUMENTATION ###################

Deleted: branches/darwin2hints/t/steps/auto/macports-01.t
==============================================================================
--- branches/darwin2hints/t/steps/auto/macports-01.t	Sat Jul 11 16:41:08 2009	(r40002)
+++ /dev/null	00:00:00 1970	(deleted)
@@ -1,226 +0,0 @@
-#! perl
-# Copyright (C) 2007-2009, Parrot Foundation.
-# $Id$
-# auto/macports-01.t
-
-use strict;
-use warnings;
-use Test::More;
-use Carp;
-use Cwd;
-use File::Spec;
-use File::Temp qw( tempdir );
-use lib qw( lib t/configure/testlib );
-
-plan( skip_all => 'Macports is Darwin only' ) unless $^O =~ /darwin/;
-plan( tests    => 52 );
-
-use_ok('config::init::defaults');
-use_ok('config::auto::macports');
-use Parrot::Configure;
-use Parrot::Configure::Options qw( process_options );
-use Parrot::Configure::Test qw(
-    test_step_thru_runstep
-    test_step_constructor_and_description
-);
-use IO::CaptureOutput qw( capture );
-
-########## not Darwin ##########
-
-my ($args, $step_list_ref) = process_options( {
-    argv            => [],
-    mode            => q{configure},
-} );
-
-my $conf = Parrot::Configure->new();
-
-test_step_thru_runstep($conf, q{init::defaults}, $args);
-
-my $pkg = q{auto::macports};
-
-$conf->add_steps($pkg);
-
-my $serialized = $conf->pcfreeze();
-
-$conf->options->set(%{$args});
-my $step = test_step_constructor_and_description($conf);
-
-# mock not Darwin
-$conf->data->set_p5( 'OSNAME' => 'foobar' );
-ok($step->runstep($conf), "runstep() returned true value");
-is($step->result(), q{skipped}, "Got expected result for non-Darwin OS");
-
-$conf->replenish($serialized);
-
-########## Darwin but no Macports ##########
-
-($args, $step_list_ref) = process_options( {
-    argv            => [],
-    mode            => q{configure},
-} );
-$conf->options->set(%{$args});
-$step = test_step_constructor_and_description($conf);
-
-# mock no Macports-default directories
-$step->{ports_root} = File::Spec->catdir( qw( / my ridiculous foobar ) );
-ok($step->runstep($conf), "runstep() returned true value");
-is($step->result(), 'no', "Got expected result");
-
-$conf->replenish($serialized);
-
-########## Darwin with Macports ##########
-
-($args, $step_list_ref) = process_options( {
-    argv            => [],
-    mode            => q{configure},
-} );
-$conf->options->set(%{$args});
-$step = test_step_constructor_and_description($conf);
-my $cwd = cwd();
-
-my $tdir = tempdir( CLEANUP => 1 );
-$step->{ports_root} = $tdir;
-ok(chdir $tdir, "Able to change to temporary directory");
-ok( (mkdir 'lib'), "Able to make lib directory");
-ok( (mkdir 'include'), "Able to make include directory");
-
-ok($step->runstep($conf), "runstep() returned true value");
-is($step->result(), q{yes}, "Got expected result");
-
-is($conf->data->get('ports_base_dir'), $tdir,
-    "ports base directory set as expected");
-is($conf->data->get('ports_lib_dir'), qq{$tdir/lib},
-    "ports 'lib' directory set as expected");
-is($conf->data->get('ports_include_dir'), qq{$tdir/include},
-    "ports 'include' directory set as expected");
-
-ok(chdir $cwd, "Able to change back to original directory after testing");
-
-$conf->replenish($serialized);
-
-########## not Darwin; --verbose ##########
-
-($args, $step_list_ref) = process_options( {
-    argv            => [ q{--verbose} ],
-    mode            => q{configure},
-} );
-$conf->options->set(%{$args});
-$step = test_step_constructor_and_description($conf);
-# mock not Darwin
-my $osname = 'foobar';
-$conf->data->set_p5( 'OSNAME' => $osname );
-{
-    my ($stdout, $stderr);
-    my $ret = capture sub { $step->runstep($conf) }, \$stdout, \$stderr;
-    ok($ret, "runstep() returned true value");
-    is($step->result(), q{skipped}, "Got expected result for non-Darwin OS");
-    like(
-        $stdout,
-        qr/^Operating system is $osname; Macports is Darwin only/,
-        "Got expected verbose output"
-    );
-}
-
-$conf->replenish($serialized);
-
-########## Darwin; --verbose; no Macports ##########
-
-($args, $step_list_ref) = process_options( {
-    argv            => [ q{--verbose} ],
-    mode            => q{configure},
-} );
-$conf->options->set(%{$args});
-$step = test_step_constructor_and_description($conf);
-# mock no Macports-default directories
-$step->{ports_root} = File::Spec->catdir( qw( / my ridiculous foobar ) );
-SKIP: {
-    skip 'Macports is Darwin only', 3 unless $^O =~ /darwin/;
-    my ($stdout, $stderr);
-    my $ret = capture sub { $step->runstep($conf) }, \$stdout, \$stderr;
-    ok($ret, "runstep() returned true value");
-    is($step->result(), 'no', "Got expected result");
-    like(
-        $stdout,
-        qr/^Could not locate Macports directories/,
-        "Got expected verbose output"
-    );
-}
-$step->{ports_root} = undef; # prepare for next test
-
-$conf->replenish($serialized);
-
-########## Darwin; defective Macports ##########
-
-($args, $step_list_ref) = process_options( {
-    argv            => [ ],
-    mode            => q{configure},
-} );
-$conf->options->set(%{$args});
-$step = test_step_constructor_and_description($conf);
-# mock no Macports root directory
-SKIP: {
-    skip 'Macports is Darwin only', 2 unless $^O =~ /darwin/;
-    $step->{ports_root} = undef;
-    ok($step->runstep($conf), "runstep() returned true value");
-    is($step->result(), 'no', "Got expected result");
-}
-
-$conf->replenish($serialized);
-
-########## Darwin; --verbose; defective Macports ##########
-
-($args, $step_list_ref) = process_options( {
-    argv            => [ q{--verbose} ],
-    mode            => q{configure},
-} );
-$conf->options->set(%{$args});
-$step = test_step_constructor_and_description($conf);
-# mock no Macports root directory
-$step->{ports_root} = undef;
-
-my ($stdout, $stderr);
-my $ret = capture sub { $step->runstep($conf) }, \$stdout, \$stderr;
-ok($ret, "runstep() returned true value");
-is($step->result(), 'no', "Got expected result");
-like(
-    $stdout,
-    qr/^Could not locate Macports root directory/,
-    "Got expected verbose output"
-);
-
-pass("Completed all tests in $0");
-
-################### DOCUMENTATION ###################
-
-=head1 NAME
-
-auto/macports-01.t - test auto::macports
-
-=head1 SYNOPSIS
-
-    % prove t/steps/auto/macports-01.t
-
-=head1 DESCRIPTION
-
-The files in this directory test functionality used by F<Configure.pl>.
-
-The tests in this file test auto::macports.  Some tests run only on Darwin.
-Others simulate what happens on operating systems other than Darwin.
-
-=head1 AUTHOR
-
-James E Keenan
-
-=head1 SEE ALSO
-
-config::auto::macports, F<Configure.pl>.
-
-=cut
-
-# Local Variables:
-#   mode: cperl
-#   cperl-indent-level: 4
-#   fill-column: 100
-# End:
-# vim: expandtab shiftwidth=4:
-

Deleted: branches/darwin2hints/t/steps/auto/macports-02.t
==============================================================================
--- branches/darwin2hints/t/steps/auto/macports-02.t	Sat Jul 11 16:41:08 2009	(r40002)
+++ /dev/null	00:00:00 1970	(deleted)
@@ -1,77 +0,0 @@
-#! perl
-# Copyright (C) 2007, Parrot Foundation.
-# $Id$
-# auto/macports-02.t
-
-use strict;
-use warnings;
-use Test::More;
-plan( skip_all => 'Macports is Darwin only' ) unless $^O =~ /darwin/;
-plan( tests => 12 );
-use Carp;
-use lib qw( lib t/configure/testlib );
-use_ok('config::init::defaults');
-$ENV{TEST_MACPORTS} = 'foobar';
-use_ok('config::auto::macports');
-
-use Parrot::Configure;
-use Parrot::Configure::Options qw( process_options );
-use Parrot::Configure::Test qw(
-    test_step_thru_runstep
-    test_step_constructor_and_description
-);
-
-my ($args, $step_list_ref) = process_options( {
-    argv            => [],
-    mode            => q{configure},
-} );
-
-my $conf = Parrot::Configure->new();
-
-test_step_thru_runstep($conf, q{init::defaults}, $args);
-
-my $pkg = q{auto::macports};
-
-$conf->add_steps($pkg);
-$conf->options->set(%{$args});
-my $step = test_step_constructor_and_description($conf);
-
-# mock no Macports-default directories
-ok($step->runstep($conf), "runstep() returned true value");
-is($step->result(), 'no', "Got expected result");
-
-pass("Completed all tests in $0");
-
-################### DOCUMENTATION ###################
-
-=head1 NAME
-
-auto/macports-02.t - test auto::macports
-
-=head1 SYNOPSIS
-
-    % prove t/steps/auto/macports-02.t
-
-=head1 DESCRIPTION
-
-The files in this directory test functionality used by F<Configure.pl>.
-
-The tests in this file test auto::macports.
-
-=head1 AUTHOR
-
-James E Keenan
-
-=head1 SEE ALSO
-
-config::auto::macports, F<Configure.pl>.
-
-=cut
-
-# Local Variables:
-#   mode: cperl
-#   cperl-indent-level: 4
-#   fill-column: 100
-# End:
-# vim: expandtab shiftwidth=4:
-

Modified: branches/darwin2hints/t/steps/auto/readline-01.t
==============================================================================
--- branches/darwin2hints/t/steps/auto/readline-01.t	Sat Jul 11 12:41:09 2009	(r40002)
+++ branches/darwin2hints/t/steps/auto/readline-01.t	Sat Jul 11 16:41:08 2009	(r40003)
@@ -5,7 +5,7 @@
 
 use strict;
 use warnings;
-use Test::More tests => 69;
+use Test::More tests => 14;
 use Carp;
 use Cwd;
 use File::Spec;
@@ -92,221 +92,6 @@
 like($@, qr/_select_lib\(\) takes hashref/,
     "Bad argument to _select_lib correctly detected");
 
-########## _handle_darwin_for_fink() ##########
-
-my ($flagsbefore, $flagsafter);
-
-$osname = 'foobar';
-$flagsbefore = $conf->data->get( 'linkflags' );
-ok($step->_handle_darwin_for_fink($conf, $osname, 'readline/readline.h'),
-    "handle_darwin_for_fink() returned true value");
-$flagsafter = $conf->data->get( 'linkflags' );
-is($flagsbefore, $flagsafter, "No change in linkflags, as expected");
-
-my $cwd = cwd();
-{
-    my $tdir1 = tempdir( CLEANUP => 1 );
-    ok(chdir $tdir1, "Able to change to temporary directory");
-    ok( (mkdir 'lib'), "Able to make lib directory");
-    ok( (mkdir 'include'), "Able to make include directory");
-    my $libdir = File::Spec->catdir( $tdir1, 'lib' );
-    my $includedir = File::Spec->catdir( $tdir1, 'include' );
-    $conf->data->set('fink_lib_dir' => $libdir);
-    $conf->data->set('fink_include_dir' => $includedir);
-    $osname = 'darwin';
-    $flagsbefore = $conf->data->get( 'linkflags' );
-    ok($step->_handle_darwin_for_fink($conf, $osname, 'readline/readline.h'),
-        "handle_darwin_for_fink() returned true value");
-    $flagsafter = $conf->data->get( 'linkflags' );
-    is($flagsbefore, $flagsafter,
-        "No change in linkflags, as expected, where Fink lib and include directories exist but readline/readline.h does not");
-
-    ok(chdir $cwd, "Able to change back to original directory after testing");
-}
-
-{
-    my $tdir2 = tempdir( CLEANUP => 1 );
-    ok(chdir $tdir2, "Able to change to temporary directory");
-    ok( (mkdir 'lib'), "Able to make lib directory");
-    ok( (mkdir 'include'), "Able to make include directory");
-    ok( (mkdir 'include/readline'), "Able to make include/readline directory");
-    my $libdir = File::Spec->catdir( $tdir2, 'lib' );
-    my $includedir = File::Spec->catdir( $tdir2, 'include' );
-    $conf->data->set('fink_lib_dir' => $libdir);
-    $conf->data->set('fink_include_dir' => $includedir);
-    my $foo = File::Spec->catfile( $includedir, 'readline', 'readline.h' );
-    open my $FH, ">", $foo or croak "Could not open for writing";
-    print $FH "Hello world\n";
-    close $FH or croak "Could not close after writing";
-
-    $osname = 'darwin';
-    $flagsbefore = $conf->data->get( 'linkflags' );
-    ok($step->_handle_darwin_for_fink($conf, $osname, 'readline/readline.h'),
-        "handle_darwin_for_fink() returned true value");
-    $flagsafter = $conf->data->get( 'linkflags' );
-    isnt($flagsbefore, $flagsafter, "Change in linkflags, as expected");
-    like($conf->data->get( 'linkflags' ), qr/-L\Q$libdir\E/,
-        "'linkflags' modified as expected, in case where Fink lib and include dirs exist and readline/readline.h exists");
-    $conf->data->set( linkflags => $flagsbefore ); #reset for next test
-
-    ok(chdir $cwd, "Able to change back to original directory after testing");
-}
-
-{
-    my $tdir3 = tempdir( CLEANUP => 1 );
-    ok(chdir $tdir3, "Able to change to temporary directory");
-    ok( (mkdir 'lib'), "Able to make lib directory");
-    ok( (mkdir 'include'), "Able to make include directory");
-    ok( (mkdir 'include/readline'), "Able to make include/readline directory");
-    my $libdir = File::Spec->catdir( $tdir3, 'lib' );
-    my $includedir = File::Spec->catdir( $tdir3, 'include' );
-    $conf->data->set('fink_lib_dir' => $libdir);
-    $conf->data->set('fink_include_dir' => undef);
-
-    $osname = 'darwin';
-    $flagsbefore = $conf->data->get( 'linkflags' );
-    ok($step->_handle_darwin_for_fink($conf, $osname, 'readline/readline.h'),
-        "handle_darwin_for_fink() returned true value");
-    $flagsafter = $conf->data->get( 'linkflags' );
-    is($flagsbefore, $flagsafter,
-        "No change in linkflags, as expected, where Fink include directory does not exist");
-
-    ok(chdir $cwd, "Able to change back to original directory after testing");
-}
-
-{
-    my $tdir4 = tempdir( CLEANUP => 1 );
-    ok(chdir $tdir4, "Able to change to temporary directory");
-    ok( (mkdir 'lib'), "Able to make lib directory");
-    ok( (mkdir 'include'), "Able to make include directory");
-    ok( (mkdir 'include/readline'), "Able to make include/readline directory");
-    my $libdir = File::Spec->catdir( $tdir4, 'lib' );
-    my $includedir = File::Spec->catdir( $tdir4, 'include' );
-    $conf->data->set('fink_lib_dir' => undef );
-    $conf->data->set('fink_include_dir' => $includedir );
-
-    $osname = 'darwin';
-    $flagsbefore = $conf->data->get( 'linkflags' );
-    ok($step->_handle_darwin_for_fink($conf, $osname, 'readline/readline.h'),
-        "handle_darwin_for_fink() returned true value");
-    $flagsafter = $conf->data->get( 'linkflags' );
-    is($flagsbefore, $flagsafter,
-        "No change in linkflags, as expected, where Fink lib directory does not exist");
-
-    ok(chdir $cwd, "Able to change back to original directory after testing");
-}
-
-########## _handle_darwin_for_macports() ##########
-
-$osname = 'foobar';
-$flagsbefore = $conf->data->get( 'linkflags' );
-ok($step->_handle_darwin_for_macports($conf, $osname, 'readline/readline.h'),
-    "handle_darwin_for_macports() returned true value");
-$flagsafter = $conf->data->get( 'linkflags' );
-is($flagsbefore, $flagsafter, "No change in linkflags, as expected");
-# Get ready for the next test
-$conf->data->set( linkflags => $flagsbefore );
-
-$cwd = cwd();
-{
-    my $xtdir1 = File::Spec->canonpath( tempdir( CLEANUP => 1 ) );
-    ok(chdir $xtdir1, "Able to change to temporary directory");
-    ok( (mkdir 'lib'), "Able to make lib directory");
-    ok( (mkdir 'include'), "Able to make include directory");
-    my $libdir = File::Spec->catdir( $xtdir1, 'lib' );
-    my $includedir = File::Spec->catdir( $xtdir1, 'include' );
-    $conf->data->set( ports_base_dir => $xtdir1 );
-    $conf->data->set( ports_lib_dir => $libdir );
-    $conf->data->set( ports_include_dir => $includedir );
-    ok( (mkdir 'include/readline'), "Able to make include/readline directory");
-    $osname = 'darwin';
-    $flagsbefore = $conf->data->get( 'linkflags' );
-    ok($step->_handle_darwin_for_macports($conf, $osname, 'readline/readline.h'),
-        "handle_darwin_for_macports() returned true value");
-    $flagsafter = $conf->data->get( 'linkflags' );
-    is($flagsbefore, $flagsafter,
-        "No change in linkflags, as expected, where macports lib and include directories exist but readline/readline.h does not");
-
-    chdir $cwd or croak "Unable to change back to original directory";
-}
-
-$cwd = cwd();
-{
-    my $xtdir2 = File::Spec->canonpath( tempdir( CLEANUP => 1 ) );
-    ok(chdir $xtdir2, "Able to change to temporary directory");
-    ok( (mkdir 'lib'), "Able to make lib directory");
-    ok( (mkdir 'include'), "Able to make include directory");
-    my $libdir = File::Spec->catdir( $xtdir2, 'lib' );
-    my $includedir = File::Spec->catdir( $xtdir2, 'include' );
-    $conf->data->set( ports_base_dir => $xtdir2 );
-    $conf->data->set( ports_lib_dir => $libdir );
-    $conf->data->set( ports_include_dir => $includedir );
-    ok( (mkdir 'include/readline'), "Able to make include/readline directory");
-    my $foo = File::Spec->catfile( $includedir, 'readline', 'readline.h' );
-    open my $FH, ">", $foo or croak "Could not open for writing";
-    print $FH "Hello world\n";
-    close $FH or croak "Could not close after writing";
-
-    $osname = 'darwin';
-    $flagsbefore = $conf->data->get( 'linkflags' );
-    ok($step->_handle_darwin_for_macports($conf, $osname, 'readline/readline.h'),
-        "handle_darwin_for_macports() returned true value");
-    $flagsafter = $conf->data->get( 'linkflags' );
-    isnt($flagsbefore, $flagsafter, "Change in linkflags, as expected");
-    like($conf->data->get( 'linkflags' ), qr/-L\Q$libdir\E/,
-        "'linkflags' modified as expected, in case where macports lib and include dirs exist and readline/readline.h exists");
-    $conf->data->set( linkflags => $flagsbefore );
-
-    chdir $cwd or croak "Unable to change back to original directory";
-}
-
-
-$cwd = cwd();
-{
-    my $xtdir3 = File::Spec->canonpath( tempdir( CLEANUP => 1 ) );
-    ok(chdir $xtdir3, "Able to change to temporary directory");
-    ok( (mkdir 'lib'), "Able to make lib directory");
-    ok( (mkdir 'include'), "Able to make include directory");
-    my $libdir = File::Spec->catdir( $xtdir3, 'lib' );
-    my $includedir = File::Spec->catdir( $xtdir3, 'include' );
-    $conf->data->set( ports_base_dir => $xtdir3 );
-    $conf->data->set( ports_lib_dir => $libdir );
-    $conf->data->set( ports_include_dir => undef );
-
-    $osname = 'darwin';
-    $flagsbefore = $conf->data->get( 'linkflags' );
-    ok($step->_handle_darwin_for_macports($conf, $osname, 'readline/readline.h'),
-        "handle_darwin_for_macports() returned true value");
-    $flagsafter = $conf->data->get( 'linkflags' );
-    is($flagsbefore, $flagsafter,
-        "No change in linkflags, as expected, where Macports include directory does not exist");
-
-    chdir $cwd or croak "Unable to change back to original directory";
-}
-
-$cwd = cwd();
-{
-    my $xtdir4 = File::Spec->canonpath( tempdir( CLEANUP => 1 ) );
-    ok(chdir $xtdir4, "Able to change to temporary directory");
-    ok( (mkdir 'lib'), "Able to make lib directory");
-    ok( (mkdir 'include'), "Able to make include directory");
-    my $libdir = File::Spec->catdir( $xtdir4, 'lib' );
-    my $includedir = File::Spec->catdir( $xtdir4, 'include' );
-    $conf->data->set( ports_base_dir => $xtdir4 );
-    $conf->data->set( ports_lib_dir => undef );
-    $conf->data->set( ports_include_dir => $includedir );
-
-    $osname = 'darwin';
-    $flagsbefore = $conf->data->get( 'linkflags' );
-    ok($step->_handle_darwin_for_macports($conf, $osname, 'readline/readline.h'),
-        "handle_darwin_for_macports() returned true value");
-    $flagsafter = $conf->data->get( 'linkflags' );
-    is($flagsbefore, $flagsafter,
-        "No change in linkflags, as expected, where Macports lib directory does not exist");
-
-    chdir $cwd or croak "Unable to change back to original directory";
-}
-
 pass("Completed all tests in $0");
 
 ################### DOCUMENTATION ###################


More information about the parrot-commits mailing list