Ken Williams <[EMAIL PROTECTED]> wrote on 03/06/2005 10:50:17 AM:

> Care to try 0.09_01, which is now hitting CPAN?  I've split out the
> generation of command-line switches so it can easily be overridden for
> VMS.  So compile() might work now.  link() and friends haven't been
> touched, though.

Enclosed is a patch against 0.09_01 that yields `mmk test` results
of:

t/01-basic....
ok
t/02-link.....
ok
All tests successful.
Files=2, Tests=16,  5 wallclock secs ( 0.00 cusr +  0.00 csys =  0.00 CPU)

as well as the following against perl 5.6.1 on Solaris 8:

t/01-basic....ok
t/02-link.....ok
All tests successful.
Files=2, Tests=16,  3 wallclock secs ( 0.98 cusr +  0.72 csys =  1.70 CPU)

I only had to weak the two files VMS.pm and 02-link.t. Do not be
surprised if someone subsequently suggests an alteration to the /include
equivalent of the -I flags since we have the literal '/Include=[]'
embeded in $Config{ccflags} for VMS.  I also played a little loose with
trying to grab the 11 return $? (to VMS users: the $STATUS) for the
executable program that is built and run for the 02-link.t test. In
principle we could try putting C<use vmsish qw(status);>
type statements to obtain the 11, in practice I am a little worried
about what that might do to other platforms.  Another concern I have
that is not yet addressed at all is the VMS specific matter of an
oddity known as a linker options file.  ExtUtils::MakeMaker knows a
bit about how to make VMS opt files and I suspect it will not be
long before ExtUtils::CBuilder will need to know that too (perhaps
later in trying to build larger more complexe ld invokations).

At any rate here you go:

diff -ru ExtUtils-CBuilder-0.09_01.orig/lib/ExtUtils/CBuilder/Platform/VMS.pm 
ExtUtils-CBuilder-0.09_01/lib/ExtUtils/CBuilder/Platform/VMS.pm
--- ExtUtils-CBuilder-0.09_01.orig/lib/ExtUtils/CBuilder/Platform/VMS.pm      
2005-03-06 10:47:42.000000000 -0500
+++ ExtUtils-CBuilder-0.09_01/lib/ExtUtils/CBuilder/Platform/VMS.pm     
2005-03-10 15:45:33.998024000 -0500
@@ -6,20 +6,47 @@
 use vars qw(@ISA);
 @ISA = qw(ExtUtils::CBuilder::Base);

-sub need_prelink { 1 }
+sub need_prelink { 0 }

 sub arg_include_dirs {
   my $self = shift;
   return '/include=(' . join(',', @_) . ')';
 }

-sub arg_nolink { }
+sub arg_nolink {
+  my $self = shift;
+  return '';
+}

 sub arg_object_file {
   my ($self, $file) = @_;
   return "/obj=$file";
 }

+sub _do_link {
+  my ($self, $type, %args) = @_;
+
+  my $cf = $self->{config}; # For convenience
+
+  my $objects = delete $args{objects};
+  $objects = [$objects] unless ref $objects;
+  my $out = $args{$type} || $self->$type($objects->[0]);
+
+  my @temp_files;
+  @temp_files =
+    $self->prelink(%args,
+                   dl_name => $args{module_name}) if $self->need_prelink;
+
+  my @linker_flags = $self->split_like_shell($args{extra_linker_flags});
+  my @lddlflags = $args{lddl} ? ($cf->{lddlflags}."=$out") : ("/exe=$out");
+  my @shrp = $self->split_like_shell($cf->{shrpenv});
+  my @ld = $self->split_like_shell($cf->{ld});
+  $self->do_system(@shrp, @ld, @lddlflags, @$objects, @linker_flags)
+    or die "error building $out from @$objects";
+
+  return wantarray ? ($out, @temp_files) : $out;
+}
+


 1;
diff -ru ExtUtils-CBuilder-0.09_01.orig/t/02-link.t 
ExtUtils-CBuilder-0.09_01/t/02-link.t
--- ExtUtils-CBuilder-0.09_01.orig/t/02-link.t  2005-03-06 10:47:42.000000000 
-0500
+++ ExtUtils-CBuilder-0.09_01/t/02-link.t 2005-03-10 15:46:03.105026000 -0500
@@ -32,11 +32,18 @@
 # Link
 my ($exe_file, @temps);
 ($exe_file, @temps) = $b->link_executable(objects => $object_file);
-ok $exe_file;
+ok -e $exe_file;

 # Try the executable
-my $retval = system($exe_file);
-ok $retval >> 8, 11;
+my $retval;
+if ($^O eq 'VMS') {
+  $retval = system("mcr $exe_file");
+  ok $retval, 0;
+}
+else {
+  $retval = system($exe_file);
+  ok $retval >> 8, 11;
+}

 # Clean up
 for ($source_file, $exe_file, $object_file, @temps) {
End of Patch

Peter Prymmer

also as a MIME attachment to circumvent the Notes line break
gremlin:

(See attached file: cbuilder.patch)

Attachment: cbuilder.patch
Description: Binary data

Reply via email to