1use 5.008; 2 3use strict; 4use warnings; 5use ExtUtils::MakeMaker; 6 7BEGIN { 8 eval { require Config }; 9 die 'OS unsupported' if $@; 10 Config->import(qw/%Config/); 11} 12 13my @DEFINES; 14 15my $pl = $Config{perl_patchlevel}; 16print "Checking perl patchlevel... "; 17if (defined $pl && length $pl) { 18 $pl = int $pl; 19 push @DEFINES, '-DVMG_PERL_PATCHLEVEL=' . $pl; 20 print $pl, "\n"; 21} else { 22 $pl = undef; 23 print "none\n"; 24} 25 26my $is_as = 0; 27print "Checking if this is ActiveState Perl 5.8.8 build 822 or higher... "; 28if ($^V eq v5.8.8) { 29 eval { 30 require ActivePerl; 31 1; 32 } and do { 33 if (defined &ActivePerl::BUILD) { 34 my $build = int ActivePerl::BUILD(); 35 if ($build >= 822) { 36 $is_as = 1; 37 push @DEFINES, '-DVMG_COMPAT_ARRAY_PUSH_NOLEN=1'; 38 } 39 } 40 } 41} 42print $is_as ? "yes\n" : "no\n"; 43 44my $is_5110rel = 0; 45print "Checking if this is a released perl 5.11.0 or higher... "; 46if ($^V ge v5.11.0 and not defined $pl) { 47 my $describe = $Config{git_describe}; 48 # An empty 'describe' is fine 49 if (defined $describe and $describe !~ /^GitLive-/) { 50 $is_5110rel = 1; 51 push @DEFINES, '-DVMG_COMPAT_ARRAY_PUSH_NOLEN=0'; 52 } 53} 54print $is_5110rel ? "yes\n" : "no\n"; 55 56# Threads, Windows and 5.8.x don't seem to be best friends 57if ($^O eq 'MSWin32' && $^V lt v5.9.0) { 58 push @DEFINES, '-DVMG_MULTIPLICITY=0'; 59} 60 61# Fork emulation got "fixed" in 5.10.1 62if ($^O eq 'MSWin32' && $^V lt v5.10.1) { 63 push @DEFINES, '-DVMG_FORKSAFE=0'; 64} 65 66@DEFINES = (DEFINE => join ' ', @DEFINES) if @DEFINES; 67 68my $dist = 'Variable-Magic'; 69 70(my $name = $dist) =~ s{-}{::}g; 71 72(my $file = $dist) =~ s{-}{/}g; 73$file = "lib/$file.pm"; 74 75my %PREREQ_PM = ( 76 'Carp' => 0, 77 'Exporter' => 0, 78 'XSLoader' => 0, 79 'base' => 0, 80); 81 82my %META = ( 83 configure_requires => { 84 'Config' => 0, 85 'ExtUtils::MakeMaker' => 0, 86 }, 87 build_requires => { 88 'Carp' => 0, 89 'Config' => 0, 90 'ExtUtils::MakeMaker' => 0, 91 'Test::More' => 0, 92 %PREREQ_PM, 93 }, 94 dynamic_config => 1, 95 resources => { 96 bugtracker => "http://rt.cpan.org/NoAuth/ReportBug.html?Queue=$dist", 97 homepage => "http://search.cpan.org/dist/$dist/", 98 license => 'http://dev.perl.org/licenses/', 99 repository => "http://git.profvince.com/?p=perl%2Fmodules%2F$dist.git", 100 }, 101); 102 103WriteMakefile( 104 NAME => $name, 105 AUTHOR => 'Vincent Pit <perl@profvince.com>', 106 LICENSE => 'perl', 107 VERSION_FROM => $file, 108 ABSTRACT_FROM => $file, 109 PL_FILES => {}, 110 @DEFINES, 111 PREREQ_PM => \%PREREQ_PM, 112 MIN_PERL_VERSION => 5.008, 113 META_MERGE => \%META, 114 dist => { 115 PREOP => "pod2text $file > \$(DISTVNAME)/README", 116 COMPRESS => 'gzip -9f', SUFFIX => 'gz' 117 }, 118 clean => { 119 FILES => "$dist-* *.gcov *.gcda *.gcno cover_db Debian_CPANTS.txt" 120 }, 121); 122