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
37 Define TO_UNIX to convert OS2 linefeeds to Unix style.
44 $self->{TO_UNIX} ||= <<'MAKE_TEXT';
45 $(NOECHO) $(TEST_F) tmp.zip && $(RM_F) tmp.zip; $(ZIP) -ll -mr tmp.zip $(DISTVNAME) && unzip -o tmp.zip && $(RM_F) tmp.zip
48 $self->SUPER::init_dist;
52 my($self,%attribs) = @_;
54 my($funcs) = $attribs{DL_FUNCS} || $self->{DL_FUNCS} || {};
55 my($vars) = $attribs{DL_VARS} || $self->{DL_VARS} || [];
56 my($funclist) = $attribs{FUNCLIST} || $self->{FUNCLIST} || [];
57 my($imports) = $attribs{IMPORTS} || $self->{IMPORTS} || {};
59 (my $boot = $self->{NAME}) =~ s/:/_/g;
61 if (not $self->{SKIPHASH}{'dynamic'}) {
63 $self->{BASEEXT}.def: Makefile.PL
65 ' $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e \'use ExtUtils::Mksymlists; \\
66 Mksymlists("NAME" => "$(NAME)", "DLBASE" => "$(DLBASE)", ',
67 '"VERSION" => "$(VERSION)", "DISTNAME" => "$(DISTNAME)", ',
68 '"INSTALLDIRS" => "$(INSTALLDIRS)", ',
69 '"DL_FUNCS" => ',neatvalue($funcs),
70 ', "FUNCLIST" => ',neatvalue($funclist),
71 ', "IMPORTS" => ',neatvalue($imports),
72 ', "DL_VARS" => ', neatvalue($vars), ');\'
75 if ($self->{IMPORTS} && %{$self->{IMPORTS}}) {
76 # Make import files (needed for static build)
77 -d 'tmp_imp' or mkdir 'tmp_imp', 0777 or die "Can't mkdir tmp_imp";
78 open IMP, '>tmpimp.imp' or die "Can't open tmpimp.imp";
80 while (($name, $exp)= each %{$self->{IMPORTS}}) {
81 my ($lib, $id) = ($exp =~ /(.*)\.(.*)/) or die "Malformed IMPORT `$exp'";
82 print IMP "$name $lib $id ?\n";
84 close IMP or die "Can't close tmpimp.imp";
85 # print "emximp -o tmpimp$Config::Config{lib_ext} tmpimp.imp\n";
86 system "emximp -o tmpimp$Config::Config{lib_ext} tmpimp.imp"
87 and die "Cannot make import library: $!, \$?=$?";
89 system "cd tmp_imp; $Config::Config{ar} x ../tmpimp$Config::Config{lib_ext}"
90 and die "Cannot extract import objects: $!, \$?=$?";
97 my $old = $self->ExtUtils::MM_Unix::static_lib();
98 return $old unless $self->{IMPORTS} && %{$self->{IMPORTS}};
100 my @chunks = split /\n{2,}/, $old;
101 shift @chunks unless length $chunks[0]; # Empty lines at the start
102 $chunks[0] .= <<'EOC';
104 $(AR) $(AR_STATIC_ARGS) $@ tmp_imp/* && $(RANLIB) $@
106 return join "\n\n". '', @chunks;
109 sub replace_manpage_separator {
116 my($self,$file) = @_;
117 $file =~ s,[/\\]+,/,g;
118 return $file if -x $file && ! -d _;
119 return "$file.exe" if -x "$file.exe" && ! -d _;
120 return "$file.cmd" if -x "$file.cmd" && ! -d _;
131 $self->{PERL_ARCHIVE} = "\$(PERL_INC)/libperl\$(LIB_EXT)";
133 $self->{PERL_ARCHIVE_AFTER} = $OS2::is_aout
135 : '$(PERL_INC)/libperl_override$(LIB_EXT)';
136 $self->{EXPORT_LIST} = '$(BASEEXT).def';