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 | { |
8f85282b |
79 | my($self, $path) = @_; |
a7c93bfc |
80 | return '' if $path =~ m! /(RCS|CVS|SCCS)/ | [~%]$ | \.(swp|orig|rej)$ !x; |
0ade1984 |
81 | $path; |
82 | } |
83 | |
8f85282b |
84 | sub MY::postamble |
85 | { |
86 | package MY; |
87 | my $post = shift->SUPER::postamble(@_); |
88 | $post .= <<'POSTAMBLE'; |
89 | |
90 | purge_all: realclean |
91 | @$(RM_F) const-c.inc const-xs.inc |
92 | |
93 | regen: |
94 | $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) regen.pl |
95 | |
96 | const-c.inc: lib/IPC/SysV.pm regen.pl |
97 | @$(MAKE) regen |
98 | |
99 | const-xs.inc: lib/IPC/SysV.pm regen.pl |
100 | @$(MAKE) regen |
101 | |
102 | POSTAMBLE |
103 | return $post; |
104 | } |
105 | |