return ('-o', $file);
}
+sub arg_defines {
+ my ($self, %args) = @_;
+ return map "-D$_=$args{$_}", keys %args;
+}
+
sub compile {
my ($self, %args) = @_;
die "Missing 'source' argument to compile()" unless defined $args{source};
(@{$args{include_dirs} || []},
$self->perl_inc());
+ my @defines = $self->arg_defines( %{$args{defines} || {}} );
+
my @extra_compiler_flags = $self->split_like_shell($args{extra_compiler_flags});
my @cccdlflags = $self->split_like_shell($cf->{cccdlflags});
my @ccflags = $self->split_like_shell($cf->{ccflags});
-
- #VMS can only have one include list, remove the one from config.
- if ((@include_dirs != 0) && ($^O eq 'VMS')) {
- for (@ccflags) {
- s/\/Include[^\/]*//;
- }
- }
my @optimize = $self->split_like_shell($cf->{optimize});
- my @flags = (@include_dirs, @cccdlflags, @extra_compiler_flags,
+ my @flags = (@include_dirs, @defines, @cccdlflags, @extra_compiler_flags,
$self->arg_nolink,
@ccflags, @optimize,
$self->arg_object_file($args{object_file}),
sub need_prelink { 0 }
+sub extra_link_args_after_prelink { return }
+
sub prelink {
my ($self, %args) = @_;
NAME => $args{dl_name},
DLBASE => $args{dl_base},
FILE => $args{dl_file},
+ VERSION => (defined $args{dl_version} ? $args{dl_version} : '0.0'),
);
# Mksymlists will create one of these files
my ($self, %args) = @_;
return $self->_do_link('exe_file', lddl => 0, %args);
}
-
+
sub _do_link {
my ($self, $type, %args) = @_;
$objects = [$objects] unless ref $objects;
my $out = $args{$type} || $self->$type($objects->[0]);
- # Need to create with the same name as Dyanloader will load with.
- if ($^O eq 'VMS') {
- my ($dev,$dir,$file) = File::Spec->splitpath($out);
- if (defined &DynaLoader::mod2fname) {
- $file = DynaLoader::mod2fname([$file]);
- $out = File::Spec->catpath($dev,$dir,$file);
- }
- }
-
my @temp_files;
@temp_files =
$self->prelink(%args,
dl_name => $args{module_name}) if $args{lddl} && $self->need_prelink;
- my @linker_flags = $self->split_like_shell($args{extra_linker_flags});
+ my @linker_flags = ($self->split_like_shell($args{extra_linker_flags}),
+ $self->extra_link_args_after_prelink(%args, dl_name => $args{module_name},
+ prelink_res => \@temp_files));
+
my @output = $args{lddl} ? $self->arg_share_object_file($out) : $self->arg_exec_file($out);
my @shrp = $self->split_like_shell($cf->{shrpenv});
my @ld = $self->split_like_shell($cf->{ld});
-
- # vms has two option files, the external symbol, and to pull in PerlShr
- if ($^O eq 'VMS') {
- $objects->[0] .= ',';
- $objects->[1] = 'sys$disk:[]' . @temp_files[0] . '/opt,';
- $objects->[2] = $self->perl_inc() . 'PerlShr.Opt/opt';
- }
-
+
$self->do_system(@shrp, @ld, @output, @$objects, @linker_flags)
or die "error building $out from @$objects";