1 package ExtUtils::MM_OS2;
12 require ExtUtils::MakeMaker;
13 ExtUtils::MakeMaker->import(qw( $Verbose &neatvalue));
17 unshift @MM::ISA, 'ExtUtils::MM_OS2';
23 ExtUtils::MM_OS2 - methods to override UN*X behaviour in ExtUtils::MakeMaker
27 use ExtUtils::MM_OS2; # Done internally by ExtUtils::MakeMaker if needed
31 See ExtUtils::MM_Unix for a documentation of the methods provided
32 there. This package overrides the implementation of these methods, not
42 my($self,%attribs) = @_;
44 my($funcs) = $attribs{DL_FUNCS} || $self->{DL_FUNCS} || {};
45 my($vars) = $attribs{DL_VARS} || $self->{DL_VARS} || [];
46 my($funclist) = $attribs{FUNCLIST} || $self->{FUNCLIST} || [];
47 my($imports) = $attribs{IMPORTS} || $self->{IMPORTS} || {};
49 (my $boot = $self->{NAME}) =~ s/:/_/g;
51 if (not $self->{SKIPHASH}{'dynamic'}) {
53 $self->{BASEEXT}.def: Makefile.PL
55 ' $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e \'use ExtUtils::Mksymlists; \\
56 Mksymlists("NAME" => "$(NAME)", "DLBASE" => "$(DLBASE)", ',
57 '"VERSION" => "$(VERSION)", "DISTNAME" => "$(DISTNAME)", ',
58 '"INSTALLDIRS" => "$(INSTALLDIRS)", ',
59 '"DL_FUNCS" => ',neatvalue($funcs),
60 ', "FUNCLIST" => ',neatvalue($funclist),
61 ', "IMPORTS" => ',neatvalue($imports),
62 ', "DL_VARS" => ', neatvalue($vars), ');\'
65 if ($self->{IMPORTS} && %{$self->{IMPORTS}}) {
66 # Make import files (needed for static build)
67 -d 'tmp_imp' or mkdir 'tmp_imp', 0777 or die "Can't mkdir tmp_imp";
68 open IMP, '>tmpimp.imp' or die "Can't open tmpimp.imp";
70 while (($name, $exp)= each %{$self->{IMPORTS}}) {
71 my ($lib, $id) = ($exp =~ /(.*)\.(.*)/) or die "Malformed IMPORT `$exp'";
72 print IMP "$name $lib $id ?\n";
74 close IMP or die "Can't close tmpimp.imp";
75 # print "emximp -o tmpimp$Config::Config{lib_ext} tmpimp.imp\n";
76 system "emximp -o tmpimp$Config::Config{lib_ext} tmpimp.imp"
77 and die "Cannot make import library: $!, \$?=$?";
79 system "cd tmp_imp; $Config::Config{ar} x ../tmpimp$Config::Config{lib_ext}"
80 and die "Cannot extract import objects: $!, \$?=$?";
87 my $old = $self->ExtUtils::MM_Unix::static_lib();
88 return $old unless $self->{IMPORTS} && %{$self->{IMPORTS}};
90 my @chunks = split /\n{2,}/, $old;
91 shift @chunks unless length $chunks[0]; # Empty lines at the start
92 $chunks[0] .= <<'EOC';
94 $(AR) $(AR_STATIC_ARGS) $@ tmp_imp/* && $(RANLIB) $@
96 return join "\n\n". '', @chunks;
99 sub replace_manpage_separator {
106 my($self,$file) = @_;
107 $file =~ s,[/\\]+,/,g;
108 return $file if -x $file && ! -d _;
109 return "$file.exe" if -x "$file.exe" && ! -d _;
110 return "$file.cmd" if -x "$file.cmd" && ! -d _;
114 sub file_name_is_absolute {
116 return File::Spec->file_name_is_absolute(@_);
121 return "\$(PERL_INC)/libperl\$(LIB_EXT)";
124 =item perl_archive_after
126 This is an internal method that returns path to a library which
127 should be put on the linker command line I<after> the external libraries
128 to be linked to dynamic extensions. This may be needed if the linker
129 is one-pass, and Perl includes some overrides for C RTL functions,
134 sub perl_archive_after
136 return "\$(PERL_INC)/libperl_override\$(LIB_EXT)" unless $OS2::is_aout;
143 return "$self->{BASEEXT}.def";