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 11require 5.004_05; 12 13use strict; 14use ExtUtils::MakeMaker; 15 16unless ($ENV{'PERL_CORE'}) { 17 $ENV{'PERL_CORE'} = 1 if grep { $_ eq 'PERL_CORE=1' } @ARGV; 18} 19 20if ($^O eq 'MSWin32') { 21 die "OS unsupported\n"; 22} 23 24WriteMakefile( 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 33sub 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 DEFINE => '-DNO_PPPORT_H'; 52 } 53 else { 54 # IPC::SysV is in the core since 5.005 55 # 5.11.0+ has site before perl 56 push @moreopts, INSTALLDIRS => ( 57 ($] >= 5.005 and $] < 5.011) 58 ? 'perl' 59 : 'site' 60 ); 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 74sub 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 86sub MY::postamble 87{ 88 package MY; 89 my $post = shift->SUPER::postamble(@_); 90 $post .= <<'POSTAMBLE'; 91 92purge_all: realclean 93 @$(RM_F) const-c.inc const-xs.inc 94 95regen: 96 $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) regen.pl 97 98const-c.inc: lib/IPC/SysV.pm regen.pl 99 @$(MAKE) regen 100 101const-xs.inc: lib/IPC/SysV.pm regen.pl 102 @$(MAKE) regen 103 104POSTAMBLE 105 return $post; 106} 107 108