File Coverage

lib/ExtUtils/MM_OS2.pm
Criterion Covered Total %
statement 12 57 21.0
branch 0 28 0.0
condition 0 22 0.0
subroutine 4 14 28.5
pod 10 10 100.0
total 26 131 19.8


line stmt bran cond sub pod time code
1              
2             use strict;
3 1     1   8059 use warnings;
  1         1  
  1         26  
4 1     1   4  
  1         1  
  1         24  
5             use ExtUtils::MakeMaker qw(neatvalue);
6 1     1   5 use File::Spec;
  1         1  
  1         35  
7 1     1   4  
  1         2  
  1         751  
8             our $VERSION = '7.64';
9             $VERSION =~ tr/_//d;
10              
11             require ExtUtils::MM_Any;
12             require ExtUtils::MM_Unix;
13             our @ISA = qw(ExtUtils::MM_Any ExtUtils::MM_Unix);
14              
15             =pod
16              
17             =head1 NAME
18              
19             ExtUtils::MM_OS2 - methods to override UN*X behaviour in ExtUtils::MakeMaker
20              
21             =head1 SYNOPSIS
22              
23             use ExtUtils::MM_OS2; # Done internally by ExtUtils::MakeMaker if needed
24              
25             =head1 DESCRIPTION
26              
27             See L<ExtUtils::MM_Unix> for a documentation of the methods provided
28             there. This package overrides the implementation of these methods, not
29             the semantics.
30              
31             =head1 METHODS
32              
33             =over 4
34              
35             =item init_dist
36              
37             Define TO_UNIX to convert OS2 linefeeds to Unix style.
38              
39             =cut
40              
41             my($self) = @_;
42              
43 0     0 1   $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
45 0   0       MAKE_TEXT
46              
47             $self->SUPER::init_dist;
48             }
49 0            
50             my($self,%attribs) = @_;
51             if ($self->{IMPORTS} && %{$self->{IMPORTS}}) {
52             # Make import files (needed for static build)
53 0     0 1   -d 'tmp_imp' or mkdir 'tmp_imp', 0777 or die "Can't mkdir tmp_imp";
54 0 0 0       open my $imp, '>', 'tmpimp.imp' or die "Can't open tmpimp.imp";
  0            
55             foreach my $name (sort keys %{$self->{IMPORTS}}) {
56 0 0 0       my $exp = $self->{IMPORTS}->{$name};
57 0 0         my ($lib, $id) = ($exp =~ /(.*)\.(.*)/) or die "Malformed IMPORT `$exp'";
58 0           print $imp "$name $lib $id ?\n";
  0            
59 0           }
60 0 0         close $imp or die "Can't close tmpimp.imp";
61 0           # print "emximp -o tmpimp$Config::Config{lib_ext} tmpimp.imp\n";
62             system "emximp -o tmpimp$Config::Config{lib_ext} tmpimp.imp"
63 0 0         and die "Cannot make import library: $!, \$?=$?";
64             # May be running under miniperl, so have no glob...
65 0 0         eval { unlink <tmp_imp/*>; 1 } or system "rm tmp_imp/*";
66             system "cd tmp_imp; $Config::Config{ar} x ../tmpimp$Config::Config{lib_ext}"
67             and die "Cannot extract import objects: $!, \$?=$?";
68 0 0         }
  0            
  0            
69 0 0         return '' if $self->{SKIPHASH}{'dynamic'};
70             $self->xs_dlsyms_iterator(\%attribs);
71             }
72 0 0          
73 0           '.def';
74             }
75              
76             join '', map { qq{, "$_" => "\$($_)"} } qw(VERSION DISTNAME INSTALLDIRS);
77 0     0 1   }
78              
79             my($self) = @_;
80             my $old = $self->SUPER::static_lib_pure_cmd;
81 0     0 1   return $old unless $self->{IMPORTS} && %{$self->{IMPORTS}};
  0            
82             $old . <<'EOC';
83             $(AR) $(AR_STATIC_ARGS) "$@" tmp_imp/*
84             $(RANLIB) "$@"
85 0     0 1   EOC
86 0           }
87 0 0 0        
  0            
88 0           my($self,$man) = @_;
89             $man =~ s,/+,.,g;
90             $man;
91             }
92              
93             my($self,$file) = @_;
94             $file =~ s,[/\\]+,/,g;
95 0     0 1   return $file if -x $file && ! -d _;
96 0           return "$file.exe" if -x "$file.exe" && ! -d _;
97 0           return "$file.cmd" if -x "$file.cmd" && ! -d _;
98             return;
99             }
100              
101 0     0 1   =item init_linker
102 0            
103 0 0 0       =cut
104 0 0 0        
105 0 0 0       my $self = shift;
106 0            
107             $self->{PERL_ARCHIVE} = "\$(PERL_INC)/libperl\$(LIB_EXT)";
108              
109             $self->{PERL_ARCHIVEDEP} ||= '';
110             $self->{PERL_ARCHIVE_AFTER} = $OS2::is_aout
111             ? ''
112             : '$(PERL_INC)/libperl_override$(LIB_EXT)';
113             $self->{EXPORT_LIST} = '$(BASEEXT).def';
114 0     0 1   }
115              
116 0           =item os_flavor
117              
118 0   0       OS/2 is OS/2
119 0 0          
120             =cut
121              
122 0           return('OS/2');
123             }
124              
125             =item xs_static_lib_is_xs
126              
127             =cut
128              
129             return 1;
130             }
131              
132 0     0 1   =back
133              
134             =cut
135              
136             1;