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