Commit | Line | Data |
6b09c160 |
1 | package ExtUtils::CBuilder::Platform::VMS; |
2 | |
3 | use strict; |
4 | use ExtUtils::CBuilder::Base; |
5 | |
6 | use vars qw($VERSION @ISA); |
345dbb93 |
7 | $VERSION = '0.12'; |
6b09c160 |
8 | @ISA = qw(ExtUtils::CBuilder::Base); |
9 | |
4629f7b1 |
10 | sub need_prelink { 0 } |
6b09c160 |
11 | |
12 | sub arg_include_dirs { |
2bd31f1a |
13 | my ($self, @dirs) = @_; |
14 | |
15 | # VMS can only have one include list, add the one from config. |
16 | if ($self->{config}{ccflags} =~ s{/inc[^=]+(?:=)+(?:\()?([^\/\)]*)} {}i) { |
17 | unshift @dirs, $1; |
18 | } |
19 | return unless @dirs; |
20 | |
21 | return ('/include=(' . join(',', @dirs) . ')'); |
22 | } |
23 | |
24 | sub _do_link { |
25 | my ($self, $type, %args) = @_; |
26 | |
27 | my $objects = delete $args{objects}; |
28 | $objects = [$objects] unless ref $objects; |
29 | |
30 | # VMS has two option files, the external symbol, and to pull in PerlShr |
31 | if ($args{lddl}) { |
32 | my @temp_files = |
33 | $self->prelink(%args, dl_name => $args{module_name}); |
34 | |
35 | $objects->[-1] .= ','; |
36 | |
37 | # If creating a loadable library, the link option file is needed. |
38 | push @$objects, 'sys$disk:[]' . $temp_files[0] . '/opt,'; |
39 | |
40 | # VMS always needs the option file for the Perl shared image. |
41 | push @$objects, $self->perl_inc() . 'PerlShr.Opt/opt'; |
42 | } |
43 | |
44 | return $self->SUPER::_do_link($type, %args, objects => $objects); |
6b09c160 |
45 | } |
46 | |
47 | sub arg_nolink { return; } |
48 | |
49 | sub arg_object_file { |
50 | my ($self, $file) = @_; |
51 | return "/obj=$file"; |
52 | } |
53 | |
54 | sub arg_exec_file { |
55 | my ($self, $file) = @_; |
56 | return ("/exe=$file"); |
57 | } |
58 | |
59 | sub arg_share_object_file { |
60 | my ($self, $file) = @_; |
61 | return ("$self->{config}{lddlflags}=$file"); |
62 | } |
63 | |
2bd31f1a |
64 | |
65 | sub lib_file { |
66 | my ($self, $dl_file) = @_; |
67 | $dl_file =~ s/\.[^.]+$//; |
68 | $dl_file =~ tr/"//d; |
69 | $dl_file = $dl_file .= '.' . $self->{config}{dlext}; |
70 | |
71 | # Need to create with the same name as DynaLoader will load with. |
72 | if (defined &DynaLoader::mod2fname) { |
73 | my ($dev,$dir,$file) = File::Spec->splitpath($dl_file); |
74 | $file = DynaLoader::mod2fname([$file]); |
75 | $dl_file = File::Spec->catpath($dev,$dir,$file); |
76 | } |
77 | return $dl_file; |
78 | } |
79 | |
6b09c160 |
80 | 1; |