This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Upgrade to IPC::SysV 2.02
[perl5.git] / cpan / IPC-SysV / Makefile.PL
1 ################################################################################
2 #
3 #  $Revision: 20 $
4 #  $Author: mhx $
5 #  $Date: 2010/03/07 16:01:41 +0100 $
6 #
7 ################################################################################
8 #
9 #  Version 2.x, Copyright (C) 2007-2010, 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 ################################################################################
16
17 require 5.004_05;
18
19 use strict;
20 use ExtUtils::MakeMaker;
21
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   die "OS unsupported\n";
28 }
29
30 WriteMakefile(
31   NAME         => 'IPC::SysV',
32   VERSION_FROM => 'lib/IPC/SysV.pm',
33   PREREQ_PM    => {
34                     'Test::More' => 0.45,
35                   },
36   CONFIGURE    => \&configure,
37 );
38
39 sub configure
40 {
41   my @moreopts;
42   my %depend;
43
44   if (eval $ExtUtils::MakeMaker::VERSION >= 6) {
45     push @moreopts, AUTHOR => 'Marcus Holland-Moritz <mhx@cpan.org>',
46                     ABSTRACT_FROM => 'lib/IPC/SysV.pm';
47   }
48
49   if (eval $ExtUtils::MakeMaker::VERSION >= 6.30_01) {
50     print "Setting license tag...\n";
51     push @moreopts, LICENSE => 'perl';
52   }
53
54   if ($ENV{'PERL_CORE'}) {
55     # clean out const-* files in the core
56     push @moreopts, realclean => { FILES => "const-c.inc const-xs.inc" };
57   }
58   else {
59     # IPC::SysV is in the core since 5.005
60     push @moreopts, INSTALLDIRS => ($] >= 5.005 ? 'perl' : 'site');
61   }
62
63   $depend{'SysV.xs'} = 'const-c.inc const-xs.inc';
64
65   return {
66     depend => \%depend,
67     @moreopts
68   };
69 }
70
71
72 #--- MY package
73
74 sub MY::libscan
75 {
76   package MY;
77   my($self, $path) = @_;
78   return $path if $self->SUPER::libscan($path) and
79                   $path !~ m! [~%]$
80                             | \.(cache\.cm|swp|orig|rej)$
81                             | regen\.pl$
82                             !x;
83   return '';
84 }
85
86 sub MY::postamble
87 {
88   package MY;
89   my $post = shift->SUPER::postamble(@_);
90   $post .= <<'POSTAMBLE';
91
92 purge_all: realclean
93         @$(RM_F) const-c.inc const-xs.inc
94
95 regen:
96         $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) regen.pl
97
98 const-c.inc: lib/IPC/SysV.pm regen.pl
99         @$(MAKE) regen
100
101 const-xs.inc: lib/IPC/SysV.pm regen.pl
102         @$(MAKE) regen
103
104 POSTAMBLE
105   return $post;
106 }
107