my $Config_libext = $Config{lib_ext} || ".a";
sub ext {
- my($potential_libs, $Verbose) = @_;
- if ($Config{'osname'} eq 'os2' and $Config{libs}) {
+ my($self,$potential_libs, $Verbose) = @_;
+ if ($Config{osname} =~ m|^os/?2$|i and $Config{libs}) {
# Dynamic libraries are not transitive, so we may need including
# the libraries linked against perl.dll again.
# For gcc-2.6.2 on linux (March 1995), DLD can not load
# .sa libraries, with the exception of libm.sa, so we
# deliberately skip them.
- if (@fullname = lsdir($thispth,"^lib$thislib\.$so\.[0-9]+")){
+ if (@fullname = $self->lsdir($thispth,"^lib$thislib\.$so\.[0-9]+")){
# Take care that libfoo.so.10 wins against libfoo.so.9.
# Compare two libraries to find the most recent version
# number. E.g. if you have libfoo.so.9.0.7 and
("@extralibs", "@bsloadlibs", "@ldloadlibs",join(":",@ld_run_path));
}
-sub lsdir { #yes, duplicate code seems less hassle than having an
- #extra file with only lsdir
- my($dir, $regex) = @_;
- local(*DIR, @ls);
- opendir(DIR, $dir || ".") or return ();
- @ls = readdir(DIR);
- closedir(DIR);
- @ls = grep(/$regex/, @ls) if $regex;
- @ls;
-}
-
1;
+
__END__
=head1 NAME
use File::Basename;
Exporter::import('ExtUtils::MakeMaker', '$Verbose', '&neatvalue');
+unshift @MM::ISA, 'ExtUtils::MM_VMS';
sub eliminate_macros {
$rslt = vmspath($self->eliminate_macros($spath)."/$sdir");
}
else { $rslt = vmspath($dir); }
- print "catdir(",join(',',@_[1..$#_]),") = |$rslt|\n" if $Verbose >= 3;
+ print "catdir($path,$dir) = |$rslt|\n" if $Verbose >= 3;
$rslt;
}
my($spath) = $path;
$spath =~ s/.dir$//;
if ( $spath =~ /^[^\)\]\/:>]+\)$/ && basename($file) eq $file) { $rslt = "$spath$file"; }
- else {
- $rslt = $self->eliminate_macros($spath);
- $rslt = vmsify($rslt.($rslt ? '/' : '').unixify($file));
- }
+ else { $rslt = vmsify($self->eliminate_macros($spath).'/'.unixify($file)); }
}
else { $rslt = vmsify($file); }
- print "catfile(",join(',',@_[1..$#_]),") = |$rslt|\n" if $Verbose >= 3;
+ print "catfile($path,$file) = |$rslt|\n" if $Verbose >= 3;
$rslt;
}
$self->{MAKEFILE} ||= $self->{FIRST_MAKEFILE};
$self->{NOECHO} ||= '@ ';
$self->{RM_F} = '$(PERL) -e "foreach (@ARGV) { 1 while ( -d $_ ? rmdir $_ : unlink $_)}"';
- $self->{RM_RF} = '$(PERL) "-I$(INST_LIB)" -e "use File::Path; @dirs = map(VMS::Filespec::unixify($_),@ARGV); rmtree(\@dirs,0,0)"';
+ $self->{RM_RF} = '$(PERL) -e "use File::Path; @dirs = map(VMS::Filespec::unixify($_),@ARGV); rmtree(\@dirs,0,0)"';
$self->{TOUCH} = '$(PERL) -e "$t=time; foreach (@ARGV) { -e $_ ? utime($t,$t,@ARGV) : (open(F,qq(>$_)),close F)}"';
$self->{CHMOD} = '$(PERL) -e "chmod @ARGV"'; # expect Unix syntax from MakeMaker
$self->{CP} = 'Copy/NoConfirm';
ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
$self = $ExtUtils::MakeMaker::Parent[-1];
}
- qq!
+ "
# Assumes \$(MMS) invokes MMS or MMK
# (It is assumed in some cases later that the default makefile name
# (Descrip.MMS for MM[SK]) is used.)
RM_RF = $self->{RM_RF}
UMASK_NULL = $self->{UMASK_NULL}
MKPATH = Create/Directory
-EQUALIZE_TIMESTAMP = \$(PERL) -we "open F,"">\$ARGV[1]"";close F;utime((stat(""\$ARGV[0]""))[8,9],\$ARGV[1])"
-!;
+";
}
return '' unless $self->needs_linking();
my($funcs) = $attribs{DL_FUNCS} || $self->{DL_FUNCS} || {};
- my($vars) = $attribs{DL_VARS} || $self->{DL_VARS} || [];
- my($srcdir)= $attribs{PERL_SRC} || $self->{PERL_SRC} || '';
+ my($vars) = $attribs{DL_VARS} || $self->{DL_VARS} || [];
my(@m);
- unless ($self->{SKIPHASH}{'dynamic'}) {
- push(@m,'
+ push(@m,'
dynamic :: rtls.opt $(INST_ARCHAUTODIR)$(BASEEXT).opt
$(NOOP)
-');
- if ($srcdir) {
- my($opt) = $self->catfile($srcdir,'perlshr.opt');
- push(@m,"# Depend on $(BASEEXT).opt to insure we copy here *after* autogenerating (wrong) rtls.opt in Mksymlists
-rtls.opt : $opt \$(BASEEXT).opt
- Copy/Log $opt Sys\$Disk:[]rtls.opt
-");
- }
- else {
- push(@m,'
+
# rtls.opt is built in the same step as $(BASEEXT).opt
rtls.opt : $(BASEEXT).opt
$(TOUCH) $(MMS$TARGET)
-');
- }
- }
+') unless $self->{SKIPHASH}{'dynamic'};
push(@m,'
static :: $(INST_ARCHAUTODIR)$(BASEEXT).opt
for $from (@{$self->{EXE_FILES}}) {
my($path) = '$(INST_EXE)' . basename($from);
local($_) = $path; # backward compatibility
- $to = $self->exescan($path);
- print "exescan($from) => '$to'\n" if ($Verbose >=2);
+ $to = $self->libscan($path);
+ print "libscan($from) => '$to'\n" if ($Verbose >=2);
$fromto{$from}=$to;
}
@to = values %fromto;
my(@pasthru);
foreach $key (qw(INSTALLPRIVLIB INSTALLARCHLIB INSTALLBIN
- INSTALLMAN1DIR INSTALLMAN3DIR LIBPERL_A
- LINKTYPE PREFIX)){
+ INSTALLMAN1DIR INSTALLMAN3DIR LIBPERL_A LINKTYPE)){
push @pasthru, "$key=\"$self->{$key}\"";
}
$self = $ExtUtils::MakeMaker::Parent[-1];
}
my(@m);
- push @m, q[
+ push @m, q{
doc_install ::
- ],$self->{NOECHO},q[Write Sys$Output "Appending installation info to $(INST_ARCHLIB)perllocal.pod"
- ],$self->{NOECHO},q[$(PERL) -e "print q{use ExtUtils::MakeMaker; }" >.MM_tmp
- ],$self->{NOECHO},q[$(PERL) -e "print q{MY->new({})->writedoc(}" >>.MM_tmp
- ],$self->{NOECHO},q[$(PERL) -e "print q{'Module','$(NAME)','LINKTYPE=$(LINKTYPE)',}" >>.MM_tmp
- ],$self->{NOECHO},q[$(PERL) -e "print q{'VERSION=$(VERSION)','XS_VERSION=$(XS_VERSION)',}" >>.MM_tmp
- ],$self->{NOECHO},q[$(PERL) -e "print q{'EXE_FILES=$(EXE_FILES)')}" >>.MM_tmp
- ],$self->{NOECHO},q[$(PERL) "-I$(PERL_LIB)" "-I$(PERL_ARCHLIB)" .MM_tmp >>$(INSTALLARCHLIB)perllocal.pod
- ],$self->{NOECHO},q[If F$Search(".MM_tmp") .nes. "" then Delete/NoLog .MM_tmp;
-];
+ },$self->{NOECHO},q{Write Sys$Output "Appending installation info to $(INST_ARCHLIB)perllocal.pod"
+ },$self->{NOECHO},q{$(PERL) "-I$(PERL_LIB)" "-I$(PERL_ARCHLIB)" \\
+ -e "use ExtUtils::MakeMaker; MY->new({})->writedoc('Module', '$(NAME)', \\
+ 'LINKTYPE=$(LINKTYPE)', 'VERSION=$(VERSION)', 'XS_VERSION=$(XS_VERSION)', 'EXE_FILES=$(EXE_FILES)')" \\
+ >>$(INSTALLARCHLIB)perllocal.pod
+};
push(@m, "
install :: pure_install doc_install
push(@m, ' If F$Search("',$vmsdir,'$(MAKEFILE)").nes."" Then $(PERL) -e "chdir ',"'$vmsdir'",
'; print `$(MMS) $(PASTHRU2) test`'."\n");
}
- push(@m, "\t$self->{NOECHO}Write Sys\$Output \"No tests defined for \$(NAME) extension.\"\n")
+ push(@m, "\t$self->{NOECHO}Write Sys\$Output 'No tests defined for \$(NAME) extension.'\n")
unless $tests or -f "test.pl" or @{$self->{DIR}};
push(@m, "\n");
push(@m, "test_dynamic :: all\n");
push(@m, $self->test_via_harness('$(FULLPERL)', $tests)) if $tests;
push(@m, $self->test_via_script('$(FULLPERL)', 'test.pl')) if -f "test.pl";
- push(@m, " \$(NOOP)\n") if (!$tests && ! -f "test.pl");
push(@m, "\n");
# Occasionally we may face this degenerate target:
push(@m, "test_static :: all \$(MAP_TARGET)\n");
push(@m, $self->test_via_harness('$(MAP_TARGET)', $tests)) if $tests;
push(@m, $self->test_via_script('$(MAP_TARGET)', 'test.pl')) if -f "test.pl";
- push(@m, "\t$self->{NOECHO}\$(NOOP)\n") if (!$tests && ! -f "test.pl");
push(@m, "\n");
}
else {
- push @m, "test_static :: test_dynamic\n\t$self->{NOECHO}\$(NOOP)\n";
+ push @m, "test_static :: test_dynamic\n";
}
join('',@m);
push @m, "
${vmsdir}.exists :: \$(PERL_INC)perl.h
$self->{NOECHO}\$(MKPATH) $vmsdir
- $self->{NOECHO}\$(EQUALIZE_TIMESTAMP) \$(MMS\$SOURCE) \$(MMS\$TARGET)
+ $self->{NOECHO}\$(TOUCH) ${vmsdir}.exists
";
}
join "", @m;
1;
__END__
+
+=head1 NAME
+
+ExtUtils::MM_VMS - methods to override UN*X behaviour in ExtUtils::MakeMaker
+
+=head1 DESCRIPTION
+
+See ExtUtils::MM_Unix for a documentation of the methods provided
+there. This package overrides the implementation of these methods, not
+the semantics.
+
# We'll need this if we ever add any OS which uses mod2fname
# require DynaLoader;
-# if (defined &DynaLoader::mod2fname and not $spec{DLBASE}) {
-# $spec{DLBASE} = DynaLoader::mod2fname([ split(/::/,$spec{NAME}) ]);
-# }
+ if (defined &DynaLoader::mod2fname and not $spec{DLBASE}) {
+ $spec{DLBASE} = DynaLoader::mod2fname([ split(/::/,$spec{NAME}) ]);
+ }
if ($osname eq 'aix') { _write_aix(\%spec); }
elsif ($osname eq 'VMS') { _write_vms(\%spec) }
- elsif ($osname eq 'OS2') { _write_os2(\%spec) }
+ elsif ($osname =~ m|^os/?2$|i) { _write_os2(\%spec) }
else { croak("Don't know how to create linker option file for $osname\n"); }
}
print DEF "LIBRARY '$data->{DLBASE}' INITINSTANCE TERMINSTANCE\n";
print DEF "CODE LOADONCALL\n";
print DEF "DATA LOADONCALL NONSHARED MULTIPLE\n";
- print DEF "EXPORTS\n";
- print DEF join("\n",@{$data->{DL_VARS}}, "\n") if @{$data->{DL_VARS}};
- print DEF join("\n",@{$data->{FUNCLIST}}, "\n") if @{$data->{FUNCLIST}};
+ print DEF "EXPORTS\n ";
+ print DEF join("\n ",@{$data->{DL_VARS}}, "\n") if @{$data->{DL_VARS}};
+ print DEF join("\n ",@{$data->{FUNCLIST}}, "\n") if @{$data->{FUNCLIST}};
+ if (%{$data->{IMPORTS}}) {
+ print DEF "IMPORTS\n";
+my ($name, $exp);
+while (($name, $exp)= each %{$data->{IMPORTS}}) {
+ print DEF " $name=$exp\n";
+}
+ }
close DEF;
}
associative array, in which each key is the name of a package, and
each value is an a reference to an array of function names which
should be exported by the extension. For instance, one might say
-C<DL_FUNCS =E<gt> { Homer::Iliad =E<gt> [ qw(trojans greeks) ],
-Homer::Odyssey =E<gt> [ qw(travellers family suitors) ] }>. The
+C<DL_FUNCS => { Homer::Iliad => [ qw(trojans greeks) ],
+Homer::Odyssey => [ qw(travellers family suitors) ] }>. The
function names should be identical to those in the XSUB code;
C<Mksymlists> will alter the names written to the linker option
file to match the changes made by F<xsubpp>. In addition, if