1 package ExtUtils
::MM_OS2
;
8 Exporter
::import
('ExtUtils::MakeMaker',
9 qw( $Verbose &neatvalue));
11 unshift @MM::ISA, 'ExtUtils::MM_OS2';
14 my($self,%attribs) = @_;
16 my($funcs) = $attribs{DL_FUNCS} || $self->{DL_FUNCS} || {};
17 my($vars) = $attribs{DL_VARS} || $self->{DL_VARS} || [];
18 my($funclist) = $attribs{FUNCLIST} || $self->{FUNCLIST} || [];
19 my($imports) = $attribs{IMPORTS} || $self->{IMPORTS} || {};
21 (my $boot = $self->{NAME}) =~ s/:/_/g;
23 if (not $self->{SKIPHASH}{'dynamic'}) {
25 $self->{BASEEXT}.def: Makefile.PL
27 ' $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e \'use ExtUtils::Mksymlists; \\
28 Mksymlists("NAME" => "$(NAME)", "DLBASE" => "$(DLBASE)", ',
29 '"VERSION" => "$(VERSION)", "DISTNAME" => "$(DISTNAME)", ',
30 '"INSTALLDIRS" => "$(INSTALLDIRS)", ',
31 '"DL_FUNCS" => ',neatvalue($funcs),
32 ', "FUNCLIST" => ',neatvalue($funclist),
33 ', "IMPORTS" => ',neatvalue($imports),
34 ', "DL_VARS" => ', neatvalue($vars), ');\'
37 if (%{$self->{IMPORTS}}) {
38 # Make import files (needed for static build)
39 -d 'tmp_imp' or mkdir 'tmp_imp', 0777 or die "Can't mkdir tmp_imp";
40 open IMP, '>tmpimp.imp' or die "Can't open tmpimp.imp";
42 while (($name, $exp)= each %{$self->{IMPORTS}}) {
43 my ($lib, $id) = ($exp =~ /(.*)\.(.*)/) or die "Malformed IMPORT `$exp'";
44 print IMP "$name $lib $id ?\n";
46 close IMP or die "Can't close tmpimp.imp";
47 # print "emximp -o tmpimp$Config::Config{lib_ext} tmpimp.imp\n";
48 system "emximp -o tmpimp$Config::Config{lib_ext} tmpimp.imp"
49 and die "Cannot make import library: $!, \$?=$?";
51 system "cd tmp_imp; $Config::Config{ar} x ../tmpimp$Config::Config{lib_ext}"
52 and die "Cannot extract import objects: $!, \$?=$?";
59 my $old = $self->ExtUtils::MM_Unix::static_lib();
60 return $old unless %{$self->{IMPORTS}};
62 my @chunks = split /\n{2,}/, $old;
63 shift @chunks unless length $chunks[0]; # Empty lines at the start
64 $chunks[0] .= <<'EOC';
66 $(AR) $(AR_STATIC_ARGS) $@ tmp_imp/* && $(RANLIB) $@
68 return join "\n\n". '', @chunks;
71 sub replace_manpage_separator
{
79 $file =~ s
,[/\\]+,/,g
;
80 return $file if -x
$file && ! -d _
;
81 return "$file.exe" if -x
"$file.exe" && ! -d _
;
82 return "$file.cmd" if -x
"$file.cmd" && ! -d _
;
86 sub file_name_is_absolute
{
88 $file =~ m{^([a-z]:)?[\\/]}i ;
93 return "\$(PERL_INC)/libperl\$(LIB_EXT)";
96 =item perl_archive_after
98 This is an internal method that returns path to a library which
99 should be put on the linker command line I<after> the external libraries
100 to be linked to dynamic extensions. This may be needed if the linker
101 is one-pass, and Perl includes some overrides for C RTL functions,
106 sub perl_archive_after
108 return "\$(PERL_INC)/libperl_override\$(LIB_EXT)" unless $OS2::is_aout
;
115 return "$self->{BASEEXT}.def";
123 ExtUtils::MM_OS2 - methods to override UN*X behaviour in ExtUtils::MakeMaker
127 use ExtUtils::MM_OS2; # Done internally by ExtUtils::MakeMaker if needed
131 See ExtUtils::MM_Unix for a documentation of the methods provided
132 there. This package overrides the implementation of these methods, not