1 package ExtUtils::MM_OS2;
5 use ExtUtils::MakeMaker qw(neatvalue);
10 require ExtUtils::MM_Any;
11 require ExtUtils::MM_Unix;
12 our @ISA = qw(ExtUtils::MM_Any ExtUtils::MM_Unix);
18 ExtUtils::MM_OS2 - methods to override UN*X behaviour in ExtUtils::MakeMaker
22 use ExtUtils::MM_OS2; # Done internally by ExtUtils::MakeMaker if needed
26 See ExtUtils::MM_Unix for a documentation of the methods provided
27 there. This package overrides the implementation of these methods, not
36 Define TO_UNIX to convert OS2 linefeeds to Unix style.
43 $self->{TO_UNIX} ||= <<'MAKE_TEXT';
44 $(NOECHO) $(TEST_F) tmp.zip && $(RM_F) tmp.zip; $(ZIP) -ll -mr tmp.zip $(DISTVNAME) && unzip -o tmp.zip && $(RM_F) tmp.zip
47 $self->SUPER::init_dist;
51 my($self,%attribs) = @_;
53 my($funcs) = $attribs{DL_FUNCS} || $self->{DL_FUNCS} || {};
54 my($vars) = $attribs{DL_VARS} || $self->{DL_VARS} || [];
55 my($funclist) = $attribs{FUNCLIST} || $self->{FUNCLIST} || [];
56 my($imports) = $attribs{IMPORTS} || $self->{IMPORTS} || {};
58 (my $boot = $self->{NAME}) =~ s/:/_/g;
60 if (not $self->{SKIPHASH}{'dynamic'}) {
62 $self->{BASEEXT}.def: Makefile.PL
64 ' $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e \'use ExtUtils::Mksymlists; \\
65 Mksymlists("NAME" => "$(NAME)", "DLBASE" => "$(DLBASE)", ',
66 '"VERSION" => "$(VERSION)", "DISTNAME" => "$(DISTNAME)", ',
67 '"INSTALLDIRS" => "$(INSTALLDIRS)", ',
68 '"DL_FUNCS" => ',neatvalue($funcs),
69 ', "FUNCLIST" => ',neatvalue($funclist),
70 ', "IMPORTS" => ',neatvalue($imports),
71 ', "DL_VARS" => ', neatvalue($vars), ');\'
74 if ($self->{IMPORTS} && %{$self->{IMPORTS}}) {
75 # Make import files (needed for static build)
76 -d 'tmp_imp' or mkdir 'tmp_imp', 0777 or die "Can't mkdir tmp_imp";
77 open my $imp, '>', 'tmpimp.imp' or die "Can't open tmpimp.imp";
78 while (my($name, $exp) = each %{$self->{IMPORTS}}) {
79 my ($lib, $id) = ($exp =~ /(.*)\.(.*)/) or die "Malformed IMPORT `$exp'";
80 print $imp "$name $lib $id ?\n";
82 close $imp or die "Can't close tmpimp.imp";
83 # print "emximp -o tmpimp$Config::Config{lib_ext} tmpimp.imp\n";
84 system "emximp -o tmpimp$Config::Config{lib_ext} tmpimp.imp"
85 and die "Cannot make import library: $!, \$?=$?";
87 system "cd tmp_imp; $Config::Config{ar} x ../tmpimp$Config::Config{lib_ext}"
88 and die "Cannot extract import objects: $!, \$?=$?";
95 my $old = $self->ExtUtils::MM_Unix::static_lib();
96 return $old unless $self->{IMPORTS} && %{$self->{IMPORTS}};
98 my @chunks = split /\n{2,}/, $old;
99 shift @chunks unless length $chunks[0]; # Empty lines at the start
100 $chunks[0] .= <<'EOC';
102 $(AR) $(AR_STATIC_ARGS) $@ tmp_imp/* && $(RANLIB) $@
104 return join "\n\n". '', @chunks;
107 sub replace_manpage_separator {
114 my($self,$file) = @_;
115 $file =~ s,[/\\]+,/,g;
116 return $file if -x $file && ! -d _;
117 return "$file.exe" if -x "$file.exe" && ! -d _;
118 return "$file.cmd" if -x "$file.cmd" && ! -d _;
129 $self->{PERL_ARCHIVE} = "\$(PERL_INC)/libperl\$(LIB_EXT)";
131 $self->{PERL_ARCHIVE_AFTER} = $OS2::is_aout
133 : '$(PERL_INC)/libperl_override$(LIB_EXT)';
134 $self->{EXPORT_LIST} = '$(BASEEXT).def';