Commit | Line | Data |
8f85282b |
1 | ################################################################################ |
2 | # |
ec4c3bb0 |
3 | # $Revision: 16 $ |
8f85282b |
4 | # $Author: mhx $ |
ec4c3bb0 |
5 | # $Date: 2008/01/05 16:41:20 +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. |
ec4c3bb0 |
58 | push @moreopts, MAN3PODS => {}, |
59 | realclean => { FILES => "const-c.inc const-xs.inc" }; |
8f85282b |
60 | } |
61 | else { |
62 | # IPC::SysV is in the core since 5.005 |
63 | push @moreopts, INSTALLDIRS => ($] >= 5.005 ? 'perl' : 'site'); |
64 | } |
65 | |
66 | $depend{'SysV.xs'} = 'const-c.inc const-xs.inc'; |
67 | |
68 | return { |
69 | depend => \%depend, |
70 | @moreopts |
71 | }; |
72 | } |
73 | |
74 | |
0ade1984 |
75 | #--- MY package |
76 | |
77 | sub MY::libscan |
78 | { |
3f163fbb |
79 | package MY; |
80 | my($self, $path) = @_; |
81 | return $path if $self->SUPER::libscan($path) and |
82 | $path !~ m! [~%]$ |
83 | | \.(cache\.cm|swp|orig|rej)$ |
84 | | regen\.pl$ |
85 | !x; |
86 | return ''; |
0ade1984 |
87 | } |
88 | |
8f85282b |
89 | sub MY::postamble |
90 | { |
91 | package MY; |
92 | my $post = shift->SUPER::postamble(@_); |
93 | $post .= <<'POSTAMBLE'; |
94 | |
95 | purge_all: realclean |
96 | @$(RM_F) const-c.inc const-xs.inc |
97 | |
98 | regen: |
99 | $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) regen.pl |
100 | |
101 | const-c.inc: lib/IPC/SysV.pm regen.pl |
102 | @$(MAKE) regen |
103 | |
104 | const-xs.inc: lib/IPC/SysV.pm regen.pl |
105 | @$(MAKE) regen |
106 | |
107 | POSTAMBLE |
108 | return $post; |
109 | } |
110 | |