Commit | Line | Data |
3fea05b9 |
1 | package Module::Install::Compiler; |
2 | |
3 | use strict; |
4 | use File::Basename (); |
5 | use Module::Install::Base (); |
6 | |
7 | use vars qw{$VERSION @ISA $ISCORE}; |
8 | BEGIN { |
9 | $VERSION = '0.91'; |
10 | @ISA = 'Module::Install::Base'; |
11 | $ISCORE = 1; |
12 | } |
13 | |
14 | sub ppport { |
15 | my $self = shift; |
16 | if ( $self->is_admin ) { |
17 | return $self->admin->ppport(@_); |
18 | } else { |
19 | # Fallback to just a check |
20 | my $file = shift || 'ppport.h'; |
21 | unless ( -f $file ) { |
22 | die "Packaging error, $file is missing"; |
23 | } |
24 | } |
25 | } |
26 | |
27 | sub cc_files { |
28 | require Config; |
29 | my $self = shift; |
30 | $self->makemaker_args( |
31 | OBJECT => join ' ', map { substr($_, 0, -2) . $Config::Config{_o} } @_ |
32 | ); |
33 | } |
34 | |
35 | sub cc_inc_paths { |
36 | my $self = shift; |
37 | $self->makemaker_args( |
38 | INC => join ' ', map { "-I$_" } @_ |
39 | ); |
40 | } |
41 | |
42 | sub cc_lib_paths { |
43 | my $self = shift; |
44 | $self->makemaker_args( |
45 | LIBS => join ' ', map { "-L$_" } @_ |
46 | ); |
47 | } |
48 | |
49 | sub cc_lib_links { |
50 | my $self = shift; |
51 | $self->makemaker_args( |
52 | LIBS => join ' ', $self->makemaker_args->{LIBS}, map { "-l$_" } @_ |
53 | ); |
54 | } |
55 | |
56 | sub cc_optimize_flags { |
57 | my $self = shift; |
58 | $self->makemaker_args( |
59 | OPTIMIZE => join ' ', @_ |
60 | ); |
61 | } |
62 | |
63 | 1; |
64 | |
65 | __END__ |
66 | |
67 | =pod |
68 | |
69 | =head1 NAME |
70 | |
71 | Module::Install::Compiler - Commands for interacting with the C compiler |
72 | |
73 | =head1 SYNOPSIS |
74 | |
75 | To be completed |
76 | |
77 | =head1 DESCRIPTION |
78 | |
79 | Many Perl modules that contains C and XS code have fiendishly complex |
80 | F<Makefile.PL> files, because L<ExtUtils::MakeMaker> doesn't itself provide |
81 | a huge amount of assistance and automation in this area. |
82 | |
83 | B<Module::Install::Compiler> provides a number of commands that take care |
84 | of common utility tasks, and try to take some of intricacy out of creating |
85 | C and XS modules. |
86 | |
87 | =head1 COMMANDS |
88 | |
89 | To be completed |
90 | |
91 | =head1 TO DO |
92 | |
93 | The current implementation is relatively fragile and minimalistic. |
94 | |
95 | It only handles some very basic wrapper around L<ExtUtils::MakeMaker>. |
96 | |
97 | It is currently undergoing extensive refactoring to provide a more |
98 | generic compiler flag generation capability. This may take some time, |
99 | and if anyone who maintains a Perl module that makes use of the compiler |
100 | would like to help out, your assistance would be greatly appreciated. |
101 | |
102 | =head1 SEE ALSO |
103 | |
104 | L<Module::Install>, L<ExtUtils::MakeMaker> |
105 | |
106 | =head1 AUTHORS |
107 | |
108 | Refactored by Adam Kennedy E<lt>adamk@cpan.orgE<gt> |
109 | |
110 | Mostly by Audrey Tang E<lt>autrijus@autrijus.orgE<gt> |
111 | |
112 | Based on original works by Brian Ingerson E<lt>ingy@cpan.orgE<gt> |
113 | |
114 | =head1 COPYRIGHT |
115 | |
116 | Copyright 2002, 2003, 2004, 2006 by Adam Kennedy, Audrey Tang, Brian Ingerson. |
117 | |
118 | This program is free software; you can redistribute it and/or modify it |
119 | under the same terms as Perl itself. |
120 | |
121 | See L<http://www.perl.com/perl/misc/Artistic.html> |
122 | |
123 | =cut |