This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
cygwin update
[perl5.git] / lib / ExtUtils / MM_OS2.pm
CommitLineData
1e44e2bf
PP
1package ExtUtils::MM_OS2;
2
3#use Config;
4#use Cwd;
5#use File::Basename;
6require Exporter;
7
8Exporter::import('ExtUtils::MakeMaker',
9 qw( $Verbose &neatvalue));
10
1e44e2bf
PP
11unshift @MM::ISA, 'ExtUtils::MM_OS2';
12
13sub dlsyms {
14 my($self,%attribs) = @_;
15
16 my($funcs) = $attribs{DL_FUNCS} || $self->{DL_FUNCS} || {};
17 my($vars) = $attribs{DL_VARS} || $self->{DL_VARS} || [];
762efda7 18 my($funclist) = $attribs{FUNCLIST} || $self->{FUNCLIST} || [];
1e44e2bf
PP
19 my($imports) = $attribs{IMPORTS} || $self->{IMPORTS} || {};
20 my(@m);
21 (my $boot = $self->{NAME}) =~ s/:/_/g;
22
23 if (not $self->{SKIPHASH}{'dynamic'}) {
24 push(@m,"
25$self->{BASEEXT}.def: Makefile.PL
26",
27 ' $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e \'use ExtUtils::Mksymlists; \\
28 Mksymlists("NAME" => "', $self->{NAME},
29 '", "DLBASE" => "',$self->{DLBASE},
30 '", "DL_FUNCS" => ',neatvalue($funcs),
017f25f1 31 ', "FUNCLIST" => ',neatvalue($funclist),
1e44e2bf 32 ', "IMPORTS" => ',neatvalue($imports),
3aefca04
IZ
33 ', "VERSION" => "',$self->{VERSION},
34 '", "DL_VARS" => ', neatvalue($vars), ');\'
1e44e2bf
PP
35');
36 }
017f25f1
IZ
37 if (%{$self->{IMPORTS}}) {
38 # Make import files (needed for static build)
39 -d 'tmp_imp' or mkdir 'tmp_imp', 0777 or die "Can't mkdir tmp_imp";
40 open IMP, '>tmpimp.imp' or die "Can't open tmpimp.imp";
41 my ($name, $exp);
42 while (($name, $exp)= each %{$self->{IMPORTS}}) {
43 my ($lib, $id) = ($exp =~ /(.*)\.(.*)/) or die "Malformed IMPORT `$exp'";
44 print IMP "$name $lib $id ?\n";
45 }
46 close IMP or die "Can't close tmpimp.imp";
47 # print "emximp -o tmpimp$Config::Config{lib_ext} tmpimp.imp\n";
48 system "emximp -o tmpimp$Config::Config{lib_ext} tmpimp.imp"
49 and die "Cannot make import library: $!, \$?=$?";
50 unlink <tmp_imp/*>;
51 system "cd tmp_imp; $Config::Config{ar} x ../tmpimp$Config::Config{lib_ext}"
52 and die "Cannot extract import objects: $!, \$?=$?";
53 }
1e44e2bf
PP
54 join('',@m);
55}
56
017f25f1
IZ
57sub static_lib {
58 my($self) = @_;
59 my $old = $self->ExtUtils::MM_Unix::static_lib();
60 return $old unless %{$self->{IMPORTS}};
61
62 my @chunks = split /\n{2,}/, $old;
63 shift @chunks unless length $chunks[0]; # Empty lines at the start
64 $chunks[0] .= <<'EOC';
65
66 $(AR) $(AR_STATIC_ARGS) $@ tmp_imp/* && $(RANLIB) $@
67EOC
68 return join "\n\n". '', @chunks;
69}
70
1e44e2bf
PP
71sub replace_manpage_separator {
72 my($self,$man) = @_;
73 $man =~ s,/+,.,g;
74 $man;
75}
76
77sub maybe_command {
78 my($self,$file) = @_;
13bc20ff 79 $file =~ s,[/\\]+,/,g;
1e44e2bf
PP
80 return $file if -x $file && ! -d _;
81 return "$file.exe" if -x "$file.exe" && ! -d _;
82 return "$file.cmd" if -x "$file.cmd" && ! -d _;
83 return;
84}
85
86sub file_name_is_absolute {
87 my($self,$file) = @_;
88 $file =~ m{^([a-z]:)?[\\/]}i ;
89}
90
68dc0745
PP
91sub perl_archive
92{
93 return "\$(PERL_INC)/libperl\$(LIB_EXT)";
94}
95
96sub export_list
97{
98 my ($self) = @_;
99 return "$self->{BASEEXT}.def";
100}
101
1e44e2bf
PP
1021;
103__END__
104
105=head1 NAME
106
107ExtUtils::MM_OS2 - methods to override UN*X behaviour in ExtUtils::MakeMaker
108
a5f75d66
AD
109=head1 SYNOPSIS
110
111 use ExtUtils::MM_OS2; # Done internally by ExtUtils::MakeMaker if needed
112
1e44e2bf
PP
113=head1 DESCRIPTION
114
115See ExtUtils::MM_Unix for a documentation of the methods provided
116there. This package overrides the implementation of these methods, not
117the semantics.
118