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