]> git.vpit.fr Git - perl/modules/Variable-Magic.git/blob - Makefile.PL
Only enable VMG_COMPAT_ARRAY_PUSH_NOLEN for ActiveState's 5.8.[78] on Windows, as...
[perl/modules/Variable-Magic.git] / Makefile.PL
1 use 5.007003;
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  print "none\n";
23 }
24
25 my $is_as = 0;
26 print "Checking if this is Windows ActiveState 5.8.[78]... ";
27 if ($^O eq 'MSWin32' && $^V ge v5.8.7 && $^V lt v5.8.9) {
28  eval {
29   require Win32;
30   1;
31  } and do {
32   if (defined &Win32::BuildNumber) {
33    $is_as = 1;
34    push @DEFINES, '-DVMG_COMPAT_ARRAY_PUSH_NOLEN=1';
35   }
36  }
37 }
38 print $is_as ? "yes\n" : "no\n";
39
40 # Threads, Windows and 5.8.x don't seem to be best friends
41 if ($^O eq 'MSWin32' && $^V lt v5.9.0) {
42  push @DEFINES, '-DVMG_MULTIPLICITY=0';
43 }
44
45 @DEFINES = (DEFINE => join ' ', @DEFINES) if @DEFINES;
46
47 my $BUILD_REQUIRES = {
48  'Config'              => 0,
49  'ExtUtils::MakeMaker' => 0,
50  'Test::More'          => 0,
51 };
52
53 sub build_req {
54  my $tometa = ' >> $(DISTVNAME)/META.yml;';
55  my $build_req = 'echo "build_requires:" ' . $tometa;
56  foreach my $mod ( sort { lc $a cmp lc $b } keys %$BUILD_REQUIRES ) {
57   my $ver = $BUILD_REQUIRES->{$mod};
58   $build_req .= sprintf 'echo "    %-30s %s" %s', "$mod:", $ver, $tometa;
59  }
60  return $build_req;
61 }
62
63 WriteMakefile(
64     NAME          => 'Variable::Magic',
65     AUTHOR        => 'Vincent Pit <perl@profvince.com>',
66     LICENSE       => 'perl',
67     VERSION_FROM  => 'lib/Variable/Magic.pm',
68     ABSTRACT_FROM => 'lib/Variable/Magic.pm',
69     PL_FILES      => {},
70     @DEFINES,
71     PREREQ_PM     => {
72         'Carp'     => 0,
73         'Exporter' => 0,
74         'XSLoader' => 0
75     },
76     dist          => { 
77         PREOP      => 'pod2text lib/Variable/Magic.pm > $(DISTVNAME)/README; '
78                       . build_req,
79         COMPRESS   => 'gzip -9f', SUFFIX => 'gz'
80     },
81     clean         => { FILES => 'Variable-Magic-* *.gcov *.gcda *.gcno cover_db Debian_CPANTS.txt' },
82 );