John E. Malmberg wrote:
Ken Williams wrote:

Hi John,

After my last email I reworked the patch so that all the modifications are in Platform/VMS.pm. Could you confirm that it still works for you and I haven't broken it?

Hello Ken,

As I previously wrote to you, both my patch and this patch do not work.

While my patch fixed the ParseXS/t/basic that I was working on, it broke three other tests.

I have requested that Change 25364 be regressed from blead.

I have rerun all the lib/Extutils/ tests with this latest patched version of CBuilder/Platform/VMS.pm and the original CBuilder/base.pm.


In this patch:

sub need_prelink is left to return 0, because the VMS specific sub do_link has to set up the pre-link option file when needed.


In sub arg_include_dirs, I think I have fixed the it to properly extract the include directories from the $self->{config}{ccflags}.

I am still quite a novice in Perl programming.

Not only is the '/inc' case insensitive as you noted, it can be any thing from: '/inc=[]' to '/include_directory=([],[foo])'.

Next is that I needed to create a VMS specific sub lib_file and put the Dynaloader::mod2fname() code into it to set the name of the shared image.


The VMS specific sub _do_link that you provided needed to have the name changing code removed from it and put into lib_file as I mentioned above, so that test CBuilder/t/02-link will pass.

I also had to make the addition of the link option files conditional on if you are building a loadable image.

-John
[EMAIL PROTECTED]
Personal Opinion Only
--- lib/ExtUtils/CBuilder/Platform/VMS.pm_old   Sat Sep 10 22:28:04 2005
+++ lib/ExtUtils/CBuilder/Platform/VMS.pm       Sat Sep 10 23:45:10 2005
@@ -9,11 +9,20 @@
 
 sub need_prelink { 0 }
 
+
+
 sub arg_include_dirs {
-  my $self = shift;
-  return '/include=(' . join(',', @_) . ')';
+  my ($self, @dirs) = @_;
+
+  # VMS can only have one include list, add the one from config.
+  if ($self->{config}{ccflags} =~ s{/inc[^=]+(?:=)+(?:\()?([^\/\)]*)} {}i) {
+    unshift @dirs, $1;
+  }
+  return unless @dirs;
+  return ('/include=(' . join(',', @dirs) . ')');
 }
 
+
 sub arg_nolink { return; }
 
 sub arg_object_file {
@@ -31,4 +40,43 @@
   return ("$self->{config}{lddlflags}=$file");
 }
 
-1;
+
+sub lib_file {
+  my ($self, $dl_file) = @_;
+  $dl_file =~ s/\.[^.]+$//;
+  $dl_file =~ tr/"//d;
+  $dl_file = $dl_file .= '.' . $self->{config}{dlext};
+
+  # Need to create with the same name as DynaLoader will load with.
+  if (defined &DynaLoader::mod2fname) {
+    my ($dev,$dir,$file) = File::Spec->splitpath($dl_file);
+    $file = DynaLoader::mod2fname([$file]);
+    $dl_file = File::Spec->catpath($dev,$dir,$file);
+  }
+  return $dl_file;
+}
+
+sub _do_link {
+  my ($self, $type, %args) = @_;
+
+  my $objects = delete $args{objects};
+  $objects = [$objects] unless ref $objects;
+
+  my @temp_files;
+  @temp_files =
+    $self->prelink(%args,
+                  dl_name => $args{module_name}) if $args{lddl};
+
+  # VMS has two option files, the external symbol, and to pull in  PerlShr
+  if ($args{lddl}) {
+    $objects->[-1] .= ',';
+
+    # If creating a loadable library, the link option file is needed.
+    push @$objects, 'sys$disk:[]' . $temp_files[0] . '/opt,';
+
+    # VMS always needs the option file for the Perl shared image.
+    push @$objects, $self->perl_inc() . 'PerlShr.Opt/opt';
+  }
+
+  return $self->SUPER::_do_link($type, %args, objects => $objects);
+}

Reply via email to