Initial bulk commit for "Git on MSys"
[msysgit/historical-msysgit.git] / lib / perl5 / 5.6.1 / ExtUtils / MM_OS2.pm
blobcd6a1e4c49a186b116742e7985a00a0bc4cdae74
1 package ExtUtils::MM_OS2;
3 #use Config;
4 #use Cwd;
5 #use File::Basename;
6 require Exporter;
8 Exporter::import('ExtUtils::MakeMaker',
9 qw( $Verbose &neatvalue));
11 unshift @MM::ISA, 'ExtUtils::MM_OS2';
13 sub dlsyms {
14 my($self,%attribs) = @_;
16 my($funcs) = $attribs{DL_FUNCS} || $self->{DL_FUNCS} || {};
17 my($vars) = $attribs{DL_VARS} || $self->{DL_VARS} || [];
18 my($funclist) = $attribs{FUNCLIST} || $self->{FUNCLIST} || [];
19 my($imports) = $attribs{IMPORTS} || $self->{IMPORTS} || {};
20 my(@m);
21 (my $boot = $self->{NAME}) =~ s/:/_/g;
23 if (not $self->{SKIPHASH}{'dynamic'}) {
24 push(@m,"
25 $self->{BASEEXT}.def: Makefile.PL
27 ' $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e \'use ExtUtils::Mksymlists; \\
28 Mksymlists("NAME" => "$(NAME)", "DLBASE" => "$(DLBASE)", ',
29 '"VERSION" => "$(VERSION)", "DISTNAME" => "$(DISTNAME)", ',
30 '"INSTALLDIRS" => "$(INSTALLDIRS)", ',
31 '"DL_FUNCS" => ',neatvalue($funcs),
32 ', "FUNCLIST" => ',neatvalue($funclist),
33 ', "IMPORTS" => ',neatvalue($imports),
34 ', "DL_VARS" => ', neatvalue($vars), ');\'
35 ');
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";
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: $!, \$?=$?";
54 join('',@m);
57 sub static_lib {
58 my($self) = @_;
59 my $old = $self->ExtUtils::MM_Unix::static_lib();
60 return $old unless %{$self->{IMPORTS}};
62 my @chunks = split /\n{2,}/, $old;
63 shift @chunks unless length $chunks[0]; # Empty lines at the start
64 $chunks[0] .= <<'EOC';
66 $(AR) $(AR_STATIC_ARGS) $@ tmp_imp/* && $(RANLIB) $@
67 EOC
68 return join "\n\n". '', @chunks;
71 sub replace_manpage_separator {
72 my($self,$man) = @_;
73 $man =~ s,/+,.,g;
74 $man;
77 sub maybe_command {
78 my($self,$file) = @_;
79 $file =~ s,[/\\]+,/,g;
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;
86 sub file_name_is_absolute {
87 my($self,$file) = @_;
88 $file =~ m{^([a-z]:)?[\\/]}i ;
91 sub perl_archive
93 return "\$(PERL_INC)/libperl\$(LIB_EXT)";
96 =item perl_archive_after
98 This is an internal method that returns path to a library which
99 should be put on the linker command line I<after> the external libraries
100 to be linked to dynamic extensions. This may be needed if the linker
101 is one-pass, and Perl includes some overrides for C RTL functions,
102 such as malloc().
104 =cut
106 sub perl_archive_after
108 return "\$(PERL_INC)/libperl_override\$(LIB_EXT)" unless $OS2::is_aout;
109 return "";
112 sub export_list
114 my ($self) = @_;
115 return "$self->{BASEEXT}.def";
119 __END__
121 =head1 NAME
123 ExtUtils::MM_OS2 - methods to override UN*X behaviour in ExtUtils::MakeMaker
125 =head1 SYNOPSIS
127 use ExtUtils::MM_OS2; # Done internally by ExtUtils::MakeMaker if needed
129 =head1 DESCRIPTION
131 See ExtUtils::MM_Unix for a documentation of the methods provided
132 there. This package overrides the implementation of these methods, not
133 the semantics.