Skip to content

Commit 0a9948f

Browse files
committed
Add overridden object files to static lib under XSMULTI/XSBUILD.
But only on VMS. Apparently the Unix version leaves the extra object files lying around loose and explicitly adds them to the link command. But there are no link changes needed if we simply add them to the static library, which is easier to manage and make the static library a truer reflection of the dynamic library that will be made from it.
1 parent c9f925f commit 0a9948f

File tree

1 file changed

+25
-5
lines changed

1 file changed

+25
-5
lines changed

lib/ExtUtils/MM_VMS.pm

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1195,9 +1195,26 @@ Use VMS commands to manipulate object library.
11951195
=cut
11961196

11971197
sub xs_make_static_lib {
1198-
my ($self, $from, $to, $todir) = @_;
1199-
my @m = sprintf "\n%s : %s\$(DFSEP).exists\n\n%s : %s \$(MYEXTLIB)\n",
1200-
$from, $todir, $to, $from;
1198+
my ($self, $object, $to, $todir) = @_;
1199+
1200+
my @objects;
1201+
if ($self->{XSMULTI}) {
1202+
# The extension name should be the main object file name minus file type.
1203+
my $lib = $object;
1204+
$lib =~ s/\$\(OBJ_EXT\)\z//;
1205+
my $override = $self->_xsbuild_value('xs', $lib, 'OBJECT');
1206+
$object = $override if defined $override;
1207+
@objects = map { $self->fixpath($_,0) } split /(?<!\^)\s+/, $object;
1208+
}
1209+
else {
1210+
push @objects, $object;
1211+
}
1212+
1213+
my @m;
1214+
for my $obj (@objects) {
1215+
push(@m, sprintf "\n%s : %s\$(DFSEP).exists", $obj, $todir);
1216+
}
1217+
push(@m, sprintf "\n\n%s : %s \$(MYEXTLIB)\n", $to, (join ' ', @objects));
12011218

12021219
# If this extension has its own library (eg SDBM_File)
12031220
# then copy that to $(INST_STATIC) and add $(OBJECT) into it.
@@ -1209,8 +1226,11 @@ sub xs_make_static_lib {
12091226
# 'cause it's a library and you can't stick them in other libraries.
12101227
# In that case, we use $OBJECT instead and hope for the best
12111228
if ($self->{MYEXTLIB}) {
1212-
push(@m,"\t",'Library/Object/Replace $(MMS$TARGET) $(OBJECT)',"\n");
1213-
} else {
1229+
for my $obj (@objects) {
1230+
push(@m,"\t",'Library/Object/Replace $(MMS$TARGET) ' . $obj,"\n");
1231+
}
1232+
}
1233+
else {
12141234
push(@m,"\t",'Library/Object/Replace $(MMS$TARGET) $(MMS$SOURCE_LIST)',"\n");
12151235
}
12161236

0 commit comments

Comments
 (0)