Move Getopt::Long from ext/ to cpan/
[p5sagit/p5-mst-13.2.git] / cpan / IPC-SysV / Makefile.PL
1 ################################################################################
2 #
3 #  $Revision: 18 $
4 #  $Author: mhx $
5 #  $Date: 2008/11/26 23:12:58 +0100 $
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 ################################################################################
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     # Pods will be built by installman.
56     push @moreopts, MAN3PODS  => {},
57                     realclean => { FILES => "const-c.inc const-xs.inc" };
58   }
59   else {
60     # IPC::SysV is in the core since 5.005
61     push @moreopts, INSTALLDIRS => ($] >= 5.005 ? 'perl' : 'site');
62   }
63
64   $depend{'SysV.xs'} = 'const-c.inc const-xs.inc';
65
66   return {
67     depend => \%depend,
68     @moreopts
69   };
70 }
71
72
73 #--- MY package
74
75 sub MY::libscan
76 {
77   package MY;
78   my($self, $path) = @_;
79   return $path if $self->SUPER::libscan($path) and
80                   $path !~ m! [~%]$
81                             | \.(cache\.cm|swp|orig|rej)$
82                             | regen\.pl$
83                             !x;
84   return '';
85 }
86
87 sub MY::postamble
88 {
89   package MY;
90   my $post = shift->SUPER::postamble(@_);
91   $post .= <<'POSTAMBLE';
92
93 purge_all: realclean
94         @$(RM_F) const-c.inc const-xs.inc
95
96 regen:
97         $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) regen.pl
98
99 const-c.inc: lib/IPC/SysV.pm regen.pl
100         @$(MAKE) regen
101
102 const-xs.inc: lib/IPC/SysV.pm regen.pl
103         @$(MAKE) regen
104
105 POSTAMBLE
106   return $post;
107 }
108