1 package ExtUtils::MM_OS2;
12 require ExtUtils::MakeMaker;
13 ExtUtils::MakeMaker->import(qw( $Verbose &neatvalue));
15 unshift @MM::ISA, 'ExtUtils::MM_OS2';
18 my($self,%attribs) = @_;
20 my($funcs) = $attribs{DL_FUNCS} || $self->{DL_FUNCS} || {};
21 my($vars) = $attribs{DL_VARS} || $self->{DL_VARS} || [];
22 my($funclist) = $attribs{FUNCLIST} || $self->{FUNCLIST} || [];
23 my($imports) = $attribs{IMPORTS} || $self->{IMPORTS} || {};
25 (my $boot = $self->{NAME}) =~ s/:/_/g;
27 if (not $self->{SKIPHASH}{'dynamic'}) {
29 $self->{BASEEXT}.def: Makefile.PL
31 ' $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e \'use ExtUtils::Mksymlists; \\
32 Mksymlists("NAME" => "$(NAME)", "DLBASE" => "$(DLBASE)", ',
33 '"VERSION" => "$(VERSION)", "DISTNAME" => "$(DISTNAME)", ',
34 '"INSTALLDIRS" => "$(INSTALLDIRS)", ',
35 '"DL_FUNCS" => ',neatvalue($funcs),
36 ', "FUNCLIST" => ',neatvalue($funclist),
37 ', "IMPORTS" => ',neatvalue($imports),
38 ', "DL_VARS" => ', neatvalue($vars), ');\'
41 if ($self->{IMPORTS} && %{$self->{IMPORTS}}) {
42 # Make import files (needed for static build)
43 -d 'tmp_imp' or mkdir 'tmp_imp', 0777 or die "Can't mkdir tmp_imp";
44 open IMP, '>tmpimp.imp' or die "Can't open tmpimp.imp";
46 while (($name, $exp)= each %{$self->{IMPORTS}}) {
47 my ($lib, $id) = ($exp =~ /(.*)\.(.*)/) or die "Malformed IMPORT `$exp'";
48 print IMP "$name $lib $id ?\n";
50 close IMP or die "Can't close tmpimp.imp";
51 # print "emximp -o tmpimp$Config::Config{lib_ext} tmpimp.imp\n";
52 system "emximp -o tmpimp$Config::Config{lib_ext} tmpimp.imp"
53 and die "Cannot make import library: $!, \$?=$?";
55 system "cd tmp_imp; $Config::Config{ar} x ../tmpimp$Config::Config{lib_ext}"
56 and die "Cannot extract import objects: $!, \$?=$?";
63 my $old = $self->ExtUtils::MM_Unix::static_lib();
64 return $old unless $self->{IMPORTS} && %{$self->{IMPORTS}};
66 my @chunks = split /\n{2,}/, $old;
67 shift @chunks unless length $chunks[0]; # Empty lines at the start
68 $chunks[0] .= <<'EOC';
70 $(AR) $(AR_STATIC_ARGS) $@ tmp_imp/* && $(RANLIB) $@
72 return join "\n\n". '', @chunks;
75 sub replace_manpage_separator {
83 $file =~ s,[/\\]+,/,g;
84 return $file if -x $file && ! -d _;
85 return "$file.exe" if -x "$file.exe" && ! -d _;
86 return "$file.cmd" if -x "$file.cmd" && ! -d _;
90 sub file_name_is_absolute {
92 $file =~ m{^([a-z]:)?[\\/]}i ;
97 return "\$(PERL_INC)/libperl\$(LIB_EXT)";
103 return "$self->{BASEEXT}.def";
111 ExtUtils::MM_OS2 - methods to override UN*X behaviour in ExtUtils::MakeMaker
115 use ExtUtils::MM_OS2; # Done internally by ExtUtils::MakeMaker if needed
119 See ExtUtils::MM_Unix for a documentation of the methods provided
120 there. This package overrides the implementation of these methods, not