This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Update Archive-Tar to CPAN version 2.24
[perl5.git] / cpan / IPC-SysV / Makefile.PL
1 ################################################################################
2 #
3 #  Version 2.x, Copyright (C) 2007-2013, Marcus Holland-Moritz <mhx@cpan.org>.
4 #  Version 1.x, Copyright (C) 1999, Graham Barr <gbarr@pobox.com>.
5 #
6 #  This program is free software; you can redistribute it and/or
7 #  modify it under the same terms as Perl itself.
8 #
9 ################################################################################
10
11 require 5.004_05;
12
13 use strict;
14 use ExtUtils::MakeMaker;
15
16 unless ($ENV{'PERL_CORE'}) {
17   $ENV{'PERL_CORE'} = 1 if grep { $_ eq 'PERL_CORE=1' } @ARGV;
18 }
19
20 if ($^O eq 'MSWin32') {
21   die "OS unsupported\n";
22 }
23
24 WriteMakefile(
25   NAME         => 'IPC::SysV',
26   VERSION_FROM => 'lib/IPC/SysV.pm',
27   PREREQ_PM    => {
28                     'Test::More' => 0.45,
29                   },
30   CONFIGURE    => \&configure,
31 );
32
33 sub configure
34 {
35   my @moreopts;
36   my %depend;
37
38   if (eval $ExtUtils::MakeMaker::VERSION >= 6) {
39     push @moreopts, AUTHOR => 'Marcus Holland-Moritz <mhx@cpan.org>',
40                     ABSTRACT_FROM => 'lib/IPC/SysV.pm';
41   }
42
43   if (eval $ExtUtils::MakeMaker::VERSION >= 6.30_01) {
44     print "Setting license tag...\n";
45     push @moreopts, LICENSE => 'perl';
46   }
47
48   if ($ENV{'PERL_CORE'}) {
49     # clean out const-* files in the core
50     push @moreopts, realclean => { FILES => "const-c.inc const-xs.inc" };
51   }
52   else {
53     # IPC::SysV is in the core since 5.005
54     # 5.11.0+ has site before perl
55     push @moreopts, INSTALLDIRS => (
56       ($] >= 5.005 and $] < 5.011)
57         ? 'perl'
58         : 'site'
59     );
60   }
61
62   $depend{'SysV.xs'} = 'const-c.inc const-xs.inc';
63
64   return {
65     depend => \%depend,
66     @moreopts
67   };
68 }
69
70
71 #--- MY package
72
73 sub MY::libscan
74 {
75   package MY;
76   my($self, $path) = @_;
77   return $path if $self->SUPER::libscan($path) and
78                   $path !~ m! [~%]$
79                             | \.(cache\.cm|swp|orig|rej)$
80                             | regen\.pl$
81                             !x;
82   return '';
83 }
84
85 sub MY::postamble
86 {
87   package MY;
88   my $post = shift->SUPER::postamble(@_);
89   $post .= <<'POSTAMBLE';
90
91 purge_all: realclean
92         @$(RM_F) const-c.inc const-xs.inc
93
94 regen:
95         $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) regen.pl
96
97 const-c.inc: lib/IPC/SysV.pm regen.pl
98         @$(MAKE) regen
99
100 const-xs.inc: lib/IPC/SysV.pm regen.pl
101         @$(MAKE) regen
102
103 POSTAMBLE
104   return $post;
105 }
106