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