1 package ExtUtils::MM_OS2;
4 use vars qw($VERSION @ISA);
6 use ExtUtils::MakeMaker qw(neatvalue);
11 require ExtUtils::MM_Any;
12 require ExtUtils::MM_Unix;
13 @ISA = qw(ExtUtils::MM_Any ExtUtils::MM_Unix);
19 ExtUtils::MM_OS2 - methods to override UN*X behaviour in ExtUtils::MakeMaker
23 use ExtUtils::MM_OS2; # Done internally by ExtUtils::MakeMaker if needed
27 See ExtUtils::MM_Unix for a documentation of the methods provided
28 there. This package overrides the implementation of these methods, not
38 my($self, %attribs) = @_;
40 $attribs{TO_UNIX} ||= sprintf <<'MAKE_TEXT', $self->{NOECHO};
41 %s$(TEST_F) tmp.zip && $(RM) tmp.zip; $(ZIP) -ll -mr tmp.zip $(DISTVNAME) && unzip -o tmp.zip && $(RM) tmp.zip
44 return $self->SUPER::dist(%attribs);
48 my($self,%attribs) = @_;
50 my($funcs) = $attribs{DL_FUNCS} || $self->{DL_FUNCS} || {};
51 my($vars) = $attribs{DL_VARS} || $self->{DL_VARS} || [];
52 my($funclist) = $attribs{FUNCLIST} || $self->{FUNCLIST} || [];
53 my($imports) = $attribs{IMPORTS} || $self->{IMPORTS} || {};
55 (my $boot = $self->{NAME}) =~ s/:/_/g;
57 if (not $self->{SKIPHASH}{'dynamic'}) {
59 $self->{BASEEXT}.def: Makefile.PL
61 ' $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e \'use ExtUtils::Mksymlists; \\
62 Mksymlists("NAME" => "$(NAME)", "DLBASE" => "$(DLBASE)", ',
63 '"VERSION" => "$(VERSION)", "DISTNAME" => "$(DISTNAME)", ',
64 '"INSTALLDIRS" => "$(INSTALLDIRS)", ',
65 '"DL_FUNCS" => ',neatvalue($funcs),
66 ', "FUNCLIST" => ',neatvalue($funclist),
67 ', "IMPORTS" => ',neatvalue($imports),
68 ', "DL_VARS" => ', neatvalue($vars), ');\'
71 if ($self->{IMPORTS} && %{$self->{IMPORTS}}) {
72 # Make import files (needed for static build)
73 -d 'tmp_imp' or mkdir 'tmp_imp', 0777 or die "Can't mkdir tmp_imp";
74 open IMP, '>tmpimp.imp' or die "Can't open tmpimp.imp";
76 while (($name, $exp)= each %{$self->{IMPORTS}}) {
77 my ($lib, $id) = ($exp =~ /(.*)\.(.*)/) or die "Malformed IMPORT `$exp'";
78 print IMP "$name $lib $id ?\n";
80 close IMP or die "Can't close tmpimp.imp";
81 # print "emximp -o tmpimp$Config::Config{lib_ext} tmpimp.imp\n";
82 system "emximp -o tmpimp$Config::Config{lib_ext} tmpimp.imp"
83 and die "Cannot make import library: $!, \$?=$?";
85 system "cd tmp_imp; $Config::Config{ar} x ../tmpimp$Config::Config{lib_ext}"
86 and die "Cannot extract import objects: $!, \$?=$?";
93 my $old = $self->ExtUtils::MM_Unix::static_lib();
94 return $old unless $self->{IMPORTS} && %{$self->{IMPORTS}};
96 my @chunks = split /\n{2,}/, $old;
97 shift @chunks unless length $chunks[0]; # Empty lines at the start
98 $chunks[0] .= <<'EOC';
100 $(AR) $(AR_STATIC_ARGS) $@ tmp_imp/* && $(RANLIB) $@
102 return join "\n\n". '', @chunks;
105 sub replace_manpage_separator {
112 my($self,$file) = @_;
113 $file =~ s,[/\\]+,/,g;
114 return $file if -x $file && ! -d _;
115 return "$file.exe" if -x "$file.exe" && ! -d _;
116 return "$file.cmd" if -x "$file.cmd" && ! -d _;
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";