Commit | Line | Data |
---|---|---|
1e44e2bf | 1 | package ExtUtils::MM_OS2; |
2 | ||
3 | #use Config; | |
4 | #use Cwd; | |
5 | #use File::Basename; | |
6 | require Exporter; | |
7 | ||
8 | Exporter::import('ExtUtils::MakeMaker', | |
9 | qw( $Verbose &neatvalue)); | |
10 | ||
1e44e2bf | 11 | unshift @MM::ISA, 'ExtUtils::MM_OS2'; |
12 | ||
13 | sub 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 | 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; \\ | |
3cfae81b IZ |
28 | Mksymlists("NAME" => "$(NAME)", "DLBASE" => "$(DLBASE)", ', |
29 | '"VERSION" => "$(VERSION)", "DISTNAME" => "$(DISTNAME)", ', | |
30 | '"INSTALLDIRS" => "$(INSTALLDIRS)", ', | |
31 | '"DL_FUNCS" => ',neatvalue($funcs), | |
017f25f1 | 32 | ', "FUNCLIST" => ',neatvalue($funclist), |
1e44e2bf | 33 | ', "IMPORTS" => ',neatvalue($imports), |
3cfae81b | 34 | ', "DL_VARS" => ', neatvalue($vars), ');\' |
1e44e2bf | 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 | 54 | join('',@m); |
55 | } | |
56 | ||
017f25f1 IZ |
57 | sub 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) $@ | |
67 | EOC | |
68 | return join "\n\n". '', @chunks; | |
69 | } | |
70 | ||
1e44e2bf | 71 | sub replace_manpage_separator { |
72 | my($self,$man) = @_; | |
73 | $man =~ s,/+,.,g; | |
74 | $man; | |
75 | } | |
76 | ||
77 | sub maybe_command { | |
78 | my($self,$file) = @_; | |
13bc20ff | 79 | $file =~ s,[/\\]+,/,g; |
1e44e2bf | 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 | ||
86 | sub file_name_is_absolute { | |
87 | my($self,$file) = @_; | |
88 | $file =~ m{^([a-z]:)?[\\/]}i ; | |
89 | } | |
90 | ||
68dc0745 | 91 | sub perl_archive |
92 | { | |
93 | return "\$(PERL_INC)/libperl\$(LIB_EXT)"; | |
94 | } | |
95 | ||
96 | sub export_list | |
97 | { | |
98 | my ($self) = @_; | |
99 | return "$self->{BASEEXT}.def"; | |
100 | } | |
101 | ||
1e44e2bf | 102 | 1; |
103 | __END__ | |
104 | ||
105 | =head1 NAME | |
106 | ||
107 | ExtUtils::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 | 113 | =head1 DESCRIPTION |
114 | ||
115 | See ExtUtils::MM_Unix for a documentation of the methods provided | |
116 | there. This package overrides the implementation of these methods, not | |
117 | the semantics. | |
118 |