Commit | Line | Data |
8f85282b |
1 | ################################################################################ |
2 | # |
a7c93bfc |
3 | # $Revision: 15 $ |
8f85282b |
4 | # $Author: mhx $ |
a7c93bfc |
5 | # $Date: 2007/12/22 17:39:55 +0100 $ |
8f85282b |
6 | # |
7 | ################################################################################ |
8 | # |
9 | # Version 2.x, Copyright (C) 2007, Marcus Holland-Moritz <mhx@cpan.org>. |
10 | # Version 1.x, Copyright (C) 1999, Graham Barr <gbarr@pobox.com>. |
11 | # |
12 | # This program is free software; you can redistribute it and/or |
13 | # modify it under the same terms as Perl itself. |
14 | # |
15 | ################################################################################ |
0ade1984 |
16 | |
8f85282b |
17 | require 5.004_05; |
18 | |
19 | use strict; |
0ade1984 |
20 | use ExtUtils::MakeMaker; |
21 | |
8f85282b |
22 | unless ($ENV{'PERL_CORE'}) { |
23 | $ENV{'PERL_CORE'} = 1 if grep { $_ eq 'PERL_CORE=1' } @ARGV; |
24 | } |
25 | |
26 | if ($^O eq 'MSWin32') { |
27 | my $msg = "The IPC::SysV module cannot be built on the $^O platform."; |
28 | my $str = '*' x length $msg; |
29 | die "\n$str\n$msg\n$str\n\n"; |
30 | } |
31 | |
32 | WriteMakefile( |
33 | NAME => 'IPC::SysV', |
34 | VERSION_FROM => 'lib/IPC/SysV.pm', |
35 | PREREQ_PM => { |
36 | 'Test::More' => 0.45, |
37 | }, |
38 | CONFIGURE => \&configure, |
39 | ); |
40 | |
41 | sub configure |
42 | { |
43 | my @moreopts; |
44 | my %depend; |
45 | |
46 | if (eval $ExtUtils::MakeMaker::VERSION >= 6) { |
47 | push @moreopts, AUTHOR => 'Marcus Holland-Moritz <mhx@cpan.org>', |
48 | ABSTRACT_FROM => 'lib/IPC/SysV.pm'; |
49 | } |
50 | |
51 | if (eval $ExtUtils::MakeMaker::VERSION >= 6.30_01) { |
52 | print "Setting license tag...\n"; |
53 | push @moreopts, LICENSE => 'perl'; |
54 | } |
55 | |
56 | if ($ENV{'PERL_CORE'}) { |
57 | # Pods will be built by installman. |
58 | push @moreopts, MAN3PODS => {}; |
59 | } |
60 | else { |
61 | # IPC::SysV is in the core since 5.005 |
62 | push @moreopts, INSTALLDIRS => ($] >= 5.005 ? 'perl' : 'site'); |
63 | } |
64 | |
65 | $depend{'SysV.xs'} = 'const-c.inc const-xs.inc'; |
66 | |
67 | return { |
68 | depend => \%depend, |
69 | @moreopts |
70 | }; |
71 | } |
72 | |
73 | |
0ade1984 |
74 | #--- MY package |
75 | |
76 | sub MY::libscan |
77 | { |
8f85282b |
78 | my($self, $path) = @_; |
a7c93bfc |
79 | return '' if $path =~ m! /(RCS|CVS|SCCS)/ | [~%]$ | \.(swp|orig|rej)$ !x; |
0ade1984 |
80 | $path; |
81 | } |
82 | |
8f85282b |
83 | sub MY::postamble |
84 | { |
85 | package MY; |
86 | my $post = shift->SUPER::postamble(@_); |
87 | $post .= <<'POSTAMBLE'; |
88 | |
89 | purge_all: realclean |
90 | @$(RM_F) const-c.inc const-xs.inc |
91 | |
92 | regen: |
93 | $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) regen.pl |
94 | |
95 | const-c.inc: lib/IPC/SysV.pm regen.pl |
96 | @$(MAKE) regen |
97 | |
98 | const-xs.inc: lib/IPC/SysV.pm regen.pl |
99 | @$(MAKE) regen |
100 | |
101 | POSTAMBLE |
102 | return $post; |
103 | } |
104 | |